envoyproxy / envoyproxy/gateway

Add resources under spec.telemetry.metrics.sinks.openTelemetry to inject custom OTEL resource attributes

Open
#6,978 1 comment 0 reactions 0 assignees View on GitHub
area/api area/observability help wanted
Dominant language
Go
Stars
3k
Forks
864
Avg merge
2d 2h
Merged PRs (30d)
140

Description

### Context / Discussion
This was discussed in Slack with @arkodg and @JianpengHe. Maintainers confirmed that it’s fine to add this field and suggested raising a GitHub issue to track.

### Problem
Currently, the EnvoyProxy CRD supports custom OpenTelemetry resource attributes for access logs:
```spec.telemetry.accessLog.settings.sinks.openTelemetry.resources```

However, there is no equivalent for metrics under spec.telemetry.metrics.
Users who want consistent resource attributes (e.g., service.name, team, environment) in metrics must mutate them downstream in the OpenTelemetry Collector using resource or attributes processors. This adds operational complexity and can lead to inconsistency across clusters.

Proposed Solution
Introduce a new optional resources field under spec.telemetry.metrics.sinks.openTelemetry, similar to access logs.

Example:

```
spec:
telemetry:
metrics:
sinks:
- type: OpenTelemetry
openTelemetry:
host: otel-collector.monitoring.svc.cluster.local
port: 4317
resources:
service.name: eg-gateway
team: marketing
environment: production
```

### Benefits

Aligns logs and metrics resource configuration.
Reduces the need for downstream Collector mutations.
Backward compatible (optional field, no impact if unset).

### Alternatives Considered
Continue using the Collector resource or attributes processors to inject resource attributes, but this increases deployment complexity and does not align logs and metrics configuration in the CRD.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.