Skip to content

fix(observability): Fix executing operation gauge decrement on error#7267

Merged
koushiro merged 1 commit intoapache:mainfrom
dentiny:hjiang/fix-executing-operation-gauge
Mar 24, 2026
Merged

fix(observability): Fix executing operation gauge decrement on error#7267
koushiro merged 1 commit intoapache:mainfrom
dentiny:hjiang/fix-executing-operation-gauge

Conversation

@dentiny
Copy link
Copy Markdown
Contributor

@dentiny dentiny commented Mar 23, 2026

Which issue does this PR close?

Closes #7266

Rationale for this change

If I don't read the code wrongly, I think in certain places we don't decrement the executing operation count on errors.

What changes are included in this PR?

This PR decrements gauge value on these forgotten errors.
I thought about making a RAII object for observe, but we also have MetricsWrapper which is more or less a RAII wrapper, don't want to complicate things here, but could be a followup issue.

Are there any user-facing changes?

No.

AI Usage Statement

Opus 4.6 helped me make the change.

@dentiny dentiny requested a review from Xuanwo as a code owner March 23, 2026 23:42
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. releases-note/fix The PR fixes a bug or has a title that begins with "fix" labels Mar 23, 2026
@dentiny
Copy link
Copy Markdown
Contributor Author

dentiny commented Mar 23, 2026

The CI error doesn't seem to be caused by my change.

error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to 
'C:\Users\runneradmin\.rustup\tmp\b5wk0749pnz3tp8f_file': error downloading file: error sending request for url 
(https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256): client error (Connect): tcp connect error: A 
connection attempt failed because the connected party did not properly respond after a period of time, or 
established connection failed because connected host has failed to respond. (os error 10060)

Comment on lines 914 to 915
self.interceptor
.observe(self.labels.clone(), MetricValue::OperationExecuting(-1));
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.

I think we have already done this in the Drop implementation of MetricsWrapper.

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.

I think my changed places don't even reach MetricsWrapper :thinking_face:

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.

My understanding is:

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.

I misunderstood what you meant, good catch, you're right.

@dentiny dentiny requested a review from koushiro March 24, 2026 04:31
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Mar 24, 2026
@koushiro koushiro merged commit 195a793 into apache:main Mar 24, 2026
93 of 94 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer releases-note/fix The PR fixes a bug or has a title that begins with "fix" size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: OperationExecuting metrics doesn't decrement on error

2 participants