Skip to content

[exporter/loadbalancing]: support routing_key=attributes for metrics #45675

@ajimenez1503

Description

@ajimenez1503

Component(s)

exporter/loadbalancing

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

The loadbalancing exporter supports routing by attributes for traces, but metrics rejects routing_key: attributes.

This makes it impossible to route metrics based on a selected set of resource/data-point attributes (e.g., service.instance.id, host.id, k8s.pod.uid).

The config already exposes routing_attributes, but metrics ignores it.

Describe the solution you'd like

Add routing_key: attributes support to the metrics exporter. Use routing_attributes to build a composite routing key from metrics data, similar to trace attribute routing.

Suggested behavior:

  • Accept routing_key: attributes for metrics.
  • Build the key by checking, in order, resource attributes and data point attributes.
  • Keep routing_attributes as the user-defined list to compose the key.
  • Document supported attribute sources for metrics (resource + datapoint)

Describe alternatives you've considered

Using routing_key: resource or routing_key: metric. These are too coarse and don’t allow selecting specific attributes.

Additional context

Example config:

exporters:
  loadbalancing:
    routing_key: attributes
    routing_attributes: [ "service.name", "service.instance.id", "k8s.pod.uid" ]

Expected: metrics are consistently routed to the same backend based on the composite attributes, similar to trace routing by attributes.

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions