-
Notifications
You must be signed in to change notification settings - Fork 1.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
Supporting Key and a List of Values in the Attribute Processor #1935
Comments
PR - #1936 Above PR adds support for list of values under a key in the attribute processor Eg screens: |
@tigrannajaryan could you please check/review this |
@tigrannajaryan gentle reminder |
Sounds good to me. Doesn't have to be homogeneous, we can support heterogeneous arrays too. |
Thank you @tigrannajaryan yes we can support heterogeneous arrays. I was under the impression that a single key can carry homogeneous values (like http.url with only string values). if everything is fine, could you please review/approve? few of our cases are have been long ceased for this change |
@isgoutham I misunderstood your proposal initially. You are suggesting that when a list of values is specified in the configuration of the So, for example let's say we have the following config: attributes/priority_sampling:
include:
match_type: strict
attributes:
- key: http.url
value:
- 'http://productcatalogservice/GetProducts'
- 'http://recommendationservice/GetRecommendations'
- 'http://cartservice/GetCart' This would match a span with attribute This is an unexpected and surprising behavior. What you are looking for can be achieved today by using multiple attributes processors: attributes/priority_sampling1:
include:
match_type: strict
attributes:
- key: http.url
value: 'http://productcatalogservice/GetProducts'
actions:
...
attributes/priority_sampling2:
include:
match_type: strict
attributes:
- key: http.url
value: 'http://productcatalogservice/GetProducts'
actions:
...
attributes/priority_sampling3:
include:
match_type: strict
attributes:
- key: http.url
value: 'http://cartservice/GetCart'
actions:
... Unfortunately this is quite verbose so perhaps a different way is necessary to do what you need. However, I do not think we should do what you suggest because it is both unexpected behavior and also closes the door for proper support for attribute values. As an alternate approach I would look into supporting Another possibility would be to support yet another |
One more alternate that works today is to use regexp with alternates:
|
looks like regexp support for attribute processor is added in v0.13.0. Thanks for your pointer @tigrannajaryan |
@tigrannajaryan thanks a ton for very neat and elaborative explaination.
|
Which approach would you suggest for these complex span attributes ? under |
I am not sure I understand the question. Which complex attributes? |
Multiple values under a key. Asking about this
|
Documentation for processors states: > Only match_type=strict is allowed if "attributes" are specified. but this restriction was removed in https://github.com/open-telemetry/opentelemetry-collector/pull/928/files#diff-4548db28578c2ac90e2b277f24654cfa24fd0f99d854e0fcc4b50871c0b529caL166-R198, and so this doc appears to be outdated. **Testing:** I did not test this, but others (including @tigrannajaryan) have: #1935 (comment) [btw, in case you're curious my interest in this, we are implementing a subset of this behavior at the java agent layer, as we aren't using otel collector. So far only in our vendor distro, though happy to move it to otel javaagent if/when others are interested.]
Support for key and list based values in the attribute processor.
Use case: To support list of homogeneous values under a single key.
Example Configuration(otel-collector-config):
All the values under http.url should have a sampling.priority value as 1. Instead, current implementation of OTEL is not supporting this feature and triggers a bug.
Steps to produce:
Config file: -
otel-collector-config.yaml
PR will be added for supporting and resolving the same. This will enable list of values (homogeneous) under a key for attribute processors.
The text was updated successfully, but these errors were encountered: