Grafana alloy - dropping metrics

Hi,

I’m new to Alloy and have been following this guide to set up monitoring of a Linux host into Grafana cloud. I wanted to drop all metrics related to node_disk_*, (e.g. node_disk_read_time_seconds_total) so I modified the /etc/alloy/config.alloy file with an additonal rule (top one, bottom one is from the documentation) as shown:

prometheus.relabel "alloy_check" {
  forward_to = [prometheus.remote_write.metrics_service.receiver]

  rule {
    action        = "drop"
    source_labels = ["__name__"]
    regex         = "(node_disk_.*)"
  }
  rule {
    source_labels = ["__name__"]
    regex         = "(prometheus_target_sync_length_seconds_sum|prometheus_target_scrapes_.*|prometheus_target_interval.*|prometheus_sd_discovered_targets|alloy_build.*|prometheus_remote_write_wal_samples_appended_total|process_start_time_seconds)"
    action        = "keep"
  }
}

The config reloads OK but it doesn’t drop anything. I’m guessing that I’m looking in the wrong place here, can anyone point me in the right direction?

Here is my (lightly redacted) config file, for reference: alloy.config - Pastebin.com

Thanks!

It looks like you’ve got the name filter on the alloy self-monitoring metrics, but you want to add it to the other relabel component prometheus.relabel "integrations_node_exporter"

1 Like