From 0aa528aa54ae254a3fbf5631a465d80ba9046a6c Mon Sep 17 00:00:00 2001 From: Miles-Garnsey Date: Mon, 30 Jan 2023 14:47:23 +1100 Subject: [PATCH] Add default metrics filtering based on old MCAC config. --- .../cassandra_agent/cassandra_agent_config.go | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/pkg/telemetry/cassandra_agent/cassandra_agent_config.go b/pkg/telemetry/cassandra_agent/cassandra_agent_config.go index 230fafdc9..2b860e921 100644 --- a/pkg/telemetry/cassandra_agent/cassandra_agent_config.go +++ b/pkg/telemetry/cassandra_agent/cassandra_agent_config.go @@ -12,6 +12,7 @@ import ( "github.com/k8ssandra/k8ssandra-operator/pkg/cassandra" "github.com/k8ssandra/k8ssandra-operator/pkg/labels" "github.com/k8ssandra/k8ssandra-operator/pkg/result" + promapi "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -27,6 +28,91 @@ var ( Port: "9000", Address: "127.0.0.1", }, + Filters: []promapi.RelabelConfig{ + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.Table.*", + TargetLabel: "should_drop", + Replacement: "true", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.table.*", + TargetLabel: "should_drop", + Replacement: "true", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.table\\.live_ss_table_count", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.Table\\.LiveSSTableCount", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.table\\.live_disk_space_used", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.table\\.LiveDiskSpaceUsed", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.Table\\.Memtable", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.Table\\.Compaction", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.table\\.read", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.table\\.write", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.table\\.range", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.table\\.coordinator", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"__origname__"}, + Regex: "org\\.apache\\.cassandra\\.metrics\\.table\\.dropped_mutations", + TargetLabel: "should_drop", + Replacement: "false", + }, + { + SourceLabels: []string{"should_drop"}, + Regex: "true", + Action: "drop", + }, + }, } )