Package io.grpc.opentelemetry
Class OpenTelemetryMetricsModule
java.lang.Object
io.grpc.opentelemetry.OpenTelemetryMetricsModule
Provides factories for
StreamTracer
that records metrics to OpenTelemetry.
On the client-side, a factory is created for each call, and the factory creates a stream tracer for each attempt. If there is no stream created when the call is ended, we still create a tracer. It's the tracer that reports per-attempt stats, and the factory that reports the stats of the overall RPC, such as RETRIES_PER_CALL, to OpenTelemetry.
On the server-side, there is only one ServerStream per each ServerCall, and ServerStream starts earlier than the ServerCall. Therefore, only one tracer is created per stream/call, and it's the tracer that reports the summary to OpenTelemetry.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
private static final class
(package private) final class
private static final class
(package private) final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.collect.ImmutableSet
<String> private static final String
private final boolean
private static final Logger
private final com.google.common.collect.ImmutableList
<OpenTelemetryPlugin> private final OpenTelemetryMetricsResource
private static final double
private final com.google.common.base.Supplier
<com.google.common.base.Stopwatch> -
Constructor Summary
ConstructorsConstructorDescriptionOpenTelemetryMetricsModule
(com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier, OpenTelemetryMetricsResource resource, Collection<String> optionalLabels, List<OpenTelemetryPlugin> plugins) -
Method Summary
Modifier and TypeMethodDescription(package private) io.grpc.ClientInterceptor
getClientInterceptor
(String target) Returns the client interceptor that facilitates OpenTelemetry metrics reporting.(package private) io.grpc.ServerStreamTracer.Factory
Returns the server tracer factory.(package private) static String
recordMethodName
(String fullMethodName, boolean isGeneratedMethod)
-
Field Details
-
logger
-
LOCALITY_LABEL_NAME
- See Also:
-
DEFAULT_PER_CALL_METRICS_SET
-
SECONDS_PER_NANO
private static final double SECONDS_PER_NANO- See Also:
-
resource
-
stopwatchSupplier
private final com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier -
localityEnabled
private final boolean localityEnabled -
plugins
-
-
Constructor Details
-
OpenTelemetryMetricsModule
OpenTelemetryMetricsModule(com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier, OpenTelemetryMetricsResource resource, Collection<String> optionalLabels, List<OpenTelemetryPlugin> plugins)
-
-
Method Details
-
getServerTracerFactory
io.grpc.ServerStreamTracer.Factory getServerTracerFactory()Returns the server tracer factory. -
getClientInterceptor
Returns the client interceptor that facilitates OpenTelemetry metrics reporting. -
recordMethodName
-