Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: add environment filter in infra monitoring (#8309)

Amlan Kumar Nandy78f396b94abe
diff --git a/frontend/src/container/InfraMonitoringHosts/utils.tsx b/frontend/src/container/InfraMonitoringHosts/utils.tsx
index 4e9bbd4ba2..43645a9cf8 100644
--- a/frontend/src/container/InfraMonitoringHosts/utils.tsx
+++ b/frontend/src/container/InfraMonitoringHosts/utils.tsx
@@ -210,6 +210,10 @@ export function GetHostsQuickFiltersConfig(
? 'system.cpu.load_average.15m'
: 'system_cpu_load_average_15m';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
+
return [
{
type: FiltersType.CHECKBOX,
@@ -241,5 +245,18 @@ export function GetHostsQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
diff --git a/frontend/src/container/InfraMonitoringK8s/constants.ts b/frontend/src/container/InfraMonitoringK8s/constants.ts
index 6956b2637c..eaaba2be8f 100644
--- a/frontend/src/container/InfraMonitoringK8s/constants.ts
+++ b/frontend/src/container/InfraMonitoringK8s/constants.ts
@@ -90,6 +90,9 @@ export function GetPodsQuickFiltersConfig(
? 'k8s.daemonset.name'
: 'k8s_daemonset_name';
const jobKey = dotMetricsEnabled ? 'k8s.job.name' : 'k8s_job_name';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
// Define aggregate attribute (metric) name
const cpuUtilizationMetric = dotMetricsEnabled
@@ -225,6 +228,19 @@ export function GetPodsQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: false,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
@@ -239,6 +255,9 @@ export function GetNodesQuickFiltersConfig(
const cpuUtilMetric = dotMetricsEnabled
? 'k8s.node.cpu.utilization'
: 'k8s_node_cpu_utilization';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
return [
{
@@ -273,6 +292,19 @@ export function GetNodesQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
@@ -286,6 +318,9 @@ export function GetNamespaceQuickFiltersConfig(
const cpuUtilMetric = dotMetricsEnabled
? 'k8s.pod.cpu.utilization'
: 'k8s_pod_cpu_utilization';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
return [
{
@@ -320,6 +355,19 @@ export function GetNamespaceQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
@@ -330,6 +378,9 @@ export function GetClustersQuickFiltersConfig(
const cpuUtilMetric = dotMetricsEnabled
? 'k8s.node.cpu.utilization'
: 'k8s_node_cpu_utilization';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
return [
{
@@ -348,6 +399,19 @@ export function GetClustersQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
@@ -357,6 +421,9 @@ export function GetContainersQuickFiltersConfig(
const containerKey = dotMetricsEnabled
? 'k8s.container.name'
: 'k8s_container_name';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
return [
{
@@ -372,6 +439,19 @@ export function GetContainersQuickFiltersConfig(
},
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
@@ -388,6 +468,9 @@ export function GetVolumesQuickFiltersConfig(
const volumeMetric = dotMetricsEnabled
? 'k8s.volume.capacity'
: 'k8s_volume_capacity';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
return [
{
@@ -438,6 +521,19 @@ export function GetVolumesQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
@@ -454,6 +550,9 @@ export function GetDeploymentsQuickFiltersConfig(
const metric = dotMetricsEnabled
? 'k8s.pod.cpu.utilization'
: 'k8s_pod_cpu_utilization';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
return [
{
@@ -504,6 +603,19 @@ export function GetDeploymentsQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
@@ -520,6 +632,9 @@ export function GetStatefulsetsQuickFiltersConfig(
const metric = dotMetricsEnabled
? 'k8s.pod.cpu.utilization'
: 'k8s_pod_cpu_utilization';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
return [
{
@@ -570,6 +685,19 @@ export function GetStatefulsetsQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
@@ -586,6 +714,9 @@ export function GetDaemonsetsQuickFiltersConfig(
const metricName = dotMetricsEnabled
? 'k8s.pod.cpu.utilization'
: 'k8s_pod_cpu_utilization';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
return [
{
@@ -634,6 +765,19 @@ export function GetDaemonsetsQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}
@@ -648,6 +792,9 @@ export function GetJobsQuickFiltersConfig(
const metricName = dotMetricsEnabled
? 'k8s.pod.cpu.utilization'
: 'k8s_pod_cpu_utilization';
+ const environmentKey = dotMetricsEnabled
+ ? 'deployment.environment'
+ : 'deployment_environment';
return [
{
@@ -696,6 +843,19 @@ export function GetJobsQuickFiltersConfig(
dataSource: DataSource.METRICS,
defaultOpen: true,
},
+ {
+ type: FiltersType.CHECKBOX,
+ title: 'Environment',
+ attributeKey: {
+ key: environmentKey,
+ dataType: DataTypes.String,
+ type: 'resource',
+ isColumn: false,
+ isJSON: false,
+ },
+ dataSource: DataSource.METRICS,
+ defaultOpen: true,
+ },
];
}