Skip to content

Operator misinterprets strings as numbers when converting configuration #4314

@anna-intellegens

Description

@anna-intellegens

Component(s)

collector

What happened?

Description

The opentelemetery operator appears to fail to preserve types of certain fields when writing them out to the configmap of a collector

Steps to Reproduce

Deploy a collector with the following opentelemetrycollector definition:

apiVersion: opentelemetry.io/v1beta1
kind: OpenTelemetryCollector
metadata:
  name: otelcol2
  namespace: opentelemetry
spec:
  config:
    exporters:
      otlphttp/prometheus:
        endpoint: http://127.0.0.1/api/v1/otlp
    processors:
      metricstransform/cluster-code:
        transforms:
        - action: update
          include: ^.*$
          match_type: regexp
          operations:
          - action: add_label
            new_label: cluster_id
            new_value: "0e12"
    receivers:
      otlp:
        protocols:
          grpc:
            endpoint: 0.0.0.0:4317
          http:
            endpoint: 0.0.0.0:4318
    service:
      pipelines:
        metrics:
          exporters:
          - otlphttp/prometheus
          processors:
          - metricstransform/cluster-code
          receivers:
          - otlp
          - prometheus
  mode: statefulset
  replicas: 1

Expected Result

The "cluster_id" property would be added to all metrics with value "0e12" without being interpreted as an integer (in our use case its a unique identifier for the cluster that is a randomly generated set of hex digits defined at cluster creation)

Actual Result

Created collector errors with the message 'transforms[0].operations[0].new_value' expected type 'string', got unconvertible type 'float64', which indicates that it is being misinterpreted as a string. We have checked, and in the yaml for the collector definition it is correctly quoted on the cluster, but in the configmap created it has lost the quoting

Kubernetes Version

1.32.6

Operator version

0.129.1

Collector version

0.131.0

Environment information

Environment

GKE, nodes running on the latest Container-Optimized OS version for that k8s version

Also tested on minikube v1.36.0 with k8s version 1.32.4

Log output

Error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):

'processors' error reading configuration for "metricstransform/cluster-code": decoding failed due to the following error(s):

'transforms[0[].operations[0].new_value' expected type 'string', got unconvertible type 'float64'
2025/08/27 12:40:09 collector server run finished with error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):

'processors' error reading configuration for "metricstransform/cluster-code": decoding failed due to the following error(s):

'transforms[0[].operations[0].new_value' expected type 'string', got unconvertible type 'float64'
stream closed EOF for opentelemetry/otelcol2-collector-0 (otc-container)

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

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