Skip to content

Add extraLabels to spec.observability.metrics #4138

@yuzhouliu9

Description

@yuzhouliu9

Component(s)

collector

Is your feature request related to a problem? Please describe.

When an OpenTelemetryCollector is configured with the following

spec:
  observability:
    metrics:
      enableMetrics: true

It will create a ServiceMonitor. However there is no configuration to add extraLabels like in the case of the opentelemetry-operator.

Our prometheus instance is configured to only pick up ServiceMonitors and PodMonitors with a specific label. So the ServiceMonitors created from OpenTelemetryCollector are not being picked up as a target by prometheus right now.

Could this be added as a configuration parameter?

Thanks!

Describe the solution you'd like

New field under metrics named extraLabels that is a map[string]string

spec:
  observability:
    metrics:
      enableMetrics: true
      serviceMonitor:
        extraLabels:
          prometheus: kube-prometheus

Describe alternatives you've considered

Create the ServiceMonitor object manually instead of relying on OpenTelemetryCollector

Additional context

No response

Metadata

Metadata

Assignees

Labels

area:collectorIssues for deploying collectorenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions