Skip to content

Conversation

@f41gh7
Copy link
Collaborator

@f41gh7 f41gh7 commented Dec 5, 2025

This commit adds object_namespace label to the metrics:

  • operator_alertmanager_bad_objects_count
  • operator_vmalert_bad_objects_count

It helps to route alerts on object_namespace label.

 This commit adds object_namespace label to the metrics:
* operator_alertmanager_bad_objects_count
* operator_vmalert_bad_objects_count

 It helps to route alerts on object_namespace label.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the object_namespace label to metrics tracking bad/broken configuration objects in the operator, enabling alerts to be routed based on the namespace where broken configurations exist.

  • Converts two counter metrics from simple counters to counter vectors with object_namespace label
  • Updates metric collection logic to group and count broken configs per namespace
  • Documents the feature addition in the CHANGELOG

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
internal/controller/operator/factory/vmalertmanager/alertmanager.go Converts operator_alertmanager_bad_objects_count from Counter to CounterVec with object_namespace label
internal/controller/operator/factory/vmalertmanager/statefulset.go Updates metric collection to group broken AlertmanagerConfigs by namespace and emit per-namespace counts
internal/controller/operator/factory/vmalert/rules.go Converts operator_vmalert_bad_objects_count from Counter to CounterVec with object_namespace label and updates collection logic
docs/CHANGELOG.md Documents the new object_namespace label feature for both metrics

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AndrewChubatiuk
Copy link
Contributor

Do we have the same for VMagent child objects?

@f41gh7
Copy link
Collaborator Author

f41gh7 commented Dec 5, 2025

Do we have the same for VMagent child objects?

There is no such metrics for vmagent and vmauth objects. Probably, we could add it. Can you please create an issue for that?

@AndrewChubatiuk
Copy link
Contributor

And what do you think about moving parent component name to labels and change metric name to operator_bad_objects_count?

Signed-off-by: f41gh7 <nik@victoriametrics.com>
Name: "operator_vmalert_bad_objects_count",
Help: "Number of incorrect objects by controller",
ConstLabels: prometheus.Labels{
"controller": "vmrules",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controller can be either vmrules or vmalerts, it's not static

Copy link
Contributor

@AndrewChubatiuk AndrewChubatiuk Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check PR #1676

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's better to remove controller label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants