opentelemetry-java-instrume.../instrumentation/grpc-1.6/library
Mateusz Rzeszutek e1895e548c
Rename all methods in all Getters to use the `get*()` naming scheme (#7619)
Resolves #6562

This PR only contains renames; the actual content is in the `*Getter`
interfaces, the rest of changes is just IntelliJ doing its job.
2023-01-23 09:28:11 +00:00
..
src Rename all methods in all Getters to use the `get*()` naming scheme (#7619) 2023-01-23 09:28:11 +00:00
README.md Introduce markdown lint check (#7175) 2022-11-16 20:48:42 -08:00
build.gradle.kts Migrate Guava tests to Java (#5668) 2022-03-24 14:14:09 +09:00

README.md

Library Instrumentation for gRPC 1.6.0+

Provides OpenTelemetry instrumentation for gRPC.

Quickstart

Add the following dependencies to your project

Replace OPENTELEMETRY_VERSION with the latest release.

For Maven, add the following to your pom.xml dependencies:

<dependencies>
  <dependency>
    <groupId>io.opentelemetry.instrumentation</groupId>
    <artifactId>opentelemetry-grpc-1.6</artifactId>
    <version>OPENTELEMETRY_VERSION</version>
  </dependency>
</dependencies>

For Gradle, add the following to your dependencies:

implementation("io.opentelemetry.instrumentation:opentelemetry-grpc-1.6:OPENTELEMETRY_VERSION")

Usage

The instrumentation library provides the implementation of ClientInterceptor and ServerInterceptor to provide OpenTelemetry-based spans and context propagation.

// For client-side, attach the interceptor to your channel builder.
void configureClientInterceptor(Opentelemetry opentelemetry, NettyChannelBuilder nettyChannelBuilder) {
  GrpcTelemetry grpcTelemetry = GrpcTelemetry.create(opentelemetry);
  nettyChannelBuilder.intercept(grpcTelemetry.newClientInterceptor());
}

// For server-side, attatch the interceptor to your service.
ServerServiceDefinition configureServerInterceptor(Opentelemetry opentelemetry, ServerServiceDefinition serviceDefinition) {
  GrpcTelemetry grpcTelemetry = GrpcTelemetry.create(opentelemetry);
  return ServiceInterceptors.intercept(serviceDefinition, grpcTelemetry.newServerInterceptor());
}