Package io.grpc.opentelemetry
Class GrpcOpenTelemetry
- java.lang.Object
-
- io.grpc.opentelemetry.GrpcOpenTelemetry
-
public final class GrpcOpenTelemetry extends Object
The entrypoint for OpenTelemetry metrics functionality in gRPC.GrpcOpenTelemetry uses
OpenTelemetry
APIs for instrumentation. When no SDK is explicitly added no telemetry data will be collected. Seeio.opentelemetry.sdk.OpenTelemetrySdk
for information on how to construct the SDK.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GrpcOpenTelemetry.Builder
Builder for configuringGrpcOpenTelemetry
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configureChannelBuilder(ManagedChannelBuilder<?> builder)
Configures the givenManagedChannelBuilder
with OpenTelemetry metrics instrumentation.void
configureServerBuilder(ServerBuilder<?> serverBuilder)
Configures the givenServerBuilder
with OpenTelemetry metrics instrumentation.static GrpcOpenTelemetry.Builder
newBuilder()
void
registerGlobal()
Registers GrpcOpenTelemetry globally, applying its configuration to all subsequently created gRPC channels and servers.
-
-
-
Method Detail
-
newBuilder
public static GrpcOpenTelemetry.Builder newBuilder()
-
registerGlobal
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10591") public void registerGlobal()
Registers GrpcOpenTelemetry globally, applying its configuration to all subsequently created gRPC channels and servers.
-
configureChannelBuilder
public void configureChannelBuilder(ManagedChannelBuilder<?> builder)
Configures the givenManagedChannelBuilder
with OpenTelemetry metrics instrumentation.
-
configureServerBuilder
public void configureServerBuilder(ServerBuilder<?> serverBuilder)
Configures the givenServerBuilder
with OpenTelemetry metrics instrumentation.- Parameters:
serverBuilder
- the server builder to configure
-
-