Class TestInMemoryCounter

java.lang.Object
org.opensearch.test.telemetry.TestInMemoryCounter
All Implemented Interfaces:
org.opensearch.telemetry.metrics.Counter

public class TestInMemoryCounter extends Object implements org.opensearch.telemetry.metrics.Counter
This is a simple implementation of Counter which is utilized by TestInMemoryMetricsRegistry for Unit Tests. It initializes an atomic integer to add the values of counter which doesn't have any tags along with a map to store the values recorded against the tags. The map and atomic integer can then be used to get the added values.
  • Constructor Details

    • TestInMemoryCounter

      public TestInMemoryCounter()
      Constructor.
  • Method Details

    • getCounterValue

      public Integer getCounterValue()
      returns the counter value.
      Returns:
    • getCounterValueForTags

      public ConcurrentHashMap<Map<String,?>, Double> getCounterValueForTags()
      returns the counter value tags
      Returns:
    • add

      public void add(double value)
      Specified by:
      add in interface org.opensearch.telemetry.metrics.Counter
    • add

      public void add(double value, org.opensearch.telemetry.metrics.tags.Tags tags)
      Specified by:
      add in interface org.opensearch.telemetry.metrics.Counter