Skip to content

[processor/transform] not enough preconditions to guard against warnings #23847

Closed
@ajsaclayan

Description

Component(s)

processor/transform

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

I have a transform processor configured to truncate log attributes and the body field:

  transform/newrelic:
    log_statements:
      - context: resource
        statements:
          - truncate_all(attributes, 4090)
      - context: log
        statements:
          - truncate_all(attributes, 4090)
          - set(body, Substring(body.string, 0, 4090))

This works, but the problem is when we send a body whose length is less than 4090 this warning message occurs:
invalid range for substring function, 4090 cannot be greater than the length of target string

Describe the solution you'd like

It would be nice to be able to have a precondition like WHERE body.Length() > 4090 to be able to guard against this warning.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions