Fix metric names: strip loki_process_custom_ prefix, drop internal labels
Alloy's stage.metrics prefixes all metric names with loki_process_custom_. Add a relabel rule to strip the prefix so dashboards can query clean names (flyio_nginx_http_requests_total etc). Also drop component_id/component_path/filename labels. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
80e7d11058
commit
176d38be68
1 changed files with 15 additions and 1 deletions
|
|
@ -110,10 +110,24 @@ prometheus.scrape "self" {
|
|||
scrape_interval = "15s"
|
||||
}
|
||||
|
||||
// Add instance label to all metrics
|
||||
// Strip the "loki_process_custom_" prefix that Alloy adds to stage.metrics,
|
||||
// then add instance label. This keeps dashboard queries clean.
|
||||
prometheus.relabel "instance" {
|
||||
forward_to = [prometheus.remote_write.prometheus.receiver]
|
||||
|
||||
rule {
|
||||
source_labels = ["__name__"]
|
||||
regex = "loki_process_custom_(.*)"
|
||||
target_label = "__name__"
|
||||
replacement = "$1"
|
||||
}
|
||||
|
||||
// Drop internal labels added by the loki pipeline
|
||||
rule {
|
||||
regex = "component_id|component_path|filename"
|
||||
action = "labeldrop"
|
||||
}
|
||||
|
||||
rule {
|
||||
target_label = "instance"
|
||||
replacement = "flyio-proxy"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue