-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[processor/transform] Add new delete functions #11824
Conversation
/cc @anuraaga |
@@ -33,6 +33,10 @@ Supported functions: | |||
e.g., `set(attributes["http.path"], "/foo")`, `set(name, attributes["http.route"])`, `set(trace_state["svc"], "example")`, `set(attributes["source"], trace_state["source"])`. If `value` resolves to `nil`, e.g. | |||
it references an unset map value, there will be no action. | |||
|
|||
- `delete_key(target, key)` - `target` is a path expression to a map type field. `key` is a string that is a key in the map. The key will be deleted from the map. e.g., `delete_key(attributes, "http.request.header.authorization")` | |||
|
|||
- `delete_matching_keys(target, pattern)` - `target` is a path expression to a map type field. `pattern` is a regex string. All keys that match the pattern will be deleted from the map. e.g., `delete_matching_keys(attributes, ".*\.header\.authorization")` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be delete_all_matches
to be consistent with replace_all_matches
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that but I didn't want anyone to think it deleted the matching sections in the map's value vs replacing it like replace_all_matches
. I wanted it to be clear that its the whole entry being deleted, so I kept it closer to delete_key
@open-telemetry/collector-contrib-approvers please review |
/cc @anuraaga |
I think we added |
@anuraaga actually there is a defect with |
Opened #12193 for the set nil issue |
Description:
Adds 2 new functions that allow deleting keys from maps.
Link to tracking Issue:
Closes #11823
Testing:
Added new unit tests and integration tests
Documentation:
Updated readme