Class MetricsModule

java.lang.Object
io.jooby.metrics.MetricsModule
All Implemented Interfaces:
io.jooby.Extension

public class MetricsModule extends Object implements io.jooby.Extension
  • Constructor Details

    • MetricsModule

      public MetricsModule(com.codahale.metrics.MetricRegistry metricRegistry, com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry, String pattern)
      Creates a new MetricsModule.
      Parameters:
      metricRegistry - Use the given metricRegistry.
      healthCheckRegistry - Use the given healthCheckRegistry.
      pattern - A root pattern where to publish all the services. Default is: /sys.
    • MetricsModule

      public MetricsModule(com.codahale.metrics.MetricRegistry metricRegistry, com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry)
      Creates a new MetricsModule.
      Parameters:
      metricRegistry - Use the given metricRegistry.
      healthCheckRegistry - Use the given healthCheckRegistry.
    • MetricsModule

      public MetricsModule(com.codahale.metrics.MetricRegistry metricRegistry, String pattern)
      Creates a new MetricsModule.
      Parameters:
      metricRegistry - Use the given metricRegistry.
      pattern - A root pattern where to publish all the services. Default is: /sys.
    • MetricsModule

      public MetricsModule(String pattern)
      Creates a new MetricsModule.
      Parameters:
      pattern - A root pattern where to publish all the services. Default is: /sys.
    • MetricsModule

      public MetricsModule(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry)
      Creates a new MetricsModule. Services will be available at: /sys.
      Parameters:
      healthCheckRegistry - Use the given healthCheckRegistry.
    • MetricsModule

      public MetricsModule(com.codahale.metrics.MetricRegistry metricRegistry)
      Creates a new MetricsModule. Services will be available at: /sys.
      Parameters:
      metricRegistry - Use the given metricRegistry.
    • MetricsModule

      public MetricsModule()
      Creates a new MetricsModule. Services will be available at: /sys.
  • Method Details

    • ping

      public MetricsModule ping()
      Append a simple ping handler that results in a 200 responses with a pong body. See PingHandler
      Returns:
      This metrics module.
    • threadDump

      public MetricsModule threadDump()
      Append a handler that prints thread states (a.k.a thread dump). See ThreadDumpHandler.
      Returns:
      This metrics module.
    • metric

      public MetricsModule metric(String name, com.codahale.metrics.Metric metric)
      Append a metric to the MetricRegistry, this call is identical to MetricRegistry.register(String, Metric).
      Parameters:
      name - Name of the metric.
      metric - A metric object
      Returns:
      This metrics module.
    • metric

      public <M extends com.codahale.metrics.Metric> MetricsModule metric(String name, Class<M> metric)
      Append a metric to the MetricRegistry. The metric will be resolved by Guice. This call is identical to MetricRegistry.register(String, Metric).
      Type Parameters:
      M - Metric type.
      Parameters:
      name - Name of the metric.
      metric - A metric object.
      Returns:
      This metrics module.
    • healthCheck

      public MetricsModule healthCheck(String name, com.codahale.metrics.health.HealthCheck check)
      Append a health check to the HealthCheckRegistry. This call is identical to HealthCheckRegistry.register(String, HealthCheck).
      Parameters:
      name - Name of the check.
      check - A check object.
      Returns:
      This metrics module.
    • healthCheck

      public <H extends com.codahale.metrics.health.HealthCheck> MetricsModule healthCheck(String name, Class<H> check)
      Append a health check to the HealthCheckRegistry. The metric will be resolved by Guice. This call is identical to HealthCheckRegistry.register(String, HealthCheck).
      Type Parameters:
      H - HealthCheck type.
      Parameters:
      name - Name of the check.
      check - A check object.
      Returns:
      This metrics module.
    • reporter

      public MetricsModule reporter(BiFunction<com.codahale.metrics.MetricRegistry,com.typesafe.config.Config,com.codahale.metrics.Reporter> callback)
      Append a Reporter to the MetricRegistry.
      Parameters:
      callback - Reporter callback.
      Returns:
      This metrics module.
    • reporter

      public MetricsModule reporter(Function<com.codahale.metrics.MetricRegistry,com.codahale.metrics.Reporter> callback)
      Append a Reporter to the MetricRegistry.
      Parameters:
      callback - Reporter callback.
      Returns:
      This metrics module.
    • install

      public void install(@NonNull io.jooby.Jooby application)
      Specified by:
      install in interface io.jooby.Extension