envoyproxy/gateway

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

Open

#6,978 opened on 2025年9月16日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)Go (802 forks)auto 404
area/apiarea/observabilityhelp wanted

Repository metrics

Stars
 (2,871 stars)
PR merge metrics
 (PR metrics pending)

説明

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.

コントリビューターガイド