Skip to content

Commit

Permalink
feat: support for ForceFlush of LoggerProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
吴温炎 committed Sep 13, 2024
1 parent ad257c4 commit d61132b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions uptrace/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -21,7 +21,7 @@ type client struct {
tracer trace.Tracer

tp *sdktrace.TracerProvider
mp *metric.MeterProvider
mp *sdkmetric.MeterProvider
lp *sdklog.LoggerProvider
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit d61132b

Please sign in to comment.