Skip to content

[controller] fix depth metrics - #3253

Merged
knative-prow[bot] merged 2 commits into
knative:mainfrom
dprotaso:fix-depth-metrics
Sep 9, 2025
Merged

knative-prow[bot] merged 2 commits into
knative:mainfrom
dprotaso:fix-depth-metrics

Conversation

@dprotaso

@dprotaso dprotaso commented Sep 9, 2025

Copy link
Copy Markdown
Member

Fixes: #3242

  • fix two lane workqueue depth metric calculation by decrementing when we have something in the queue metrics tracking map
  • fix var name to reflect it's true purpose

I think the bug occurs when we have something in the consumer work queue and then something is added to the fast queue. We skip the add time recording on the second entry (and depth increment) and we end up with multiple Get calls that decremented the queue depth by too much.

Thus right now the depth metric is 'best-effort' since we're not really counting duplicate entries in the queue (that can't be deduped)

To address this we'd probably have to fork the client-go code to better instrument the metrics, or write our own queue implementation

@dprotaso

dprotaso commented Sep 9, 2025

Copy link
Copy Markdown
Member Author

/assign @evankanderson @Cali0707

@knative-prow knative-prow Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 9, 2025
@knative-prow
knative-prow Bot requested review from creydr and skonto September 9, 2025 01:02
@knative-prow knative-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 9, 2025

@evankanderson evankanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow knative-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 9, 2025
@knative-prow

knative-prow Bot commented Sep 9, 2025

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, evankanderson

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

@dprotaso

dprotaso commented Sep 9, 2025

Copy link
Copy Markdown
Member Author

/cherry-pick release-1.19

@knative-prow-robot

Copy link
Copy Markdown
Contributor

@dprotaso: once the present PR merges, I will cherry-pick it on top of release-1.19 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-1.19

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.

@codecov

codecov Bot commented Sep 9, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.08%. Comparing base (528bde3) to head (30a8352).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
controller/queue_metrics.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3253      +/-   ##
==========================================
- Coverage   75.09%   75.08%   -0.01%     
==========================================
  Files         187      187              
  Lines       10243    10244       +1     
==========================================
  Hits         7692     7692              
- Misses       2312     2313       +1     
  Partials      239      239              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@knative-prow
knative-prow Bot merged commit 8c9c1d3 into knative:main Sep 9, 2025
36 of 37 checks passed
@dprotaso
dprotaso deleted the fix-depth-metrics branch September 9, 2025 01:09
@knative-prow-robot

Copy link
Copy Markdown
Contributor

@dprotaso: new pull request created: #3254

Details

In response to this:

/cherry-pick release-1.19

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.

alvaroaleman added a commit to alvaroaleman/pkg that referenced this pull request Sep 14, 2026
This change replaces the two lane queue with a small wrapper around the
controller-runtime priorityqueue. Having a single queue for both
guarantees correct deduplication and avoid metrics issues like describes
in knative#3253. It is also much simpler.
alvaroaleman added a commit to alvaroaleman/pkg that referenced this pull request Sep 14, 2026
This change replaces the two lane queue with a small wrapper around the
controller-runtime priorityqueue. Having a single queue for both
guarantees correct deduplication and avoid metrics issues like describes
in knative#3253. It is also much simpler.

Signed-off-by: Alvaro Aleman <alvaroaleman@noreply.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Queue depth metric for two lane queue reporting negative numbers

4 participants