Skip to content

Commit

Permalink
document springboot2 + micrometer setup (#11)
Browse files Browse the repository at this point in the history
(also version bump in the maven dep)
  • Loading branch information
jorgheymans authored and dinowernli committed May 16, 2018
1 parent 61cb2d4 commit f07d863
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Expand Up @@ -34,7 +34,7 @@ This library is made available on the [dinowernli GitHub Maven repository](https
Once the repository is set up, the library can be included using the following artifact id:

```
me.dinowernli:java-grpc-prometheus:0.1.0
me.dinowernli:java-grpc-prometheus:0.3.0
```

In order to attach the monitoring server interceptor to your gRPC server, you can do the following:
Expand All @@ -58,6 +58,18 @@ grpcStub = HelloServiceGrpc.newStub(NettyChannelBuilder.forAddress(REMOTE_HOST,
.build());
```

If you're using Spring Boot 2 with micrometer-registry-prometheus you should inject the CollectorRegistry that is already provided in the application context:

```java
@Autowired
private CollectorRegistry collectorRegistry;

// use the provided registry
MonitoringServerInterceptor monitoringInterceptor =
MonitoringServerInterceptor.create(Configuration.cheapMetricsOnly().withCollectorRegistry(collectorRegistry));
```


## Related reading

* [gRPC](http://grpc.io)
Expand Down

0 comments on commit f07d863

Please sign in to comment.