Skip to content

Commit

Permalink
move the OnEnding processor into internal/x
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Aug 30, 2024
1 parent 999175e commit b05b02f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
14 changes: 14 additions & 0 deletions sdk/internal/x/onending_processor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package x // import "go.opentelemetry.io/otel/sdk/internal/x"

import "go.opentelemetry.io/otel/trace"

// OnEndingSpanProcessor represents span processors that allow mutating spans
// just before they are ended and made immutable.
type OnEndingSpanProcessor interface {
// OnEnding is called while the span is finished, and while spans are still
// mutable. It is called synchronously and cannot block.
OnEnding(trace.Span)
}
3 changes: 2 additions & 1 deletion sdk/trace/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/internal/global"
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/internal/x"
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
"go.opentelemetry.io/otel/trace"
Expand Down Expand Up @@ -427,7 +428,7 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) {

sps := s.tracer.provider.getSpanProcessors()
for _, sp := range sps {
if oesp, ok := sp.sp.(OnEndingSpanProcessor); ok {
if oesp, ok := sp.sp.(x.OnEndingSpanProcessor); ok {
oesp.OnEnding(s)
}
}
Expand Down
11 changes: 0 additions & 11 deletions sdk/trace/span_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,6 @@ type SpanProcessor interface {
// must never be done outside of a new major release.
}

// OnEndingSpanProcessor represents span processors that allow mutating spans
// just before they are ended and made immutable.
//
// NOT STABLE: This interface still has a status of "development", and may have
// breaking changes.
type OnEndingSpanProcessor interface {
// OnEnding is called while the span is finished, and while spans are still
// mutable. It is called synchronously and cannot block.
OnEnding(ReadWriteSpan)
}

type spanProcessorState struct {
sp SpanProcessor
state sync.Once
Expand Down

0 comments on commit b05b02f

Please sign in to comment.