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

V0.62.0+ breaks environment variables in config file #6580

Closed
HaroonSaid opened this issue Nov 19, 2022 · 3 comments · Fixed by #6593
Closed

V0.62.0+ breaks environment variables in config file #6580

HaroonSaid opened this issue Nov 19, 2022 · 3 comments · Fixed by #6593
Labels
bug Something isn't working

Comments

@HaroonSaid
Copy link

Describe the bug
We have the following in the yaml config file

exporters:
  logging:
    loglevel: debug
  prometheus:
    endpoint: :8889
  jaeger:
    endpoint: ${JAEGER_ENDPOINT}:${JAEGER_PORT}
    tls:
      insecure: true

  prometheusremotewrite:
    endpoint: ${PROMETHEUSREMOTEWRITE}

and pass in the values thru environment variables

Steps to reproduce
Starting with 0.62.0 that no longer works

Error: failed to get config: cannot resolve the configuration: invalid uri: "JAEGER_ENDPOINT}:${JAEGER_PORT"
2022/11/19 19:12:22 collector server run finished with error: failed to get config: cannot resolve the configuration: invalid uri: "JAEGER_ENDPOINT}:${JAEGER_PORT"

What did you expect to see?
Should continue work.

What did you see instead?

What version did you use?
Version: 0.62+

What config did you use?
Config: (e.g. the yaml config file)

Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

Additional context
Add any other context about the problem here.

@HaroonSaid HaroonSaid added the bug Something isn't working label Nov 19, 2022
@HaroonSaid HaroonSaid changed the title V0.62 Break environment variables in config file V0.62.0+ breaks environment variables in config file Nov 19, 2022
@mx-psi
Copy link
Member

mx-psi commented Nov 21, 2022

Funny, this is something we explicitly discussed as a failure mode here #4742 (comment) cc @bogdandrutu you probably know better where this is failing

@bogdandrutu
Copy link
Member

The fix is simple, since the feature is protected by the featuregate: https://github.com/open-telemetry/opentelemetry-collector/blob/main/confmap/resolver.go#L46, just disable that by passing a flag to the command:

./otelcol --feature-gates=-confmap.expandEnabled

Will look into the reason to this fails.

@bogdandrutu
Copy link
Member

@HaroonSaid an even better fix for you is to actually change your config and use:

endpoint: "${env:JAEGER_ENDPOINT}"

Since anyway "endpoint" is consider to include the port as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants