Skip to content

Metrics routed using routing connector with datapoint context are missing AggregationTemporality #37273

Open
@benzaita

Description

@benzaita

Component(s)

connector/routing

What happened?

Description

When routing using a datapoint context, the routed Metric is missing IsMonotonic and AggregationTemporality (when routing using the default context, it works fine).

Trying to forward them to a Datadog Exporter fails due to that.

Steps to Reproduce

Config:

receivers:
  otlp:
    protocols:
      http:
        endpoint: 0.0.0.0:4318

exporters:
  debug:
    verbosity: detailed

connectors:
  routing/stage:
    match_once: true
    table:

    # outbound metrics have undefined/default IsMonotonic and AggregationTemporality
    - condition: 'attributes["stage"] == "production"'
      context: datapoint
      pipelines: [metrics/prod]

    # outbound metrics have proper IsMonotonic and AggregationTemporality
    # - statement: 'route()'
    #   pipelines: [metrics/prod]

service:
  telemetry:
    logs:
      level: debug
  pipelines:
    metrics/in:
      receivers: [otlp]
      exporters: [routing/stage]
    metrics/prod:
      receivers: [routing/stage]
      exporters: [debug]

Expected Result

Expecting to see this in logs:

Metric #7
Descriptor:
      -> Name: app_user_logins_total
      -> Description: The number of users login into the Klarna app.
      -> Unit: 
      -> DataType: Sum
      -> IsMonotonic: true
      -> AggregationTemporality: Cumulative

Actual Result

Seeing this in logs:

Metric #7
Descriptor:
      -> Name: app_user_logins_total
      -> Description: The number of users login into the Klarna app.
      -> Unit: 
      -> DataType: Sum
      -> IsMonotonic: false
      -> AggregationTemporality: Unspecified

When forwarding this to a Datadog Exporter we get:

2025-01-16T10:39:36.757Z debug   [email protected]/metrics_translator.go:854       Unknown or unsupported aggregation temporality  {"kind": "exporter", "data_type": "metrics", "name": "datadog/exporter", "component": "metrics translator", "metric name": "app_user_logins_total", "aggregation temporality": "Unspecified"}

Collector version

0.117.0

Environment information

Environment

OS: macOS 14.7.2
Compiler(if manually compiled): N/A

OpenTelemetry Collector configuration

Log output

Additional context

No response

Metadata

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