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

Add support for scheme in OTEL_EXPORTER_OTLP_ENDPOINT #1886

Merged
merged 5 commits into from May 12, 2021
Merged

Add support for scheme in OTEL_EXPORTER_OTLP_ENDPOINT #1886

merged 5 commits into from May 12, 2021

Conversation

mhofstetter
Copy link
Contributor

This updates the environment variable configuration to accept the OTLP Exporter Endpoint environment variables according to the spec. This includes the following changes:

  • Support for OTLP endpoint with scheme according to spec
  • Interpretation of the OTLP endpoint scheme to detect insecure endpoint (http-> insecure, https -> secure)

Resolves #1885

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 7, 2021

CLA Signed

The committers are authorized under a signed CLA.

@codecov
Copy link

codecov bot commented May 7, 2021

Codecov Report

Merging #1886 (12fcadd) into main (5cb6263) will increase coverage by 0.0%.
The diff coverage is 88.8%.

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #1886   +/-   ##
=====================================
  Coverage   79.4%   79.4%           
=====================================
  Files        139     139           
  Lines       7425    7449   +24     
=====================================
+ Hits        5896    5918   +22     
+ Misses      1285    1283    -2     
- Partials     244     248    +4     
Impacted Files Coverage Δ
exporters/otlp/internal/otlpconfig/envconfig.go 90.5% <82.3%> (-2.1%) ⬇️
exporters/otlp/internal/otlpconfig/options.go 94.2% <100.0%> (+3.1%) ⬆️
sdk/metric/refcount_mapped.go 77.7% <0.0%> (-22.3%) ⬇️
sdk/metric/sdk.go 80.2% <0.0%> (-1.2%) ⬇️
exporters/trace/jaeger/jaeger.go 94.5% <0.0%> (+1.0%) ⬆️

Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect bugs in this PR.

@@ -71,13 +71,13 @@ func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption {

// Endpoint
if v, ok := e.getEnvValue("ENDPOINT"); ok {
opts = append(opts, WithEndpoint(v))
opts = append(opts, endpointOptions(v, WithEndpoint, withInsecure)...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be simplified, and clarified by doing something like:

opts = append(opts, 
    WithEndpoint(trimSchema(v)),
    withInsecure(strings.HasPrefix(v, "http://")),
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it towards this direction, but with an explicit WithSecure function which makes it a little bit more verbose

CHANGELOG.md Outdated Show resolved Hide resolved
@Aneurysm9 Aneurysm9 merged commit 21c1641 into open-telemetry:main May 12, 2021
@mhofstetter mhofstetter deleted the feature/env-spec branch May 13, 2021 08:33
@Aneurysm9 Aneurysm9 mentioned this pull request Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for OTEL_EXPORTER_OTLP_ENDPOINT according to the spec
5 participants