grpc-apm-spring-boot-starter
grpc-apm-spring-boot-starter copied to clipboard
Spring boot starter for gRPC framework with Elastic APM
Spring boot starter for gRPC framework with Elastic APM tracer
Extending great LogNet gRPC Spring Boot Starter library with APM tracer module. Easy implementation using a prepared interceptor beans ready for registration.
Quick Start
Quick start consist only from 2 simple steps.
- If you never used LogNet gRPC library before, have a look on this basic setup first.
- If you never used Elastic APM tracer before, have a look on this basic setup first.
1. Add Maven dependency
<dependency>
<groupId>io.github.majusko</groupId>
<artifactId>grpc-apm-spring-boot-starter</artifactId>
<version>${version}</version>
</dependency>
2. Add interceptor to client
Just autowire already prepared ApmClientInterceptor
bean and intercept your client. Every request using this client is traced from now on.
@Service
public class ExampleClient {
@Autowired
private ApmClientInterceptor apmClientInterceptor;
public void exampleRequest() {
final ManagedChannel channel = ManagedChannelBuilder.forTarget(target).usePlaintext().build();
final Channel interceptedChannel = ClientInterceptors.intercept(channel, apmClientInterceptor);
final ExampleServiceBlockingStub stub = ExampleServiceGrpc.newBlockingStub(interceptedChannel);
stub.getExample(GetExample.newBuilder().build());
}
}
Tests
The library is fully covered with integration tests which are also very useful as a usage example.
GrpcApmSpringBootStarterApplicationTest
Contributing
All contributors are welcome. If you never contributed to the open-source, start with reading the Github Flow.
- Create an issue
- Create a pull request with reference to the issue
- Rest and enjoy the great feeling of being a contributor.