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 global condition's fully qualified paths and error mode overrides #37676

Conversation

edmocosta
Copy link
Contributor

Description

This PR is part of #29017, and a split from #36888. It changes the transformprocessor, adding support for error mode overrides per context statements group, and global conditions with fully qualified paths for context-inferred configuration styles.

Change log:

  • Structured context-inferred configuration styles (without context: <value>) now supports and requires conditions with fully qualified paths, for example:

    log_statements:
      - statements:
          - set(log.attributes["pass"], "true")
        conditions:
          - log.attributes["pass"] == nil
    

    If non qualified paths are used, it raises an error, for example - attributes["pass"] == nil would generate the following error:

    invalid config for "transform" processor unable to parse OTTL condition "attributes[\"pass\"] == nil": missing context name for path "attributes[pass]", possibly valid options are: "log.attributes[pass]", "instrumentation_scope.attributes[pass]", "resource.attributes[pass]"
    

    Existing non-context inferred configurations shouldn't be impacted by this change.

  • A new configuration error_mode key has been added to the context statements group (common.ContextStatements),
    When provided, it overrides the top-level error mode, offering more granular control over error handling, for example:

     error_mode: propagate
     log_statements:
       - context: log
         error_mode: ignore
         statements: 
           - set(attributes["attr1"], ParseJSON(1))
       - context: log
         statements:
           - set(attributes["executed"], true)

Link to tracking issue

#29017

Testing

Unit tests

Documentation

Changed the README to include the new configuration key error_mode

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.

Nice! My comments are only nits.

processor/transformprocessor/README.md Outdated Show resolved Hide resolved
processor/transformprocessor/README.md Outdated Show resolved Hide resolved
processor/transformprocessor/testdata/config.yaml Outdated Show resolved Hide resolved
edmocosta and others added 2 commits February 6, 2025 15:22
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
@TylerHelmuth TylerHelmuth merged commit 9280ca1 into open-telemetry:main Feb 6, 2025
163 checks passed
@github-actions github-actions bot added this to the next release milestone Feb 6, 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.

3 participants