Skip to content

Include MultiValueHeaders in DefaultTraceExtractor #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion internal/trace/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import (

type (
eventWithHeaders struct {
Headers map[string]string `json:"headers"`
Headers map[string]string `json:"headers"`
MultiValueHeaders map[string][]string `json:"multiValueHeaders"`
}

// TraceContext is map of headers containing a Datadog trace context.
Expand Down Expand Up @@ -184,6 +185,11 @@ func getHeadersFromEventHeaders(ctx context.Context, ev json.RawMessage) map[str
for k, v := range eh.Headers {
lowercaseHeaders[strings.ToLower(k)] = v
}
for k, v := range eh.MultiValueHeaders {
if len(v) > 0 {
lowercaseHeaders[strings.ToLower(k)] = v[0]
}
}

return lowercaseHeaders
}
Expand Down