← Back to Pull requests

fix(otelconf): report Prometheus HTTP server errors in v0.2.0 #9653

Closed
unknown closed this pull request without merging on Sep 15, 2026 12:13 UTC
View on GitHub
unknown unknown commented on Sep 09, 2026 09:16 UTC
Author

Problem

go.opentelemetry.io/contrib/otelconf/v0.2.0 starts an HTTP server for the Prometheus pull exporter in a goroutine. The error check on server.Serve(lis) is inverted: a clean shutdown (http.ErrServerClosed) is reported through otel.Handle as "the Prometheus HTTP server exited unexpectedly", while every genuine Serve failure (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:

if err := server.Serve(lis); err != nil && errors.Is(err, http.ErrServerClosed) {

The condition is missing the negation. The sibling implementations in otelconf/v0.3.0/metric.go and otelconf/x/metric.go already use !errors.Is(err, http.ErrServerClosed).

Fix

  • Negate the predicate (err != nil && !errors.Is(err, http.ErrServerClosed)), so the goroutine in prometheusReader is now identical to the one in v0.3.0 and x.

  • Add a CHANGELOG.md entry under Unreleased / Fixed.
  • No public API changes.

    The first revision extracted the check into a handleServeErr helper 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 that v0.3.0 and x already 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

  • Fixes https://github.com/open-telemetry/opentelemetry-go-contrib/issues/9056

  • Supersedes https://github.com/open-telemetry/opentelemetry-go-contrib/pull/9097 (closed by its author).
  • This change was prepared with an AI agent operated by KR-Ravindra, who reviewed and tested it.

    Diff: 241 lines (+180 / -61) across 3 files Reviewer: KR-Ravindra Review duration: 8817m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 241 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.328
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #9653"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 38.8% (MEDIUM) · Higher = larger blast radius
    38.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.3% · Safe to merge
    15.3%