Skip to content

Commit

Permalink
Added test for case insensitive extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
akats7 authored and jpkrohling committed Jul 12, 2023
1 parent 1f6d6ea commit 9d22d9b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions processor/routingprocessor/extract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ func TestExtractorForTraces_FromContext(t *testing.T) {
fromAttr: "X-Tenant",
expectedValue: "acme",
},
{
name: "value from existing HTTP attribute: case insensitive",
ctxFunc: func() context.Context {
return client.NewContext(context.Background(),
client.Info{Metadata: client.NewMetadata(map[string][]string{
"X-Tenant": {"acme"},
})})
},
fromAttr: "x-tenant",
expectedValue: "acme",
},
{
name: "no values from empty context",
ctxFunc: context.Background,
Expand Down
2 changes: 1 addition & 1 deletion processor/routingprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.19
require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.81.0
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector v0.81.0
go.opentelemetry.io/collector/component v0.81.0
go.opentelemetry.io/collector/config/configgrpc v0.81.0
go.opentelemetry.io/collector/confmap v0.81.0
Expand Down Expand Up @@ -47,7 +48,6 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.81.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector v0.81.0 // indirect
go.opentelemetry.io/collector/config/configauth v0.81.0 // indirect
go.opentelemetry.io/collector/config/configcompression v0.81.0 // indirect
go.opentelemetry.io/collector/config/confignet v0.81.0 // indirect
Expand Down

0 comments on commit 9d22d9b

Please sign in to comment.