Skip to content

Commit 35768bd

Browse files
committed
move the OnEnding processor into internal/x
1 parent fd9596a commit 35768bd

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1010

1111
### Added
1212

13-
- The `OnEndingSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace` to implement the `OnEnding` callback. (#5756)
13+
- Support for the `OnEnding` callback in span processors. (#5756)
1414

1515
### Removed
1616

sdk/internal/x/onending_processor.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
// OnEndingSpanProcessor represents span processors that allow mutating spans
7+
// just before they are ended and made immutable.
8+
type OnEndingSpanProcessor interface {
9+
// OnEnding is called while the span is finished, and while spans are still
10+
// mutable. It is called synchronously and cannot block.
11+
OnEnding(ReadWriteSpan)
12+
}

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

0 commit comments

Comments
 (0)