-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix(headers): also populate headers from specified environment variables #99
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the comment, would you be open to updating the tests as well? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking this as is and will add tests separately.
Will add tests separately
Sorry about that ... was slammed at work throughout January! |
## Which problem is this PR solving? When setting configuration values by code and environment variables, environment variables should win. This is a design choice so that operators of the library can change behaviour without requiring rebuilding an application. This PR updates the sequence of applying configuration options so that env vars are applied last and will replace any code specificied options. Tests are updated to reflect this, and includes adding additional tests to verify expected behaviour of setting generic, trace and metrics headers via env var which was added in the following P; - Follow up to #99 ## Short description of the changes - Updates all string config options to use the `overwrite` go-envconfig option so env var values replace code-set options - Remove unused ResourceAttributesFromEnv config option - Move applying env var options to the config struct after applying code options - Update tests to reflect env vars have priority over code-provided options, includes fixing a couple of tests where env vars were being used by error ## How to verify that this has the expected result Unit tests exercise expected behaviour and help prevent future regressions. --------- Co-authored-by: Steve Moyer <[email protected]> Co-authored-by: Robb Kidd <[email protected]>
Headers can't be set via the environment variables specified in the OTEL SDK configuration documentation. Since headers are often used to affect authentication, using the provided options isn't always desirable or safe.
Which problem is this PR solving?
Short description of the changes
This PR adds the required field tags to the
Config
struct and documents the existing options as well as the affected environment variables.How to verify that this has the expected result
Set headers via environment variables and verify that the headers are received by an OTEL collector.