Interface HotRodClientMetricsRegistry

All Known Subinterfaces:
RemoteCacheManagerMetricsRegistry
All Known Implementing Classes:
MicrometerRemoteCacheManagerMetricsRegistry

public interface HotRodClientMetricsRegistry
A metrics registry.

Allows creating different types of metrics and keeps track of the ones registered. The method close() will remove and unregister all metrics created by this instance.

Since:
15.1
  • Field Details

  • Method Details

    • createGauge

      void createGauge(String metricName, String description, Supplier<Number> gauge, Map<String,String> tags, Consumer<Object> generatedId)
      Creates a gauge metric.

      A gauge keeps track of a single value. For example, a connection pool size.

      Parameters:
      metricName - The metric name.
      description - A small description of the metrics to help explain what it measures.
      gauge - The Supplier to be invoked to get the current value.
      tags - Extra tags or information about the gauge (for example, cache name).
      generatedId - A Consumer to accept the generated ID. The ID will be used to unregister the metric on demand.
    • createTimeGauge

      void createTimeGauge(String metricName, String description, Supplier<Number> gauge, TimeUnit timeUnit, Map<String,String> tags, Consumer<Object> generatedId)
      Creates a time gauge metric.

      A specialized gauge keeps track of a time value.

      Parameters:
      metricName - The metric name.
      description - A small description of the metrics to help explain what it measures.
      gauge - The Supplier to be invoked to get the current value.
      timeUnit - The TimeUnit of the return value.
      tags - Extra tags or information about the gauge (for example, cache name).
      generatedId - A Consumer to accept the generated ID. The ID will be used to unregister the metric on demand.
    • createTimer

      TimerTracker createTimer(String metricName, String description, Map<String,String> tags, Consumer<Object> generatedId)
      Creates a timer metrics.

      A time keep track of the event's duration. For example, a request duration.

      It can be used to compute more complex statistics, like histograms and/or percentiles.

      The Hot Rod client uses the returned TimerTracker to register the event duration.

      Parameters:
      metricName - The metric name.
      description - A small description of the metrics to help explain what it measures.
      tags - Extra tags or information about the gauge (for example, cache name).
      Returns:
      A TimerTracker implementation.
    • createCounter

      CounterTracker createCounter(String metricName, String description, Map<String,String> tags, Consumer<Object> generatedId)
      Create a counter metric.

      It keeps track of counting events and can never be decreased or reset. For example, the number of cache hits/misses.

      The Hot Rod client uses the returned CounterTracker to update the counter.

      Parameters:
      metricName - The metric name.
      description - A small description of the metrics to help explain what it measures.
      tags - Extra tags or information about the gauge (for example, cache name).
      generatedId - A Consumer to accept the generated ID. The ID will be used to unregister the metric on demand.
      Returns:
      The CounterTracker implementation.
    • createDistributionSummery

      DistributionSummaryTracker createDistributionSummery(String metricName, String description, Map<String,String> tags, Consumer<Object> generatedId)
      Creates a sample distribution metric.

      It keeps track of the event's sample distribution.

      It can be used to create more complex statistics like histograms.

      The Hot Rod client uses the returned DistributionSummaryTracker to sample the events.

      Parameters:
      metricName - The metric name.
      description - A small description of the metrics to help explain what it measures.
      tags - Extra tags or information about the gauge (for example, cache name).
      generatedId - A Consumer to accept the generated ID. The ID will be used to unregister the metric on demand.
      Returns:
      The DistributionSummaryTracker implementation.
    • close

      void close()
      Unregister all metrics created.
    • removeMetric

      void removeMetric(Object id)
      Unregister a metric by its ID.
      Parameters:
      id - The metric ID.