Package io.prometheus.client.jetty
Class JettyStatisticsCollector
java.lang.Object
io.prometheus.client.Collector
io.prometheus.client.jetty.JettyStatisticsCollector
Collect metrics from jetty's org.eclipse.jetty.server.handler.StatisticsHandler.
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler();
context.setContextPath("/");
server.setHandler(context);
HandlerCollection handlers = new HandlerCollection();
StatisticsHandler statisticsHandler = new StatisticsHandler();
statisticsHandler.setServer(server);
handlers.addHandler(statisticsHandler);
// Register collector.
new JettyStatisticsCollector(statisticsHandler).register();
server.setHandler(handlers);
server.start();
-
Nested Class Summary
Nested classes/interfaces inherited from class io.prometheus.client.Collector
Collector.Describable, Collector.MetricFamilySamples, Collector.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.eclipse.jetty.server.handler.StatisticsHandlerFields inherited from class io.prometheus.client.Collector
MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND -
Constructor Summary
ConstructorsConstructorDescriptionJettyStatisticsCollector(org.eclipse.jetty.server.handler.StatisticsHandler statisticsHandler) -
Method Summary
Modifier and TypeMethodDescriptionprivate static Collector.MetricFamilySamplesbuildCounter(String name, String help, double value) private static Collector.MetricFamilySamplesbuildGauge(String name, String help, double value) private Collector.MetricFamilySamplesprivate static Collector.MetricFamilySamples.SamplebuildStatusSample(String name, String status, double value) collect()Return all metrics of this Collector.Methods inherited from class io.prometheus.client.Collector
checkMetricLabelName, checkMetricName, collect, doubleToGoString, register, register, sanitizeMetricName
-
Field Details
-
statisticsHandler
private final org.eclipse.jetty.server.handler.StatisticsHandler statisticsHandler -
EMPTY_LIST
-
-
Constructor Details
-
JettyStatisticsCollector
public JettyStatisticsCollector(org.eclipse.jetty.server.handler.StatisticsHandler statisticsHandler)
-
-
Method Details
-
collect
Description copied from class:CollectorReturn all metrics of this Collector. -
buildGauge
-
buildCounter
-
buildStatusCounter
-
buildStatusSample
private static Collector.MetricFamilySamples.Sample buildStatusSample(String name, String status, double value)
-