Skip to content

majusko/grpc-apm-spring-boot-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring boot starter for gRPC framework with Elastic APM tracer

Maven Central Release Build Status Test Coverage License: MIT Join the chat at https://gitter.im/grpc-apm-spring-boot-starter/community

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.

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.

  1. Create an issue
  2. Create a pull request with reference to the issue
  3. Rest and enjoy the great feeling of being a contributor.