grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.32k stars 181 forks source link

Add `conditions` support to `otelcol.processor.transform` from upstream OpenTelemetry `transformprocessor` #1447

Open justinbwood opened 1 month ago

justinbwood commented 1 month ago

Request

Alloy's otelcol.processor.transform component is currently missing support for conditions from the upstream transformprocessor

Example of conditions in transform processor:

transform:
  error_mode: ignore
  metric_statements:
    - context: metric
      conditions: 
        - type == METRIC_DATA_TYPE_SUM
      statements:
        - set(description, "Sum")

What the equivalent should look like in Alloy:

otelcol.processor.transform "example" {
  error_mode = "ignore"
  metric_statements {
    context = "metric"
    conditions = [
      `type == METRIC_DATA_TYPE_SUM`,
    ]
    statements = [
      `set(description, "Sum")`,
    ]
  }
  output {
    metrics = [...]
  }
}

Use case

If a block of statements has a common set of conditions, it would be useful to skip processing of that entire block of statements, rather than have to copy/paste that condition onto every statement.

In some cases where a block contains many transforms that only apply in certain conditions, it could improve transform processing time by reducing the number of operations.

github-actions[bot] commented 2 weeks ago

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it. If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!