Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Path("/prometheus")
- public class SimplePrometheusEndpoint {
- {
- // Initialize the default metrics for the hotspot VM
- DefaultExports.initialize();
- }
- @GET
- @Path("/metrics")
- @Produces(MediaType.TEXT_PLAIN)
- public StreamingOutput metrics() {
- return output -> {
- try (final Writer writer = new OutputStreamWriter(output)) {
- TextFormat.write004(writer, CollectorRegistry.defaultRegistry.metricFamilySamples());
- }
- };
- }
- }
Add Comment
Please, Sign In to add comment