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

[Feature]attributesprocessor supports keeping only the matching fields #36620

Closed
tttoad opened this issue Dec 2, 2024 · 8 comments
Closed

[Feature]attributesprocessor supports keeping only the matching fields #36620

tttoad opened this issue Dec 2, 2024 · 8 comments
Labels
enhancement New feature or request processor/attributes Attributes processor

Comments

@tttoad
Copy link

tttoad commented Dec 2, 2024

Component(s)

processor/attributes

Is your feature request related to a problem? Please describe.

I want to keep only some of the fields in the attribute, such as those starting with ‘abc’ or ‘def’.

Describe the solution you'd like

attributesprocessor supports reserved actions, reserved fields by regular matching.

Describe alternatives you've considered

No response

Additional context

No response

@tttoad tttoad added enhancement New feature or request needs triage New item requiring triage labels Dec 2, 2024
@github-actions github-actions bot added the processor/attributes Attributes processor label Dec 2, 2024
Copy link
Contributor

github-actions bot commented Dec 2, 2024

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@VihasMakwana
Copy link
Contributor

@tttoad have you considered pattern? If possible, can you share your config and use case?

@VihasMakwana VihasMakwana removed the needs triage New item requiring triage label Dec 2, 2024
@tttoad
Copy link
Author

tttoad commented Dec 3, 2024

@tttoad have you considered pattern? If possible, can you share your config and use case?

You mean RegexPattern ? regexp does not support syntax like ^(?<!abc).
attributes{ "db":"" ,"any":"" .... ,"abc":"*"} , I just want to keep abc.

@VihasMakwana
Copy link
Contributor

VihasMakwana commented Dec 3, 2024

@tttoad wouldn't something like following work, using include feature?

attributes:
   include:
     match_type: strict
     attributes:
       - key: abc

@tttoad
Copy link
Author

tttoad commented Dec 3, 2024

@tttoad wouldn't something like following work, using include feature?

attributes:
   include:
     match_type: strict
     attributes:
       - key: abc

@VihasMakwana Error: attributes: missing required field "actions".
If I understand correctly, include just selects the Span to be processed.

@VihasMakwana
Copy link
Contributor

Oh! I misunderstood the configs.

Anyway, can you take a look at https://github.com/codeboten/opentelemetry-collector-contrib/tree/main/processor/transformprocessor? It has keep_keys.

@VihasMakwana
Copy link
Contributor

@tttoad does that help resolve the issue you were having?

@tttoad
Copy link
Author

tttoad commented Dec 4, 2024

@tttoad does that help resolve the issue you were having?

Yes, it can work. Thank you.

@tttoad tttoad closed this as completed Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request processor/attributes Attributes processor
Projects
None yet
Development

No branches or pull requests

2 participants