Skip to content

concat can't make up its mind #40511

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

Closed
yshollander-selerity opened this issue Jun 5, 2025 · 2 comments
Closed

concat can't make up its mind #40511

yshollander-selerity opened this issue Jun 5, 2025 · 2 comments
Labels
bug Something isn't working processor/transform Transform processor

Comments

@yshollander-selerity
Copy link

Component(s)

processor/transform

What happened?

Description

I am setting up opentelemetry-contrib to send JMX statistics collected from a running Java process to an existing Graphite installation. I can't concatenate a prefix to the metric before I send it out via the carbon exporter.

Steps to Reproduce

Run opentelemetry contrib collector with the above configuration.

# otelcol-contrib --version otelcol-contrib version 0.127.0

Expected Result

Properly transformed metrics sent to Graphite.

Actual Result

OpenTelemetry fails with an error message. I've tried several variations of the concat, with no luck. Example log messages below.

Collector version

otelcol-contrib version 0.127.0

Environment information

Environment

OS: Ubuntu 18.04
Compiler(if manually compiled): n/a, used otelcol-contrib_0.127.0_linux_amd64.deb

OpenTelemetry Collector configuration

receivers:
  jmx:
    jar_path: /opt/opentelemetry/jmx/opentelemetry-jmx-metrics.jar
    endpoint: localhost:2126
    target_system: jvm

processors:
  resource/add_carbon_prefix:
    attributes:
      - key: carbon.metric.root_prefix 
        value: "hosts.myhostname.jmx." 
        action: insert
  transform/carbon_prefix:
    metric_statements:
      - context: metric
        statements:
          - set(name, Concat([resource.attributes["carbon.metric.root_prefix"], name]))

  batch: {}

exporters:
  carbon:
    endpoint: "graphite.mycompany.com:2003"


service:
  pipelines:
    metrics/jmx:
      receivers: [jmx]
      processors: [transform/carbon_prefix,batch]
      exporters: [carbon]
  telemetry:
    logs:
      level: debug

Log output

Two examples:

Error: invalid configuration: processors::transform/carbon_prefix: unable to parse OTTL statement "set(metric.name, Concat([resource.attributes[\"carbon.metric.root_prefix\"], metric.name]))": error while parsing arguments for call to "set": invalid argument at position 1: error while parsing arguments for call to "Concat": incorrect number of arguments. Expected: 2 Received: 1

Error: invalid configuration: processors::transform/carbon_prefix: unable to parse OTTL statement "set(metric.name, Concat(resource.attributes[\"carbon.metric.root_prefix\"], metric.name))": error while parsing arguments for call to "set": invalid argument at position 1: error while parsing arguments for call to "Concat": invalid argument at position 0: must be a list of type StringLikeGetter[github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottlmetric.TransformContext]

Additional context

No response

@yshollander-selerity yshollander-selerity added bug Something isn't working needs triage New item requiring triage labels Jun 5, 2025
@github-actions github-actions bot added the processor/transform Transform processor label Jun 5, 2025
Copy link
Contributor

github-actions bot commented Jun 5, 2025

Pinging code owners:

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

@VihasMakwana
Copy link
Contributor

@yshollander-selerity Hello!

Please refer the Concat documentation for correct format. Concat expects a 2nd argument, delimiter, which is placed between strings during concatenation.

In your case, correct function should be:

Concat([resource.attributes["carbon.metric.root_prefix"], name], ..your delimiter..)

@VihasMakwana VihasMakwana removed the needs triage New item requiring triage label Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working processor/transform Transform processor
Projects
None yet
Development

No branches or pull requests

3 participants