https://github.com/majusko/grpc-apm-spring-boot-starter
Spring boot starter for gRPC framework with Elastic APM
https://github.com/majusko/grpc-apm-spring-boot-starter
apm-tracer elastic-apm elasticsearch grpc grpc-framework grpc-interceptor grpc-java grpc-library interceptor java lognet-grpc-library spring-boot springboot springboot-starter tracing
Last synced: about 1 year ago
JSON representation
Spring boot starter for gRPC framework with Elastic APM
- Host: GitHub
- URL: https://github.com/majusko/grpc-apm-spring-boot-starter
- Owner: majusko
- License: other
- Created: 2019-11-09T18:10:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-06T09:59:57.000Z (over 3 years ago)
- Last Synced: 2025-03-30T15:38:43.917Z (about 1 year ago)
- Topics: apm-tracer, elastic-apm, elasticsearch, grpc, grpc-framework, grpc-interceptor, grpc-java, grpc-library, interceptor, java, lognet-grpc-library, spring-boot, springboot, springboot-starter, tracing
- Language: Java
- Homepage:
- Size: 148 KB
- Stars: 22
- Watchers: 1
- Forks: 4
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Spring boot starter for [gRPC framework](https://grpc.io/) with [Elastic APM tracer](https://www.elastic.co/products/apm)
[](https://search.maven.org/search?q=g:io.github.majusko)
[](https://jitpack.io/#majusko/grpc-apm-spring-boot-starter)
[](https://travis-ci.com/majusko/grpc-apm-spring-boot-starter)
[](https://codecov.io/gh/majusko/grpc-apm-spring-boot-starter/branch/master)
[](https://opensource.org/licenses/MIT) [](https://gitter.im/grpc-apm-spring-boot-starter/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Extending great [LogNet gRPC Spring Boot Starter library](https://github.com/LogNet/grpc-spring-boot-starter) 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](https://github.com/LogNet/grpc-spring-boot-starter) before, have a look on this [basic setup](https://github.com/LogNet/grpc-spring-boot-starter#4-show-case) first.
- If you never used [Elastic APM tracer](https://www.elastic.co/products/apm) before, have a look on this [basic setup](https://www.elastic.co/guide/en/apm/agent/java/1.x/setup.html) first.
#### 1. Add Maven dependency
```xml
io.github.majusko
grpc-apm-spring-boot-starter
${version}
```
#### 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.
```java
@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](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/github-flow).
1. Create an [issue](https://help.github.com/en/github/managing-your-work-on-github/about-issues)
2. Create a [pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests) with reference to the issue
3. Rest and enjoy the great feeling of being a contributor.