Skip to content

Commit 1a0453f

Browse files
committed
opentelemetry: Add Javadoc for target attribute filter
1 parent 6b7763c commit 1a0453f

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

opentelemetry/src/main/java/io/grpc/opentelemetry/GrpcOpenTelemetry.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,12 @@ Builder enableTracing(boolean enable) {
432432
}
433433

434434
/**
435-
* Sets an optional filter for the grpc.target attribute.
435+
* Sets an optional filter to control recording of the {@code grpc.target} metric attribute.
436+
*
437+
* <p>If the predicate returns {@code true}, the original target is recorded. Otherwise,
438+
* the target is recorded as {@code "other"} to limit metric cardinality.
439+
*
440+
* <p>If unset, all targets are recorded as-is.
436441
*/
437442
public Builder targetAttributeFilter(@Nullable Predicate<String> filter) {
438443
this.targetAttributeFilter = filter;

opentelemetry/src/main/java/io/grpc/opentelemetry/OpenTelemetryMetricsModule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
* tracer. It's the tracer that reports per-attempt stats, and the factory that reports the stats
7070
* of the overall RPC, such as RETRIES_PER_CALL, to OpenTelemetry.
7171
*
72+
* <p>This module optionally applies a target attribute filter to limit the cardinality of
73+
* the {@code grpc.target} attribute in client-side metrics by mapping disallowed targets
74+
* to a stable placeholder value.
75+
*
7276
* <p>On the server-side, there is only one ServerStream per each ServerCall, and ServerStream
7377
* starts earlier than the ServerCall. Therefore, only one tracer is created per stream/call, and
7478
* it's the tracer that reports the summary to OpenTelemetry.

0 commit comments

Comments
 (0)