envoyproxy / envoyproxy/gateway

Support dynamic Kubernetes resource attributes (e.g., pod name) in OpenTelemetry metrics sink

Open
#9,093 3 comments 1 reaction 0 assignees View on GitHub
kind/enhancement kind/feature stale
Dominant language
Go
Stars
3k
Forks
864
Avg merge
2d 2h
Merged PRs (30d)
140

Description

**Description**:

When deploying Envoy Gateway in Kubernetes, we need to filter and group Envoy data-plane metrics by Pod name and Namespace in their observability backends (like Grafana) following the [OpenTelemetry Semantic Conventions for Kubernetes](https://opentelemetry.io/docs/specs/semconv/resource/k8s/).

Currently, configuring `resourceAttributes` in the `EnvoyProxy` telemetry spec only supports static strings:

```yaml
spec:
telemetry:
metrics:
sinks:
- type: OpenTelemetry
openTelemetry:
resourceAttributes:
k8s.pod.name: "static-string" # Cannot dynamically resolve the actual Pod name
```

It would be beneficial for Envoy Gateway to support exporting dynamic Kubernetes resource attributes via the OTel metrics sink. This could be achieved in one of two ways:

1. **Automatic Injection (Preferred):** Since Envoy Gateway already manages the EnvoyProxy Deployment and knows the Pod metadata (via the Downward API), the control plane could automatically inject standard K8s resource attributes into the generated Envoy bootstrap OTel configuration:
- `k8s.pod.name`
- `k8s.namespace.name`
2. **Template/Env Var Expansion Support:** Allow Envoy Gateway's bootstrap generator to expand environment variables (like `${ENVOY_POD_NAME}`) before writing the bootstrap config, or configure Envoy's OTel sink to use an environment-based resource detector.

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.