From 8e0db19df2d08bac63d7ed264bc88a85a066c52a Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:58:56 -0800 Subject: [PATCH] config: don't log an error on close (#6299) This is an expected outcome of the server shutdown being called, no need to log an error about it. --------- Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- CHANGELOG.md | 1 + config/metric.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd47bae6343..9716cd07529 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Upgrade `go.opentelemetry.io/otel/semconv/v1.17.0` to `go.opentelemetry.io/otel/semconv/v1.21.0` in `go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo`. (#6272) - Resource doesn't merge with defaults if a valid resource is configured in `go.opentelemetry.io/contrib/config`. (#6289) +- `otel.Handle` is no longer called on a successful shutdown of the Prometheus exporter in `go.opentelemetry.io/contrib/config`. (#6299) ### Fixed diff --git a/config/metric.go b/config/metric.go index fb2dd23905c..7648d466385 100644 --- a/config/metric.go +++ b/config/metric.go @@ -338,7 +338,7 @@ func prometheusReader(ctx context.Context, prometheusConfig *Prometheus) (sdkmet } go func() { - if err := server.Serve(lis); err != nil && errors.Is(err, http.ErrServerClosed) { + if err := server.Serve(lis); err != nil && !errors.Is(err, http.ErrServerClosed) { otel.Handle(fmt.Errorf("the Prometheus HTTP server exited unexpectedly: %w", err)) } }()