Skip to content

Commit fb6bba5

Browse files
committed
move the OnEnding processor into internal/x
1 parent 999175e commit fb6bba5

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package x // import "go.opentelemetry.io/otel/sdk/internal/x"
5+
6+
import "go.opentelemetry.io/otel/trace"
7+
8+
// OnEndingSpanProcessor represents span processors that allow mutating spans
9+
// just before they are ended and made immutable.
10+
type OnEndingSpanProcessor interface {
11+
// OnEnding is called while the span is finished, and while spans are still
12+
// mutable. It is called synchronously and cannot block.
13+
OnEnding(trace.Span)
14+
}

sdk/trace/span.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"go.opentelemetry.io/otel/codes"
2020
"go.opentelemetry.io/otel/internal/global"
2121
"go.opentelemetry.io/otel/sdk/instrumentation"
22+
"go.opentelemetry.io/otel/sdk/internal/x"
2223
"go.opentelemetry.io/otel/sdk/resource"
2324
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
2425
"go.opentelemetry.io/otel/trace"
@@ -427,7 +428,7 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) {
427428

428429
sps := s.tracer.provider.getSpanProcessors()
429430
for _, sp := range sps {
430-
if oesp, ok := sp.sp.(OnEndingSpanProcessor); ok {
431+
if oesp, ok := sp.sp.(x.OnEndingSpanProcessor); ok {
431432
oesp.OnEnding(s)
432433
}
433434
}

sdk/trace/span_processor.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,6 @@ type SpanProcessor interface {
4949
// must never be done outside of a new major release.
5050
}
5151

52-
// OnEndingSpanProcessor represents span processors that allow mutating spans
53-
// just before they are ended and made immutable.
54-
//
55-
// NOT STABLE: This interface still has a status of "development", and may have
56-
// breaking changes.
57-
type OnEndingSpanProcessor interface {
58-
// OnEnding is called while the span is finished, and while spans are still
59-
// mutable. It is called synchronously and cannot block.
60-
OnEnding(ReadWriteSpan)
61-
}
62-
6352
type spanProcessorState struct {
6453
sp SpanProcessor
6554
state sync.Once

sdk/trace/span_processor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (t *testSpanProcessor) OnStart(parent context.Context, s sdktrace.ReadWrite
4646
t.spansStarted = append(t.spansStarted, s)
4747
}
4848

49-
func (t *testSpanProcessor) OnEnding(s sdktrace.ReadWriteSpan) {
49+
func (t *testSpanProcessor) OnEnding(s trace.Span) {
5050
if t == nil {
5151
return
5252
}

0 commit comments

Comments
 (0)