DEPRECATED
The project is no longer supported due to Prometheus no longer supports the Protobuf exposition format.
Protobuf exposition format support for Prometheus client.
Usage
You can find latest release on Maven Central.
- Maven:
<dependency>
<groupId>su.nlq</groupId>
<artifactId>prometheus-protobuf-servlet</artifactId>
<version>0.6.0</version>
</dependency>
- Gradle:
compile group: 'su.nlq', name: 'prometheus-protobuf-servlet', version: '0.6.0'
The simple way to expose the metrics used in your code using Protobuf format is to add ProtobufMetricsServlet
to your HTTP server. For example, you may do it with Jetty server:
final Server server = new Server(8080);
final ServletContextHandler context = new ServletContextHandler();
context.setContextPath("/");
server.setHandler(context);
context.addServlet(new ServletHolder(new ProtobufMetricsServlet()), "/metrics");
It also supports time series restriction using ?name[]=
URL parameter.
Furthermore it is possible to use ProtobufFormatter
directly and expose the result in any other way.