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

[processor/transform] Add support for flat configuration style #37444

Merged

Conversation

edmocosta
Copy link
Contributor

Description

This PR is part of #29017, and a split from #36888. It changes the transformprocessor, adding support for flat configuration styles.

Change log:

  • It now supports an additional configuration style, where statements are expressed as a list of strings, being the path's context required, and the context inferred from them thanks to the context inferrer & ottl.ParserCollection. For example:
    log_statements:
     - set(log.body, "bear") where log.attributes["http.path"] == "/animal"
     - set(resource.attributes["name"], "bear")
  • It does support mixed configuration styles.
  • The context's cache values are only shared among flat statements
  • Structured configuration cache values are still isolated, which means that a cache written using a structured configuration style will only be available for that configuration group's statements, and won't be shared with flat statements and/or other structured configuration groups, for example:
    log_statements:
    - set(resource.cache["flat"], "value")
    
    -  statements:
       - set(resource.cache["name"], "bear")
       - set(resource.attributes["name"], resource.cache["name"]) # OK
       - set(resource.attributes["name"], resource.cache["flat"]) # Fail(not set by this group of statements)
    
    - set(resource.attributes["name"], resource.cache["name"]) # Fail(not set by a flat statement)
    - set(resource.attributes["flat"], resource.cache["flat"]) # OK
    
    -  statements:
       - set(resource.attributes["name"], resource.cache["name"]) # Fail(set by another group)

Link to tracking issue

#29017

Testing

Unit tests

processor/transformprocessor/config.go Outdated Show resolved Hide resolved
processor/transformprocessor/config.go Show resolved Hide resolved
processor/transformprocessor/config.go Outdated Show resolved Hide resolved
processor/transformprocessor/internal/common/cache.go Outdated Show resolved Hide resolved
processor/transformprocessor/internal/common/config.go Outdated Show resolved Hide resolved
@TylerHelmuth
Copy link
Member

@evan-bradley please review

Copy link
Contributor

@evan-bradley evan-bradley left a comment

Choose a reason for hiding this comment

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

Sorry for the long delay. The way we're handling the config makes sense to me.

edmocosta and others added 2 commits February 3, 2025 22:42
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
@evan-bradley evan-bradley merged commit 56866f4 into open-telemetry:main Feb 3, 2025
163 checks passed
@github-actions github-actions bot added this to the next release milestone Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processor/transform Transform processor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants