From 9e2789a6dacb86823dfd6e2136ef0855f79e8a08 Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Mon, 19 Oct 2020 11:36:34 -0700 Subject: [PATCH 1/3] Renaming otcorrelations header to baggage --- CHANGELOG.md | 1 + propagators/baggage.go | 2 +- propagators/baggage_test.go | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47be305c498..87f93bc3cd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The function signature of the Span `AddEvent` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required name and a variable number of `EventOption`s. (#1254) - The function signature of the Span `RecordError` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required error value and a variable number of `EventOption`s. (#1254) - Move the `go.opentelemetry.io/otel/api/global` package to `go.opentelemetry.io/otel/global`. (#1262) +- Rename correlation context header from `"otcorrelations"` to `"baggage"` to match the OpenTelemetry specification. (#) ### Removed diff --git a/propagators/baggage.go b/propagators/baggage.go index 6ff01286db2..28f7b97f6e2 100644 --- a/propagators/baggage.go +++ b/propagators/baggage.go @@ -26,7 +26,7 @@ import ( // Temporary header name until W3C finalizes format. // https://github.com/open-telemetry/opentelemetry-specification/blob/18b2752ebe6c7f0cdd8c7b2bcbdceb0ae3f5ad95/specification/correlationcontext/api.md#header-name -const baggageHeader = "otcorrelations" +const baggageHeader = "baggage" // Baggage is a propagator that supports the W3C Baggage format. // diff --git a/propagators/baggage_test.go b/propagators/baggage_test.go index 4473e552844..267b47e30f1 100644 --- a/propagators/baggage_test.go +++ b/propagators/baggage_test.go @@ -88,7 +88,7 @@ func TestExtractValidBaggageFromHTTPReq(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { req, _ := http.NewRequest("GET", "http://example.com", nil) - req.Header.Set("otcorrelations", tt.header) + req.Header.Set("baggage", tt.header) ctx := context.Background() ctx = prop.Extract(ctx, req.Header) @@ -149,7 +149,7 @@ func TestExtractInvalidDistributedContextFromHTTPReq(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { req, _ := http.NewRequest("GET", "http://example.com", nil) - req.Header.Set("otcorrelations", tt.header) + req.Header.Set("baggage", tt.header) ctx := baggage.NewContext(context.Background(), tt.hasKVs...) wantBaggage := baggage.MapFromContext(ctx) @@ -231,17 +231,17 @@ func TestInjectBaggageToHTTPReq(t *testing.T) { ctx := baggage.ContextWithMap(context.Background(), baggage.NewMap(baggage.MapUpdate{MultiKV: tt.kvs})) propagator.Inject(ctx, req.Header) - gotHeader := req.Header.Get("otcorrelations") + gotHeader := req.Header.Get("baggage") wantedLen := len(strings.Join(tt.wantInHeader, ",")) if wantedLen != len(gotHeader) { t.Errorf( - "%s: Inject otcorrelations incorrect length %d != %d.", tt.name, tt.wantedLen, len(gotHeader), + "%s: Inject baggage incorrect length %d != %d.", tt.name, tt.wantedLen, len(gotHeader), ) } for _, inHeader := range tt.wantInHeader { if !strings.Contains(gotHeader, inHeader) { t.Errorf( - "%s: Inject otcorrelations missing part of header: %s in %s", tt.name, inHeader, gotHeader, + "%s: Inject baggage missing part of header: %s in %s", tt.name, inHeader, gotHeader, ) } } @@ -251,7 +251,7 @@ func TestInjectBaggageToHTTPReq(t *testing.T) { func TestBaggagePropagatorGetAllKeys(t *testing.T) { var propagator propagators.Baggage - want := []string{"otcorrelations"} + want := []string{"baggage"} got := propagator.Fields() if diff := cmp.Diff(got, want); diff != "" { t.Errorf("GetAllKeys: -got +want %s", diff) From 0fb6124d8ca8fc0f9c1f3670ccd284ccc46f494b Mon Sep 17 00:00:00 2001 From: alrex Date: Mon, 19 Oct 2020 11:37:45 -0700 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87f93bc3cd8..e8c1b4480a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The function signature of the Span `AddEvent` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required name and a variable number of `EventOption`s. (#1254) - The function signature of the Span `RecordError` method in `go.opentelemetry.io/otel` is updated to no longer take an unused context and instead take a required error value and a variable number of `EventOption`s. (#1254) - Move the `go.opentelemetry.io/otel/api/global` package to `go.opentelemetry.io/otel/global`. (#1262) -- Rename correlation context header from `"otcorrelations"` to `"baggage"` to match the OpenTelemetry specification. (#) +- Rename correlation context header from `"otcorrelations"` to `"baggage"` to match the OpenTelemetry specification. (#1267) ### Removed From 6bc93b62fc334fb109e2b19f06ed12891b32a844 Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Mon, 19 Oct 2020 11:45:52 -0700 Subject: [PATCH 3/3] cleanup comment --- propagators/baggage.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/propagators/baggage.go b/propagators/baggage.go index 28f7b97f6e2..17ffadfd470 100644 --- a/propagators/baggage.go +++ b/propagators/baggage.go @@ -24,8 +24,6 @@ import ( "go.opentelemetry.io/otel/label" ) -// Temporary header name until W3C finalizes format. -// https://github.com/open-telemetry/opentelemetry-specification/blob/18b2752ebe6c7f0cdd8c7b2bcbdceb0ae3f5ad95/specification/correlationcontext/api.md#header-name const baggageHeader = "baggage" // Baggage is a propagator that supports the W3C Baggage format.