Class MetricCollector

java.lang.Object
com.codingchili.core.metrics.MetricCollector

public class MetricCollector extends Object
Implementation of metric collection backed by micrometer.
  • Field Details

  • Constructor Details

    • MetricCollector

      public MetricCollector(CoreContext core, MetricSettings settings, String registryName)
      Parameters:
      core - the context to collect metrics from.
      settings - settings for the metric collector.
      registryName - the name of the metric registry to use.
  • Method Details

    • onMetricsSnapshot

      public void onMetricsSnapshot(io.vertx.core.json.JsonObject metrics)
      Parameters:
      metrics - log a metrics snapshot.
    • metadata

      public io.vertx.core.json.JsonObject metadata()
      Returns:
      metadata for the metric collector, this data will be included in all metric reports.
    • type

      public MetricCollector type(String type)
      Parameters:
      type - sets the given type as metadata.
      Returns:
      fluent.
    • settings

      public MetricSettings settings()
      Returns:
      the settings for this collector.
    • registry

      public com.codahale.metrics.MetricRegistry registry()
      Returns:
      the metrics registry used to collect metrics. Can be used to add custom generators.
    • snapshot

      public io.vertx.core.Future<io.vertx.core.json.JsonObject> snapshot()
      Produces a report of the current metric snapshot.
      Returns:
      a generated json report with the target fields.