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

[confmap] Move confmap.unifyEnvVarExpansion to beta #10435

Merged

Conversation

TylerHelmuth
Copy link
Member

Description

Moves confmap.unifyEnvVarExpansion to beta. This means the collector will, by default, use the env var provider to expand ${FOO} synatx and will error if the expandconverter is used to expand $FOO syntax.

Link to tracking issue

Related to #10161
Related to #8215
Related to #7111

@TylerHelmuth TylerHelmuth requested a review from a team as a code owner June 18, 2024 19:34
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.41%. Comparing base (227fb82) to head (36c0746).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10435   +/-   ##
=======================================
  Coverage   92.40%   92.41%           
=======================================
  Files         393      393           
  Lines       18584    18584           
=======================================
+ Hits        17173    17174    +1     
  Misses       1056     1056           
+ Partials      355      354    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TylerHelmuth
Copy link
Member Author

We'll want to make a big deal in this release notes/changelog about this breaking change.

@mx-psi
Copy link
Member

mx-psi commented Jun 21, 2024

Agreed about the changelog. I would alsp like to check our docs and examples to remove any references to the $ENV syntax. It would also help to have a very clear error message with instructions if you run into this issue

@mx-psi
Copy link
Member

mx-psi commented Jun 21, 2024

I searched on several repositories using rg '\$[A-Z]' -tyaml --glob='!.github/':

  • opentelemetry-collector: No relevant hits
  • opentelemetry-collector-contrib: No relevant hits (Two unrelated files on exporter/splunkhecexporter/ )
  • opentelemetry.io: No relevant hits

@TylerHelmuth
Copy link
Member Author

It would also help to have a very clear error message with instructions if you run into this issue

Updated the error message to resemble the warning log, but with details about the feature gate.

@TylerHelmuth
Copy link
Member Author

I confirmed that opentelemetry-helm-charts and opentelemetry-operator have no relevant hits

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

LGTM. This is likely to impact some users, so I would like to have more reviews from other approvers before merging

confmap/converter/expandconverter/expand.go Outdated Show resolved Hide resolved
Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
@mx-psi
Copy link
Member

mx-psi commented Jun 25, 2024

cc @open-telemetry/collector-approvers I would like more approvals here before merging

@mx-psi mx-psi merged commit 9524644 into open-telemetry:main Jun 28, 2024
50 checks passed
@github-actions github-actions bot added this to the next release milestone Jun 28, 2024
@TylerHelmuth TylerHelmuth deleted the confmap-unifyEnvVarExpansion-gate-beta branch July 1, 2024 17:20
@azunna1
Copy link

azunna1 commented Jul 5, 2024

This change is breaking my prometheus receiver config where i have relabelling like

relabel_configs:
                - source_labels: [job]
                  separator: ;
                  regex: (.*)
                  target_label: __tmp_prometheus_job_name
                  replacement: $$1
                  action: replace

How can we now put config variables without otel treating it like an environment variable?

@TylerHelmuth
Copy link
Member Author

@azunna1 I am unable to reproduce your issue, can you open an issue with more details.

codeboten pushed a commit that referenced this pull request Jul 10, 2024
#### Description

When we promoted `confmap.unifyEnvVarExpansion` to beta, we found that
the new expansion logic in `confmap` wasn't handling escaping of `$$`
like it is supposed to. This PR fixes that bug, but adding escaping
logic for `$$`.

@azunna1 this fixes the bug you mentioned in
#10435
around the metricstransformprocessor:

```yaml
  metricstransform:
    transforms:
      - include: '^k8s\.(.*)\.(.*)$$'
        match_type: regexp
        action: update
        new_name: 'kubernetes.$${1}.$${2}'
      - include: '^container_([0-9A-Za-z]+)_([0-9A-Za-z]+)_.*'
        match_type: regexp
        action: update
        new_name: 'container.$${1}.$${2}'
```

#### Testing
Added new unit tests explicitly for escaping logic
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.

None yet

5 participants