diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e49adb9ef9..47d72eab223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Document instrument name requirements in `go.opentelemetry.io/otel/metric`. (#5435) - Prevent random number generation data-race for experimental rand exemplars in `go.opentelemetry.io/otel/sdk/metric`. (#5456) - Fix counting number of dropped attributes of `Record` in `go.opentelemetry.io/otel/sdk/log`. (#5464) -- Correct comments for the priority of options and environments in `WithEndpoint` and `WithEndpointURL` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#5508) +- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their coresponding environment variables in in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#5508) ## [1.27.0/0.49.0/0.3.0] 2024-05-21 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_unit_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_unit_test.go index 89eeb864129..89f2351cda8 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_unit_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_unit_test.go @@ -260,6 +260,18 @@ func TestWithEndpointWithEnv(t *testing.T) { }, want: "foo", }, + { + name: "both options and envs", + envs: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "foo2", + "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "bar2", + }, + options: []Option{ + WithEndpoint("foo"), + WithEndpointURL("http://bar:8080/path"), + }, + want: "bar:8080", + }, } for _, tc := range testCases { diff --git a/exporters/otlp/otlptrace/otlptracegrpc/options.go b/exporters/otlp/otlptrace/otlptracegrpc/options.go index 740143f26d3..00ab1f20c6d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -60,7 +60,7 @@ func WithInsecure() Option { // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT // environment variable is set, and this option is not passed, that variable // value will be used. If both environment variables are set, -// OTEL_EXPORTER_OTLP_TRACES_ENDPOINT will take precedence. If the environment +// OTEL_EXPORTER_OTLP_TRACES_ENDPOINT will take precedence. If an environment // variable is set, and this option is passed, this option will take precedence. // // If both this option and WithEndpointURL are used, the last used option will @@ -81,7 +81,7 @@ func WithEndpoint(endpoint string) Option { // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_TRACES_ENDPOINT // environment variable is set, and this option is not passed, that variable // value will be used. If both environment variables are set, -// OTEL_EXPORTER_OTLP_TRACES_ENDPOINT will take precedence. If the environment +// OTEL_EXPORTER_OTLP_TRACES_ENDPOINT will take precedence. If an environment // variable is set, and this option is passed, this option will take precedence. // // If both this option and WithEndpoint are used, the last used option will