You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-19 21:45:50 +02:00
Fix memory leak in exemplar reservoir by storing SpanContext instead of Context (#8389)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/8337 Co-authored-by: Robert Pająk <pellared@hotmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix memory leak in `go.opentelemetry.io/otel/sdk/metric/exemplar` Reservoir where full `context.Context` was stored, pinning large objects like gRPC transport buffers. (#8389)
|
||||
- Interpret HTTP `Retry-After` header values as seconds instead of nanoseconds when retrying OTLP HTTP exports in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8383)
|
||||
- Drastically reduce histogram heap allocations by reusing `BucketCounts` and `Exemplars` slices across `Collect` cycles in the cumulative histogram aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#8428)
|
||||
- Support HTTP-date values in the HTTP `Retry-After` header when retrying OTLP HTTP exports in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8417)
|
||||
|
||||
@@ -31,7 +31,7 @@ func (r *storage) store(ctx context.Context, idx int, ts time.Time, v Value, dro
|
||||
r.measurements[idx].FilteredAttributes = droppedAttr
|
||||
r.measurements[idx].Time = ts
|
||||
r.measurements[idx].Value = v
|
||||
r.measurements[idx].Ctx = ctx
|
||||
r.measurements[idx].SpanContext = trace.SpanContextFromContext(ctx)
|
||||
r.measurements[idx].valid = true
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ type measurement struct {
|
||||
Time time.Time
|
||||
// Value is the value of the measurement.
|
||||
Value Value
|
||||
// Ctx is the context active when a measurement was made.
|
||||
Ctx context.Context
|
||||
// SpanContext is the SpanContext active when a measurement was made.
|
||||
SpanContext trace.SpanContext
|
||||
|
||||
valid bool
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func (m *measurement) exemplar(dest *Exemplar) bool {
|
||||
dest.Time = m.Time
|
||||
dest.Value = m.Value
|
||||
|
||||
sc := trace.SpanContextFromContext(m.Ctx)
|
||||
sc := m.SpanContext
|
||||
if sc.HasTraceID() {
|
||||
traceID := sc.TraceID()
|
||||
dest.TraceID = traceID[:]
|
||||
|
||||
Reference in New Issue
Block a user