grpc/grpc-java

Cardinality of grpc_target attribute for grpc.client.* metrics is too large

已关闭

#12,322 创建于 2025年8月28日

 (9 条评论) (0 个反应) (0 位负责人)Java (3,742 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (11,124 个星标)
PR 合并指标
 (平均合并 23天 22小时) (30 天内合并 43 个 PR)

描述

What version of gRPC-Java are you using?

1.71.0

What is your environment?

OS: Linux JDK: 21

What did you expect to see?

No warnings when enabling default OpenTelemetry metrics.

What did you see instead?

WARNING: Instrument grpc.client.attempt.started has exceeded the maximum allowed cardinality (1999).
WARNING: Instrument grpc.client.attempt.rcvd_total_compressed_message_size has exceeded the maximum allowed cardinality (1999).
WARNING: Instrument grpc.client.attempt.sent_total_compressed_message_size has exceeded the maximum allowed cardinality (1999).
WARNING: Instrument grpc.client.call.duration has exceeded the maximum allowed cardinality (1999).
WARNING: Instrument grpc.client.attempt.duration has exceeded the maximum allowed cardinality (1999).

This is caused by the grpc_target attribute having a very large cardinality.

I see that this attribute is listed for these metrics at https://github.com/grpc/proposal/blob/master/A66-otel-stats.md. However, for very large deployments this can be problematic. Is there a way to turn this attribute off?

Steps to reproduce the bug

Have a client which connects to 2000+ servers (either at once or over time).

贡献者指南