-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[confmap] Fix bug where expand didn't honor escaping (#10560)
#### 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
- Loading branch information
1 parent
182c610
commit 637b1f4
Showing
5 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: bug_fix | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) | ||
component: confmap | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Fixes issue where confmap could not escape `$$` when `confmap.unifyEnvVarExpansion` is enabled. | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [10560] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | ||
|
||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
test_map: | ||
# $$ -> escaped $ | ||
recv.1: "$$MAP_VALUE_1" | ||
# $$$ -> escaped $ + $MAP_VALUE_2 | ||
recv.2: "$$$MAP_VALUE_2" | ||
# $$$$ -> two escaped $ | ||
recv.3: "$$$$MAP_VALUE_3" | ||
# $$$ -> escaped $ + substituted env var | ||
recv.4: "$$${MAP_VALUE_2}" | ||
# escaped $ in the middle | ||
recv.5: "some$${MAP_VALUE_4}text" | ||
# two escaped $ | ||
recv.6: "$${ONE}$${TWO}" | ||
# trailing escaped $ | ||
recv.7: "text$$" | ||
# escaped $ alone | ||
recv.8: "$$" | ||
# Escape numbers | ||
recv.9: "$${1}$${env:2}" | ||
# can escape provider | ||
recv.10: "some$${env:MAP_VALUE_4}text" | ||
# can escape outer when nested | ||
recv.11: "$${env:${MAP_VALUE_2}}" | ||
# can escape inner and outer when nested | ||
recv.12: "$${env:$${MAP_VALUE_2}}" | ||
# can escape partial | ||
recv.13: "env:MAP_VALUE_2}$${MAP_VALUE_2}{" | ||
# can escape partial | ||
recv.14: "${env:MAP_VALUE_2$${MAP_VALUE_2}" | ||
# $$$ -> escaped $ + substituted env var | ||
recv.15: "$$${env:MAP_VALUE_2}" |