Class JettyStatisticsCollector


  • public class JettyStatisticsCollector
    extends io.prometheus.client.Collector
    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

        io.prometheus.client.Collector.Describable, io.prometheus.client.Collector.MetricFamilySamples, io.prometheus.client.Collector.Type
    • Field Summary

      • Fields inherited from class io.prometheus.client.Collector

        MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND
    • Constructor Summary

      Constructors 
      Constructor Description
      JettyStatisticsCollector​(org.eclipse.jetty.server.handler.StatisticsHandler statisticsHandler)  
    • Constructor Detail

      • JettyStatisticsCollector

        public JettyStatisticsCollector​(org.eclipse.jetty.server.handler.StatisticsHandler statisticsHandler)
    • Method Detail

      • collect

        public List<io.prometheus.client.Collector.MetricFamilySamples> collect()
        Specified by:
        collect in class io.prometheus.client.Collector