Skip to content

Commit 881c10a

Browse files
grobinson-grafanath0th
authored andcommitted
Remove metrics from compat package (#3714)
This commit removes the metrics from the compat package in favour of the existing logging and the additional tools at hand, such as amtool, to validate Alertmanager configurations. Due to the global nature of the compat package, a consequence of config.Load, these metrics have proven to be less useful in practice than expected, both in Alertmanager and other projects such as Mimir. There are a number of reasons for this: 1. Because the compat package is global, these metrics cannot be reset each time config.Load is called, as in multi-tenant projects like Mimir loading a config for one tenant would reset the metrics for all tenants. This is also the reason the metrics are counters and not gauges. 2. Since the metrics are counters, it is difficult to create meaningful dashboards for Alertmanager as, unlike in Mimir, configurations are not reloaded at fixed intervals, and as such, operators cannot use rate to track configuration changes over time. In Alertmanager, there are much better tools available to validate that an Alertmanager configuration is compatible with the UTF-8 parser, including both the existing logging from Alertmanager server and amtool check-config. In other projects like Mimir, we can track configurations for individual tenants using log aggregation and storage systems such as Loki. This gives operators far more information than what is possible with the metrics, including the timestamp, input and ID of tenant configurations that are incompatible or have disagreement. Signed-off-by: George Robinson <[email protected]> Signed-off-by: Gokhan Sari <[email protected]>
1 parent 59a9e25 commit 881c10a

File tree

3 files changed

+2
-62
lines changed

3 files changed

+2
-62
lines changed

cli/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func initMatchersCompat(_ *kingpin.ParseContext) error {
6161
if err != nil {
6262
kingpin.Fatalf("error parsing the feature flag list: %v\n", err)
6363
}
64-
compat.InitFromFlags(logger, compat.NewMetrics(nil), featureConfig)
64+
compat.InitFromFlags(logger, featureConfig)
6565
return nil
6666
}
6767

cmd/alertmanager/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func run() int {
189189
level.Error(logger).Log("msg", "error parsing the feature flag list", "err", err)
190190
return 1
191191
}
192-
compat.InitFromFlags(logger, compat.RegisteredMetrics, ff)
192+
compat.InitFromFlags(logger, ff)
193193

194194
err = os.MkdirAll(*dataDir, 0o777)
195195
if err != nil {

matchers/compat/metrics.go

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)