envoyproxy/gateway

Is there some way to add a prefix to metrics?

Open

#6,859 建立於 2025年8月27日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)Go (802 fork)auto 404
area/apiarea/observabilityhelp wanted

倉庫指標

Star
 (2,871 star)
PR 合併指標
 (PR 指標待抓取)

描述

I'm using the OpenTelemetry sink that produces metrics without the "envoy_" prefix for proxy instances. I know there is a config in the OpenTelemetry sink to add a prefix here.

But this option doesn't exist here.

I tried customize Bootstrap , but it does not seem to work. In cases using Merge, the list ends up duplicates like this issue

In cases, using JSONPatch is not possible because the field is inside the "@type" field. And this raise a error like this:

"error": "invalid EnvoyProxy: unable to apply patch:\n[{\"op\":\"replace\",\"path\":\"/stats_sinks/0/typed_config\",\"value\":{\"@type\":\"type.googleapis.com/envoy.extensions.stat_sinks.open_telemetry.v3.SinkConfig\",\"grpc_service\":{\"envoy_grpc\":{\"cluster_name\":\"otel_metric_sink_0\"}},\"prefix\":\"envoy_\"}}] on resource:\n, err: replace operation does not apply: doc is missing path: /stats_sinks/0/typed_config: missing value"}

The manifest:

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
  name: eg
  namespace: envoy-gateway-system
spec:
  bootstrap:
    type: JSONPatch
    jsonPatches:
      - op: replace
        path: /stats_sinks/0/typed_config
        value:
          "@type": type.googleapis.com/envoy.extensions.stat_sinks.open_telemetry.v3.SinkConfig
          grpc_service:
            envoy_grpc:
              cluster_name: otel_metric_sink_0
          prefix: envoy_

I also saw the documentation about EnvoyPatchPolicy, but I'm unsure if this works for bootstrap configurations.

Is there a way to bring the envoy_ prefix back to EnvoyGateway metrics in OpenTelemetry?

貢獻者指南