From ca8cb9696615d6900a4cde467a5127c1f142567a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 8 Jul 2024 00:43:31 -0700 Subject: [PATCH] Remove baggagetrace (#5853) --- CHANGELOG.md | 4 ++ CODEOWNERS | 2 +- processors/baggage/baggagetrace/doc.go | 7 --- processors/baggage/baggagetrace/go.mod | 25 -------- processors/baggage/baggagetrace/go.sum | 29 --------- processors/baggage/baggagetrace/processor.go | 44 ------------- .../baggage/baggagetrace/processor_test.go | 62 ------------------- versions.yaml | 1 - 8 files changed, 5 insertions(+), 169 deletions(-) delete mode 100644 processors/baggage/baggagetrace/doc.go delete mode 100644 processors/baggage/baggagetrace/go.mod delete mode 100644 processors/baggage/baggagetrace/go.sum delete mode 100644 processors/baggage/baggagetrace/processor.go delete mode 100644 processors/baggage/baggagetrace/processor_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 24f112dd9b3..4c55cda3fcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add the new `go.opentelemetry.io/contrib/instrgen` package to provide auto-generated source code instrumentation. (#3068, #3108) - Support for stdoutlog exporter in `go.opentelemetry.io/contrib/config`. (#5850) +### Removed + +- The deprecated `go.opentelemetry.io/contrib/processors/baggagecopy` package is removed. (#5853) + ## [1.28.0/0.53.0/0.22.0/0.8.0/0.3.0/0.1.0] - 2024-07-02 ### Added diff --git a/CODEOWNERS b/CODEOWNERS index fa4f2ea1f74..077f34e7d6c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -56,7 +56,7 @@ instrumentation/net/http/httptrace/otelhttptrace/ @open-te instrumentation/net/http/otelhttp/ @open-telemetry/go-approvers @dmathieu instrumentation/runtime/ @open-telemetry/go-approvers @MadVikingGod -processors/baggage/baggagetrace @open-telemetry/go-approvers @codeboten @MikeGoldsmith +processors/baggagecopy @open-telemetry/go-approvers @codeboten @MikeGoldsmith processors/minsev @open-telemetry/go-approvers @MrAlias propagators/autoprop/ @open-telemetry/go-approvers @MrAlias diff --git a/processors/baggage/baggagetrace/doc.go b/processors/baggage/baggagetrace/doc.go deleted file mode 100644 index 96b8d8cc41c..00000000000 --- a/processors/baggage/baggagetrace/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package baggagetrace implements a baggage span processor. -// -// Deprecated: Use go.opentelemetry.io/contrib/processors/baggagecopy instead. -package baggagetrace // import "go.opentelemetry.io/contrib/processors/baggage/baggagetrace" diff --git a/processors/baggage/baggagetrace/go.mod b/processors/baggage/baggagetrace/go.mod deleted file mode 100644 index 85d2d9732a6..00000000000 --- a/processors/baggage/baggagetrace/go.mod +++ /dev/null @@ -1,25 +0,0 @@ -// Deprecated: Use go.opentelemetry.io/contrib/processors/baggagecopy instead. -module go.opentelemetry.io/contrib/processors/baggage/baggagetrace - -go 1.21 - -require ( - github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/contrib/processors/baggagecopy v0.1.0 - go.opentelemetry.io/otel v1.28.0 - go.opentelemetry.io/otel/sdk v1.28.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect - golang.org/x/sys v0.22.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -replace go.opentelemetry.io/contrib/processors/baggagecopy => ../../baggagecopy diff --git a/processors/baggage/baggagetrace/go.sum b/processors/baggage/baggagetrace/go.sum deleted file mode 100644 index d68afc55280..00000000000 --- a/processors/baggage/baggagetrace/go.sum +++ /dev/null @@ -1,29 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= -go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/processors/baggage/baggagetrace/processor.go b/processors/baggage/baggagetrace/processor.go deleted file mode 100644 index 8eabac0c725..00000000000 --- a/processors/baggage/baggagetrace/processor.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package baggagetrace // import "go.opentelemetry.io/contrib/processors/baggage/baggagetrace" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - otelbaggage "go.opentelemetry.io/otel/baggage" - "go.opentelemetry.io/otel/sdk/trace" - - "go.opentelemetry.io/contrib/processors/baggagecopy" -) - -// SpanProcessor is a processing pipeline for spans in the trace signal. -type SpanProcessor struct{} - -var _ trace.SpanProcessor = (*SpanProcessor)(nil) - -// 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. -func New() trace.SpanProcessor { - return baggagecopy.NewSpanProcessor(baggagecopy.AllowAllMembers) -} - -// OnStart is called when a span is started and adds span attributes for baggage contents. -func (processor SpanProcessor) OnStart(ctx context.Context, span trace.ReadWriteSpan) { - for _, entry := range otelbaggage.FromContext(ctx).Members() { - span.SetAttributes(attribute.String(entry.Key(), entry.Value())) - } -} - -// OnEnd is called when span is finished and is a no-op for this processor. -func (processor SpanProcessor) OnEnd(s trace.ReadOnlySpan) {} - -// Shutdown is called when the SDK shuts down and is a no-op for this processor. -func (processor SpanProcessor) Shutdown(context.Context) error { return nil } - -// ForceFlush exports all ended spans to the configured Exporter that have not yet -// been exported and is a no-op for this processor. -func (processor SpanProcessor) ForceFlush(context.Context) error { return nil } diff --git a/processors/baggage/baggagetrace/processor_test.go b/processors/baggage/baggagetrace/processor_test.go deleted file mode 100644 index 3b50bcf3eac..00000000000 --- a/processors/baggage/baggagetrace/processor_test.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package baggagetrace - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - otelbaggage "go.opentelemetry.io/otel/baggage" - "go.opentelemetry.io/otel/sdk/trace" -) - -var _ trace.SpanExporter = &testExporter{} - -type testExporter struct { - spans []trace.ReadOnlySpan -} - -func (e *testExporter) Start(ctx context.Context) error { return nil } -func (e *testExporter) Shutdown(ctx context.Context) error { return nil } - -func (e *testExporter) ExportSpans(ctx context.Context, ss []trace.ReadOnlySpan) error { - e.spans = append(e.spans, ss...) - return nil -} - -func NewTestExporter() *testExporter { - return &testExporter{} -} - -func TestSpanProcessorAppendsBaggageAttributes(t *testing.T) { - suitcase, err := otelbaggage.New() - require.NoError(t, err) - packingCube, err := otelbaggage.NewMemberRaw("baggage.test", "baggage value") - require.NoError(t, err) - suitcase, err = suitcase.SetMember(packingCube) - require.NoError(t, err) - ctx := otelbaggage.ContextWithBaggage(context.Background(), suitcase) - - // create trace provider with baggage processor and test exporter - exporter := NewTestExporter() - tp := trace.NewTracerProvider( - trace.WithSpanProcessor(New()), - trace.WithSpanProcessor(trace.NewSimpleSpanProcessor(exporter)), - ) - - // create tracer and start/end span - tracer := tp.Tracer("test") - _, span := tracer.Start(ctx, "test") - span.End() - - assert.Len(t, exporter.spans, 1) - assert.Len(t, exporter.spans[0].Attributes(), 1) - - want := []attribute.KeyValue{attribute.String("baggage.test", "baggage value")} - assert.Equal(t, want, exporter.spans[0].Attributes()) -} diff --git a/versions.yaml b/versions.yaml index 60a49cd2760..bc852e73a15 100644 --- a/versions.yaml +++ b/versions.yaml @@ -81,7 +81,6 @@ module-sets: experimental-processors: version: v0.1.0 modules: - - go.opentelemetry.io/contrib/processors/baggage/baggagetrace - go.opentelemetry.io/contrib/processors/baggagecopy - go.opentelemetry.io/contrib/processors/minsev experimental-detectors: