Skip to content

[BUG] metricsgeneration/infinite loop #37474

Closed
@bmiguel-teixeira

Description

@bmiguel-teixeira

Component(s)

processor/metricsgeneration

What happened?

Description

When using destination and metric1 with equal values (same metric) the processors enters an infinite loop.

Steps to Reproduce

In a perfect scenario, when using the scaling operations, I would like to change the selected metric "in-place". However, if we set metric name equal name, the processor enters in infinite loop.
Config shown below.

  metricsgeneration/scale:
    rules:
    - name: linux_memory_free_percent_percent
      type: scale
      metric1: linux_memory_free_percent_percent
      operation: multiply
      scale_by: 100

This happens because we iterate over the metrics array, and if we find a atching metric, we scale it based on the operation and we "ADD IT" to the ongoing metrics array. If the metrics names are equal this causes never ending loop.

Expected Result

Replace/update metric in-place. If thiscould be a desired behaviour for the config above, I can submit a PR.

Actual Result

Infinite loop in processor.

Collector version

0.118.0

Environment information

Environment

N/A

OpenTelemetry Collector configuration

Log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions