Skip to content

OCPBUGS-100435: Fix ListenerSet metric registry and add metric e2e verification - #1534

Draft
gcs278 wants to merge 2 commits into
openshift:masterfrom
gcs278:listenerset-prometheus-e2e
Draft

OCPBUGS-100435: Fix ListenerSet metric registry and add metric e2e verification#1534
gcs278 wants to merge 2 commits into
openshift:masterfrom
gcs278:listenerset-prometheus-e2e

Conversation

@gcs278

@gcs278 gcs278 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the ingress_operator_listenerset_on_managed_gateway Prometheus metric to use the controller-runtime metrics registry instead of the default global Prometheus registry. After the metrics server migration (NE-2742), only metrics on ctrlruntimemetrics.Registry are served — the listenerset metric was being set correctly but never appeared in Prometheus.

Also adds e2e test coverage verifying the metric is set and cleaned up properly.

Changes

  • Registry fix: Replace prometheus.Register() with ctrlruntimemetrics.Registry.Register() in pkg/operator/controller/listenerset-status/controller.go
  • E2e verification: Add assertMetricValue and assertMetricGone helpers to verify the Prometheus metric lifecycle in testListenerSetNotAccepted

Test plan

  • testListenerSetNotAccepted e2e passes — metric value is 1 when ListenerSet targets a managed Gateway
  • Metric is cleaned up after ListenerSet deletion
  • ListenerSetOnManagedGateway alert fires in the console when a ListenerSet targets a managed Gateway

Bug: https://issues.redhat.com/browse/OCPBUGS-100435

🤖 Generated with Claude Code

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 31, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@gcs278: This pull request explicitly references no jira issue.

Details

In response to this:

Summary

Adds Prometheus metric verification to the testListenerSetNotAccepted e2e test. Includes debug logging to diagnose why the metric query failed in previous CI runs on vSphere/MetalLB.

Debug logging added

  • Dumps all ingress_operator_listenerset_on_managed_gateway metrics before the targeted query
  • Logs the exact PromQL query string
  • Logs metric labels and values when found
  • Logs result type mismatches

Tests

  • Verifies ingress_operator_listenerset_on_managed_gateway{listenerset_name, listenerset_namespace} is set to 1
  • Verifies metric is cleaned up after ListenerSet deletion

Follow-up to #1513.

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: decc5ce0-7a31-46d9-956c-7353b245f117

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@gcs278 gcs278 changed the title no-jira: Add Prometheus metric verification to ListenerSet e2e test [WIP] Prometheus metric verification to ListenerSet e2e test Jul 31, 2026
@gcs278

gcs278 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-operator
/test e2e-gcp-operator

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign miciah for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@gcs278
gcs278 force-pushed the listenerset-prometheus-e2e branch from e94d967 to a0df180 Compare July 31, 2026 20:00
@gcs278

gcs278 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

ah darn missing a }.
/test e2e-aws-operator
/test e2e-gcp-operator

@gcs278

gcs278 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-operator
/test e2e-gcp-operator

@openshift-ci

openshift-ci Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@gcs278: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-operator ff293f4 link true /test e2e-gcp-operator

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@gcs278
gcs278 force-pushed the listenerset-prometheus-e2e branch from ff293f4 to 3f97a4a Compare August 1, 2026 13:31
gcs278 and others added 2 commits August 1, 2026 09:32
The metric was registered with prometheus.Register() (the default global
registry) instead of ctrlruntimemetrics.Registry.Register() (the
controller-runtime registry that the operator's metrics server serves).
This caused the metric to never appear in Prometheus scrapes despite
being set correctly by the controller.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds metric checks to testListenerSetNotAccepted:
- Verifies ingress_operator_listenerset_on_managed_gateway is set to 1
- Verifies metric is cleaned up after ListenerSet deletion
- Includes debug logging to diagnose CI environment issues:
  - Dumps all listenerset metrics before targeted query
  - Logs the exact query string being used
  - Logs metric labels and values when found

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gcs278
gcs278 force-pushed the listenerset-prometheus-e2e branch from 3f97a4a to 24b47f4 Compare August 1, 2026 13:32
@gcs278 gcs278 changed the title [WIP] Prometheus metric verification to ListenerSet e2e test OCPBUGS-100435: Fix ListenerSet metric registry and add metric e2e verification Aug 1, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@gcs278: This pull request references Jira Issue OCPBUGS-100435, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

Fixes the ingress_operator_listenerset_on_managed_gateway Prometheus metric to use the controller-runtime metrics registry instead of the default global Prometheus registry. After the metrics server migration (NE-2742), only metrics on ctrlruntimemetrics.Registry are served — the listenerset metric was being set correctly but never appeared in Prometheus.

Also adds e2e test coverage verifying the metric is set and cleaned up properly.

Changes

  • Registry fix: Replace prometheus.Register() with ctrlruntimemetrics.Registry.Register() in pkg/operator/controller/listenerset-status/controller.go
  • E2e verification: Add assertMetricValue and assertMetricGone helpers to verify the Prometheus metric lifecycle in testListenerSetNotAccepted

Test plan

  • testListenerSetNotAccepted e2e passes — metric value is 1 when ListenerSet targets a managed Gateway
  • Metric is cleaned up after ListenerSet deletion
  • ListenerSetOnManagedGateway alert fires in the console when a ListenerSet targets a managed Gateway

Bug: https://issues.redhat.com/browse/OCPBUGS-100435

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Aug 1, 2026
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 3, 2026
@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants