mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-21 03:16:00 -08:00
Add --ignore-unknown-fields that ignores unknown fields in rule group
files. There are lots of tools in the ecosystem that "like" to extend
the rule group file structure but they are currently unreadable by
promtool if there's anything extra. The purpose of this flag is so that
we could use the "vanilla" promtool instead of rolling our own.
Some examples of tools/code:
https://github.com/grafana/mimir/blob/main/pkg/mimirtool/rules/rwrulefmt/rulefmt.go
8898eb3cc5/pkg/rules/rules.go (L18-L25)
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
34 lines
979 B
YAML
34 lines
979 B
YAML
# This is the rules file. It has an extra "ownership"
|
|
# field in the second group. promtool should ignore this field
|
|
# and not return an error with --ignore-unknown-fields.
|
|
|
|
groups:
|
|
- name: alerts
|
|
namespace: "foobar"
|
|
rules:
|
|
- alert: InstanceDown
|
|
expr: up == 0
|
|
for: 5m
|
|
labels:
|
|
severity: page
|
|
annotations:
|
|
summary: "Instance {{ $labels.instance }} down"
|
|
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."
|
|
- alert: AlwaysFiring
|
|
expr: 1
|
|
|
|
- name: rules
|
|
ownership:
|
|
service: "test"
|
|
rules:
|
|
- record: job:test:count_over_time1m
|
|
expr: sum without(instance) (count_over_time(test[1m]))
|
|
|
|
# A recording rule that doesn't depend on input series.
|
|
- record: fixed_data
|
|
expr: 1
|
|
|
|
# Subquery with default resolution test.
|
|
- record: suquery_interval_test
|
|
expr: count_over_time(up[5m:])
|