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

Issue using environment variable for pipelines #10799

Closed
kago-dk opened this issue Aug 4, 2024 · 5 comments · Fixed by #10809
Closed

Issue using environment variable for pipelines #10799

kago-dk opened this issue Aug 4, 2024 · 5 comments · Fixed by #10809
Labels
area:confmap bug Something isn't working release:blocker The issue must be resolved before cutting the next release

Comments

@kago-dk
Copy link

kago-dk commented Aug 4, 2024

Describe the bug
Environment variables used for pipelines are not processed correctly in 0.106.1, while they worked in 0.105.0. I have tried to put the value in double quotes and disable the confmap.strictlyTypedInput feature gate without success.

I a receiving an error instead.

When using confmap.strictlyTypedInput
failed to get config: cannot resolve the configuration: expanding ${env:OTEL_LOGS_RECEIVER}: retrieved value does not have unambiguous string representation: [filelog windowseventlog/application]

When using -confmap.strictlyTypedInput
failed to get config: cannot resolve the configuration: expanding ${env:OTEL_LOGS_RECEIVER}: expected convertable to string value type, got ["filelog" "windowseventlog/application"]([]interface {})

What version did you use?
0.106.1

What config did you use?

    logs:
      receivers: ${env:OTEL_LOGS_RECEIVER}
      processors: [memory_limiter,resourcedetection/system,resource/environment,transform,filter,batch]
      exporters: ${env:OTEL_LOGS_EXPORTER}

With [filelog,windowseventlog/application] as the environment value for OTEL_LOGS_RECEIVER as an example.

Environment
Windows 2022 Server

@kago-dk kago-dk added the bug Something isn't working label Aug 4, 2024
@kago-dk
Copy link
Author

kago-dk commented Aug 4, 2024

Tagging @mx-psi @TylerHelmuth per Slack request.

@mx-psi
Copy link
Member

mx-psi commented Aug 5, 2024

@kago-dk Could you share the exact value of your OTEL_LOGS_RECEIVER and OTEL_LOGS_EXPORTER environment variables? I would also be interested in your full configuration (censoring any sensitive details), or at least any other places where you use OTEL_LOGS_RECEIVER and OTEL_LOGS_EXPORTER.

@mx-psi
Copy link
Member

mx-psi commented Aug 5, 2024

Failed attempt at reproducing this (edited for clarity):

❯ cd $(mktemp -d)

❯ curl -L -o contrib-0.106.1.tar.gz <URL for contrib>
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 28.6M  100 28.6M    0     0  11.5M      0  0:00:02  0:00:02 --:--:-- 24.0M

❯ tar pfx contrib-0.106.1.tar.gz 

❯ cat config.yaml
receivers:
  otlp/1:
    protocols:
      grpc:
  hostmetrics:
    scrapers:
      load:

exporters:
  debug:

service:
  pipelines:
    logs:
      receivers: ${env:OTEL_LOGS_RECEIVER}
      exporters: [debug]

❯ OTEL_LOGS_RECEIVER=[otlp/1,hostmetrics] ./otelcol --config config.yaml 

<runs as usual>

@mx-psi mx-psi added release:blocker The issue must be resolved before cutting the next release area:confmap labels Aug 5, 2024
@kago-dk
Copy link
Author

kago-dk commented Aug 5, 2024

The content respectively is [filelog,windowseventlog/application] and [splunk_hec,otlphttp/loki/abcd] for OTEL_LOGS_RECEIVER and OTEL_LOGS_EXPORTER. The values are set at Windows Environment Variables and not used elsewhere in the Otel Configuration.

I load the pipeline section into otel-config.yaml.

service:
  pipelines: ${file:${env:ProgramFiles}/otelcol/pipelines/pipelines.yaml}

If I paste the content from pipelines.yaml into otel-config.yaml (instead of using ${file:${env:ProgramFiles}/otelcol/pipelines/pipelines.yaml}) then the Collector is able to start up.

It sounds like the issue is resolved in 0.107.0 as part of a different ticket?

@mx-psi
Copy link
Member

mx-psi commented Aug 5, 2024

Yes, I think this is a duplicate of #10787. I am going to add a test case for this to verify it

mx-psi added a commit that referenced this issue Aug 7, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

<!-- Issue number if applicable -->

Shows that #10795 (as well as #10800) fixed this issue.

#### Link to tracking issue

Fixes #10799
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:confmap bug Something isn't working release:blocker The issue must be resolved before cutting the next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants