Skip to content

[ottl] New function Fail to abort a list of statements conditionally #40897

Open
@ChristianCiach

Description

@ChristianCiach

Component(s)

pkg/ottl

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

I am new to Otelcol, so maybe I am doing something wrong. But I quite often encounter a situation where it doesn't make sense to continue the rest of the ottl statements and I would rather propagate an error.

Describe the solution you'd like

I am thinking about something like that:

      transform/logs-parse-json:
        log_statements:
          - error_mode: propagate
            statements:
              - merge_maps(log.cache, ParseJSON(log.body), "upsert")
              - set(log.severity_text, log.cache["level"])
              - fail("Missing log level") where log.severity_text == ""

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions