Skip to content

Commit

Permalink
Return SpanProcessor ptr not trace.SpanProcessor from `baggagetra…
Browse files Browse the repository at this point in the history
…ce.New` (#5810)

Return the concrete type so user wanting underlying type do not need to
make a type assertion.
  • Loading branch information
MrAlias authored Jun 27, 2024
1 parent e891fb8 commit ef02c78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Improve performance of `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` with the usage of `WithAttributeSet()` instead of `WithAttribute()`. (#5664)
- Update `go.opentelemetry.io/contrib/config` to latest released configuration schema which introduces breaking changes where `Attributes` is now a `map[string]interface{}`. (#5758)
- Rename `BaggageKeyPredicate` to `Filter` in `go.opentelemetry.io/contrib/processors/baggage/baggagetrace`. (#5809)
- Return `*SpanProcessor` from `"go.opentelemetry.io/contrib/processors/baggage/baggagetrace".New` instead of the `trace.SpanProcessor` interface. (#5810)

## [1.27.0/0.52.0/0.21.0/0.7.0/0.2.0] - 2024-05-21

Expand Down
7 changes: 4 additions & 3 deletions processors/baggage/baggagetrace/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ type Filter func(key string) bool
// AllowAllBaggageKeys allows all baggage members to be added to a span.
var AllowAllBaggageKeys Filter = func(string) bool { return true }

// SpanProcessor is a processing pipeline for spans in the trace signal.
// SpanProcessor is a [trace.SpanProcessor] implementation that adds baggage
// members onto a span as attributes.
type SpanProcessor struct {
filter Filter
}

var _ trace.SpanProcessor = (*SpanProcessor)(nil)

// New returns a new SpanProcessor.
// New returns a new [SpanProcessor].
//
// The Baggage span processor duplicates onto a span the attributes found
// in Baggage in the parent context at the moment the span is started.
// The passed filter determines which baggage members are added to the span.
func New(filter Filter) trace.SpanProcessor {
func New(filter Filter) *SpanProcessor {
return &SpanProcessor{
filter: filter,
}
Expand Down

0 comments on commit ef02c78

Please sign in to comment.