Skip to content

Commit

Permalink
feat(ddtrace/tracer): add Datadog-External-Env default HTTP header
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed Jan 28, 2025
1 parent d64e06c commit d0985c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ddtrace/tracer/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func newHTTPTransport(url string, client *http.Client) *httpTransport {
if eid := internal.EntityID(); eid != "" {
defaultHeaders["Datadog-Entity-ID"] = eid
}
if extEnv := internal.ExternalEnvironment(); extEnv != "" {
defaultHeaders["Datadog-External-Env"] = extEnv
}
return &httpTransport{
traceURL: fmt.Sprintf("%s/v0.4/traces", url),
statsURL: fmt.Sprintf("%s/v0.6/stats", url),
Expand Down
4 changes: 4 additions & 0 deletions internal/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,7 @@ func BoolVal(val string, def bool) bool {
}
return v
}

func ExternalEnvironment() string {
return os.Getenv("DD_EXTERNAL_ENV")
}

0 comments on commit d0985c4

Please sign in to comment.