Skip to content
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

Declare the priority of options and environments on exporters #5379

Closed
6 tasks done
XSAM opened this issue May 18, 2024 · 0 comments
Closed
6 tasks done

Declare the priority of options and environments on exporters #5379

XSAM opened this issue May 18, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@XSAM
Copy link
Member

XSAM commented May 18, 2024

Problem Statement

Comments on options of exporters didn't specify the situation where both option and env are set. For instance,

// WithEndpointURL sets the target endpoint URL (scheme, host, port, path) the
// Exporter will connect to.
//
// 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 are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
// will take precedence.
//
// If both this option and WithEndpoint are used, the last used option will
// take precedence.
//
// If an invalid URL is provided, the default value will be kept.
//
// By default, if an environment variable is not set, and this option is not
// passed, "localhost:4318" will be used.
//
// This option has no effect if WithGRPCConn is used.
func WithEndpointURL(u string) Option {
return wrappedOption{otlpconfig.WithEndpointURL(u)}
}

If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT will take precedence.

This actually says when we apply both OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_TRACES_ENDPOINT at the same time, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT will take precedence.

But this description is confusing, as it is after the sentence "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.". Users might figure the env would take precedence when both the option and the env for the same feature are set.

Proposed Solution

  • Correct the statement mentioned above to prevent confusion.
  • Based on the current implementation, we should state that if users apply both options and envs for the same feature, options will take precedence.
  • Complement tests for this situation to secure exporters' behavior if there is none.

Packages to check

@XSAM XSAM added the enhancement New feature or request label May 18, 2024
@XSAM XSAM self-assigned this May 18, 2024
@XSAM XSAM changed the title Declare the priority of options and environments Declare the priority of options and environments on exporters May 18, 2024
MrAlias added a commit that referenced this issue Jun 18, 2024
…tlptracegrpc (#5508)

part of #5379

---------

Co-authored-by: David Ashpole <[email protected]>
Co-authored-by: Chester Cheung <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
OrHayat pushed a commit to OrHayat/opentelemetry-go that referenced this issue Jun 23, 2024
…tlptracegrpc (open-telemetry#5508)

part of open-telemetry#5379

---------

Co-authored-by: David Ashpole <[email protected]>
Co-authored-by: Chester Cheung <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
OrHayat pushed a commit to OrHayat/opentelemetry-go that referenced this issue Jun 23, 2024
…tlptracegrpc (open-telemetry#5508)

part of open-telemetry#5379

---------

Co-authored-by: David Ashpole <[email protected]>
Co-authored-by: Chester Cheung <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
XSAM added a commit that referenced this issue Jul 9, 2024
XSAM added a commit that referenced this issue Jul 25, 2024
XSAM added a commit that referenced this issue Aug 1, 2024
@XSAM XSAM closed this as completed Aug 1, 2024
@XSAM XSAM added this to the untracked milestone Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant