azure-eventhub v2: fix processingTime input metric#49864
Conversation
Move the processingTime metric update outside the loop in processReceivedEvents so it is recorded once per batch instead of once per event. Previously, because processingStartTime was set before the loop and never reset, each iteration recorded a cumulative duration: ~T, ~2T, ~3T, etc. This inflated the histogram sample count and skewed percentiles. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🤖 GitHub commentsJust comment with:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe update moves the ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services) |
|
@Mergifyio backport 8.19 9.3 9.4 |
✅ Backports have been createdDetails
|
* azure-eventhub v2: fix processingTime input metric Move the processingTime metric update outside the loop in processReceivedEvents so it is recorded once per batch instead of once per event. Previously, because processingStartTime was set before the loop and never reset, each iteration recorded a cumulative duration: ~T, ~2T, ~3T, etc. This inflated the histogram sample count and skewed percentiles. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update changelog * Fix forbidigo lint: replace logp.NewLogger with logp.L() in tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Switch to logptest --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 19da895)
* azure-eventhub v2: fix processingTime input metric Move the processingTime metric update outside the loop in processReceivedEvents so it is recorded once per batch instead of once per event. Previously, because processingStartTime was set before the loop and never reset, each iteration recorded a cumulative duration: ~T, ~2T, ~3T, etc. This inflated the histogram sample count and skewed percentiles. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update changelog * Fix forbidigo lint: replace logp.NewLogger with logp.L() in tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Switch to logptest --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 19da895)
* azure-eventhub v2: fix processingTime input metric Move the processingTime metric update outside the loop in processReceivedEvents so it is recorded once per batch instead of once per event. Previously, because processingStartTime was set before the loop and never reset, each iteration recorded a cumulative duration: ~T, ~2T, ~3T, etc. This inflated the histogram sample count and skewed percentiles. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update changelog * Fix forbidigo lint: replace logp.NewLogger with logp.L() in tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Switch to logptest --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 19da895)
Proposed commit message
Move the
processingTimemetric update outside the loop inprocessReceivedEventsso it is recorded once per batch instead of once per event.Before this change,
processingStartTimewas set once before the loop butprocessingTime.Update()was called on every iteration. Sincetime.Since(processingStartTime)grows with each iteration, the histogram received N cumulative samples (~T, ~2T, ~3T, ...) instead of a single sample with the total batch processing time. This inflated the histogram sample count and skewed percentiles.Revives #40547 with an added regression test.
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.How to test this PR locally
Run the new unit test:
The test sends 3 events through
processReceivedEventsand asserts thatprocessingTimeis updated exactly once (after the loop), not 3 times (once per event).Related issues
🤖 Generated with Claude Code