Skip to content

Commit

Permalink
change all metrics.alloy to drop init container in separate step
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhackl committed Nov 4, 2024
1 parent 2833696 commit eb1789d
Show file tree
Hide file tree
Showing 18 changed files with 143 additions and 35 deletions.
10 changes: 8 additions & 2 deletions modules/broker/rabbitmq/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "rabbitmq-exporter") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "rabbitmq-exporter") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/collector/agent/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/databases/kv/etcd/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/databases/kv/memcached/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/databases/kv/redis/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "redis-exporter") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "redis-exporter") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/databases/sql/mysql/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "mysql-exporter") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "mysql-exporter") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/databases/sql/postgres/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "postgres-exporter") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "postgres-exporter") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/databases/timeseries/loki/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "http-metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "http-metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/databases/timeseries/mimir/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "http-metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "http-metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/databases/timeseries/pyroscope/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "http-metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "http-metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/databases/timeseries/tempo/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "http-metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "http-metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
8 changes: 7 additions & 1 deletion modules/kubernetes/cert-manager/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "http-metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/kubernetes/core/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -925,13 +925,19 @@ declare "kube_dns" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/kubernetes/konnectivity-agent/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/networking/consul/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/networking/haproxy/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "prometheus") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "prometheus") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/system/node-exporter/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "metrics") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down
10 changes: 8 additions & 2 deletions modules/ui/grafana/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ declare "kubernetes" {
"__meta_kubernetes_pod_container_port_name",
"__meta_kubernetes_pod_phase",
"__meta_kubernetes_pod_ready",
"__meta_kubernetes_pod_container_init",
]
separator = "@"
regex = coalesce(argument.port_name.value, "grafana") + "@Running@true@false"
regex = coalesce(argument.port_name.value, "grafana") + "@Running@true"
action = "keep"
}

// drop any init containers
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}

// set the namespace label
rule {
source_labels = ["__meta_kubernetes_namespace"]
Expand Down

0 comments on commit eb1789d

Please sign in to comment.