Skip to content

Add scrapeconfig discovery for InstanceHA metrics#902

Merged
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
lmiccini:add-instanceha-scrapeconfig
May 28, 2026
Merged

Add scrapeconfig discovery for InstanceHA metrics#902
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
lmiccini:add-instanceha-scrapeconfig

Conversation

@lmiccini

@lmiccini lmiccini commented May 28, 2026

Copy link
Copy Markdown
Contributor

Discover InstanceHA metrics services using label selectors (metrics=enabled, service=instanceha) and automatically generate a Prometheus ScrapeConfig for them, following the existing OVN pattern.

Depends-on: openstack-k8s-operators/infra-operator#590

Discover InstanceHA metrics services using label selectors
(metrics=enabled, service=instanceha) and automatically generate
a Prometheus ScrapeConfig for them, following the existing OVN pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci openshift-ci Bot requested review from dprince and vyzigold May 28, 2026 03:48
@centosinfra-prod-github-app

Copy link
Copy Markdown

This change depends on a change that failed to merge.

Change openstack-k8s-operators/infra-operator#590 is needed.

@lmiccini

Copy link
Copy Markdown
Contributor Author

recheck

@lmiccini

Copy link
Copy Markdown
Contributor Author

tested by creating instanceha/instanceha-0:

[zuul@controller-0 ~]$ oc get instanceha
NAME           STATUS   MESSAGE
instanceha-0   True     Setup complete

verifying the service was created and the scrapeconfig after that:

[zuul@controller-0 ~]$ oc get svc |grep insta
instanceha-0-metrics                ClusterIP      172.30.44.190    <none>           8080/TCP                                         10m

[zuul@controller-0 ~]$ oc get scrapeconfig |grep insta
telemetry-instanceha                             7m16s

tested querying metrics using:

[zuul@controller-0 ~]$ oc exec prometheus-metric-storage-0 -- curl -sk https://localhost:9090/api/v1/label/__name__/values | jq '.data[]'  |grep instance                                                                       
  "instanceha_hosts_processing"                                                                                                                                                                                                
  "instanceha_orphaned_host_recovered_created"                                                                                                                                                                                 
  "instanceha_orphaned_host_recovered_total"                                                                                                                                                                                   
  "instanceha_poll_consecutive_failures"                                                                                                                                                                                       
  "instanceha_poll_cycles_created"                                                                                                                                                                                             
  "instanceha_poll_cycles_total"                                                                                                                                                                                               
  "instanceha_threshold_exceeded_created"                                                                                                                                                                                      
  "instanceha_threshold_exceeded_total"

@centosinfra-prod-github-app

Copy link
Copy Markdown

This change depends on a change that failed to merge.

Change openstack-k8s-operators/infra-operator#590 is needed.

@lmiccini

Copy link
Copy Markdown
Contributor Author

recheck

@centosinfra-prod-github-app

Copy link
Copy Markdown

This change depends on a change that failed to merge.

Change openstack-k8s-operators/infra-operator#590 is needed.

@lmiccini

Copy link
Copy Markdown
Contributor Author

recheck

@centosinfra-prod-github-app

Copy link
Copy Markdown

This change depends on a change that failed to merge.

Change openstack-k8s-operators/infra-operator#590 is needed.

@lmiccini

Copy link
Copy Markdown
Contributor Author

recheck

if labels := o.GetLabels(); labels != nil {
if labels["metrics"] == "enabled" && (labels["service"] == "ovn-northd" || labels["service"] == "ovn-controller-metrics" || labels["service"] == "ovsdbserver-nb" || labels["service"] == "ovsdbserver-sb") {
// get all metricstorage CRs in the same namespace
if labels["metrics"] == "enabled" && (labels["service"] == "ovn-northd" || labels["service"] == "ovn-controller-metrics" || labels["service"] == "ovsdbserver-nb" || labels["service"] == "ovsdbserver-sb" || labels["service"] == "instanceha") {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there anything against leaving this just with "if labels["metrics"]" instead of having to maintain a (maybe) growing list of services that do not offer too much advantages

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you tell me :) I just didn't want to abstract this too much and I thought it could prevent some "rogue" service running in the same namespace from getting a scrapeconfig when it shouldn't.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, lets leave this pattern for now and we can remove the labels maybe in a subsequent patch

@openshift-ci

openshift-ci Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jlarriba, lmiccini

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot Bot merged commit 559979f into openstack-k8s-operators:main May 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants