Skip to content

Add check similar to promql/aggregate for alert expressions using absent() or some other way to enforce alerts using absent() to preserve labels #1540

@skaybay

Description

@skaybay

This might be a niche use case, but our alerting system requires all alerts to retain a specific label used to associate alerts with configuration items. We've addressed the most common violations using the promql/aggregate check, which ensures labels are not dropped during aggregation. However, we also need a mechanism to enforce label matchers in alerts that use the absent() function.

Specifically, we propose a new check that flags expressions like absent(metric) or absent(metric{}) where no label matchers are provided. The check should function analogously to promql/aggregate, validating that absent() is scoped with appropriate label constraints.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions