Class ThroughputMetric

java.lang.Object
com.gigaspaces.metrics.Metric
com.gigaspaces.metrics.ThroughputMetric

@Deprecated public class ThroughputMetric extends Metric
Deprecated.
Use Counter with monitoring system rate queries
A metric which measures total and throughput values using sampling.

DEPRECATED: Use Micrometer Counter and let the monitoring system calculate rate/throughput using queries (e.g., PromQL rate()).

Migration Guide:

// OLD:
ThroughputMetric throughput = new ThroughputMetric();
throughput.increment();
long total = throughput.getTotal();
double rate = throughput.sampleThroughput();

// NEW:
Counter counter = Counter.builder("metric_name")
    .tags(tags)
    .description("Total count (use rate() for throughput)")
    .register(meterRegistry);
counter.increment();
double total = counter.count();
// Throughput calculated in Prometheus: rate(metric_name_total[1m])
// Or in Grafana using "Rate" function

This approach is more accurate as it:

  • Handles counter resets automatically
  • Provides flexible time windows for rate calculation
  • Reduces overhead (no sampling required)
Since:
11.0
Author:
Niv Ingberg
See Also:
  • Counter
  • Constructor Details

    • ThroughputMetric

      public ThroughputMetric()
      Deprecated.
  • Method Details

    • increment

      public void increment()
      Deprecated.
      Mark the occurrence of an event.
    • add

      public void add(long n)
      Deprecated.
      Mark the occurrence of a given number of events.
      Parameters:
      n - the number of events
    • getTotal

      public long getTotal()
      Deprecated.
      Returns the total number of events marked.
      Returns:
      the total number of events.
    • sampleThroughput

      public double sampleThroughput()
      Deprecated.
      Samples the throughput (events per second) since the previous call to sampleThroughput.
      Returns:
      the average throughput since the last call to sampleThroughput
    • getTotalMetric

      public Metric getTotalMetric()
      Deprecated.