- Documentation
- Learning Hub
- Section 3 of 5 Choose and fix metric labels
Control labels at the source
Filter at the source
You can keep unnecessary series from ever leaving your infrastructure with relabeling rules in Prometheus, Alloy, or your collector.
- Allowlisting: keep an explicit set of important metrics and labels and drop everything else. For example, for Prometheus metrics, use
keepandlabelkeepactions. - Denylisting: drop an explicit set of high-cardinality metrics and labels and keep everything else. For example, for Prometheus metrics, use
dropandlabeldropactions.
For the full relabeling reference and examples, refer to Reduce metrics costs by filtering collected and forwarded metrics.
Enforce your strategy at a gateway
Relabeling rules only help if you control the collectors that apply them. In larger organizations, many teams send telemetry, and the team that pays the bill often can’t control every client. In that case, route telemetry through a tier of gateway collectors that your platform or admin team owns, and apply your labeling and filtering policies at that layer. Whatever upstream teams send, your rules run at the gateway before data reaches Grafana Cloud.
Fleet Management helps you run this pattern at scale by giving you centralized control over your collector configurations, so you can roll out and update gateway policies from one place instead of editing collectors one by one.