diff --git a/uptrace/client.go b/uptrace/client.go index 934dc492..62e25751 100644 --- a/uptrace/client.go +++ b/uptrace/client.go @@ -8,7 +8,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" sdklog "go.opentelemetry.io/otel/sdk/log" - "go.opentelemetry.io/otel/sdk/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/trace" ) @@ -21,7 +21,7 @@ type client struct { tracer trace.Tracer tp *sdktrace.TracerProvider - mp *metric.MeterProvider + mp *sdkmetric.MeterProvider lp *sdklog.LoggerProvider } @@ -65,6 +65,11 @@ func (c *client) ForceFlush(ctx context.Context) (lastErr error) { lastErr = err } } + if c.lp != nil { + if err := c.lp.ForceFlush(ctx); err != nil { + lastErr = err + } + } return lastErr }