Skip to content

[pkg/ottl] Cannot access flags from span context #34739

@niko-renko

Description

@niko-renko

Component(s)

pkg/ottl

What happened?

Description

Cannot access flags from span context. Making a statement that uses flags will fail.

Steps to Reproduce

Make & Use a transformer:

  transform:
    error_mode: ignore
    trace_statements:
    - context: span
      statements:
      - set(attributes["flags"], flags)

Expected Result

Spans will have a flags attribute that contain the flags values from the span context.

Actual Result

2024/08/19 17:23:35 collector server run finished with error: invalid configuration: processors::transform: unable to parse OTTL statement "set(attributes[\"collector_test_2\"], flags)": error while parsing arguments for call to "set": invalid argument at position 1: segment "flags" from path "flags" is not a valid path nor a valid OTTL keyword for the Span context - review https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/ottl/contexts/ottlspan to see all valid paths

Collector version

v0.107.0

Environment information

Environment

OS: Ubuntu 20

OpenTelemetry Collector configuration

receivers:
...

processors:
  transform:
    error_mode: ignore
    trace_statements:
    - context: span
      statements:
      - set(attributes["flags"], flags)

exporters:
...

service:
  pipelines:
    receivers: [...]
    processors: [transform]
    exporters: [...]

Log output

2024/08/19 17:23:35 collector server run finished with error: invalid configuration: processors::transform: unable to parse OTTL statement "set(attributes[\"collector_test_2\"], flags)": error while parsing arguments for call to "set": invalid argument at position 1: segment "flags" from path "flags" is not a valid path nor a valid OTTL keyword for the Span context - review https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/ottl/contexts/ottlspan to see all valid paths

Additional context

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions