Repository navigation
Conversation
The Serve error check in prometheusReader was inverted, so a clean shutdown (http.ErrServerClosed) was reported as unexpected while real Serve errors were dropped. Extract the check into handleServeErr with the corrected predicate, matching otelconf/v0.3.0 and otelconf/x, and cover it with a unit test.
KR-Ravindra
force-pushed
the
fix/otelconf-v020-prometheus-serve-err
branch
from
September 9, 2026 09:16
bae65e0 to
5136f7d
Compare
KR-Ravindra
marked this pull request as ready for review
September 9, 2026 09:32
dmathieu
approved these changes
Sep 9, 2026
pellared
reviewed
Sep 9, 2026
Drop the handleServeErr helper and its unit test so prometheusReader in v0.2.0 has the same code as v0.3.0 and x, as requested in review. Signed-off-by: KR Ravindra <42912207+KR-Ravindra@users.noreply.github.com>
dashpole
approved these changes
Sep 14, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9653 +/- ##
=======================================
- Coverage 87.2% 87.2% -0.1%
=======================================
Files 201 201
Lines 14029 14029
=======================================
- Hits 12235 12234 -1
- Misses 1794 1795 +1
🚀 New features to boost your workflow:
|
pellared
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
go.opentelemetry.io/contrib/otelconf/v0.2.0starts an HTTP server for the Prometheus pull exporter in a goroutine. The error check onserver.Serve(lis)is inverted: a clean shutdown (http.ErrServerClosed) is reported throughotel.Handleas "the Prometheus HTTP server exited unexpectedly", while every genuineServefailure (accept errors, TLS/listener problems, etc.) is silently dropped. Operators therefore get a spurious error on every shutdown and no signal at all when the metrics endpoint actually stops serving.Root cause
otelconf/v0.2.0/metric.go:369:The condition is missing the negation. The sibling implementations in
otelconf/v0.3.0/metric.goandotelconf/x/metric.goalready use!errors.Is(err, http.ErrServerClosed).Fix
err != nil && !errors.Is(err, http.ErrServerClosed)), so the goroutine inprometheusReaderis now identical to the one inv0.3.0andx.CHANGELOG.mdentry under Unreleased / Fixed.No public API changes.
The first revision extracted the check into a
handleServeErrhelper with a table test; it was inlined again in e769464 at review request so the three implementations stay the same.How tested
The handler is the process-global
otel.Handle, so this branch has no isolated unit test (see the discussion on #9097); the fix is the same code thatv0.3.0andxalready run.From
otelconf/:go build ./...,go vet ./v0.2.0/...,go test -race ./v0.2.0/...(ok),golangci-lint run ./v0.2.0/...(0 issues).Links
This change was prepared with an AI agent operated by KR-Ravindra, who reviewed and tested it.