open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.03k stars 2.34k forks source link

Cannot access flags from span context #34739

Open niko-renko opened 2 months ago

niko-renko commented 2 months ago

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

github-actions[bot] commented 2 months ago

Pinging code owners:

github-actions[bot] commented 1 week ago

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

Annosha commented 1 day ago

@TylerHelmuth If this is a beginner friendly issue can I work on it?

TylerHelmuth commented 1 day ago

@Annosha Sure it is yours