Package io.roastedroot.proxywasm
Class SimpleMetricsHandler.Metric
- java.lang.Object
-
- io.roastedroot.proxywasm.SimpleMetricsHandler.Metric
-
- Enclosing class:
- SimpleMetricsHandler
public static class SimpleMetricsHandler.Metric extends Object
Represents an individual metric managed bySimpleMetricsHandler
. Stores the metric's ID, type, name, and its current value. Note: Histograms are stored as a single value (like a Gauge) in this simple implementation.
-
-
Constructor Summary
Constructors Constructor Description Metric(int id, MetricType type, String name)
Constructs a new Metric instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getValue()
Gets the current value of the metric.int
id()
Gets the unique integer ID of the metric.String
name()
Gets the name of the metric.void
setValue(long value)
Sets the current value of the metric.MetricType
type()
Gets the type of the metric.
-
-
-
Constructor Detail
-
Metric
public Metric(int id, MetricType type, String name)
Constructs a new Metric instance.- Parameters:
id
- The unique integer ID assigned by the handler.type
- TheMetricType
(Counter, Gauge, Histogram).name
- The name of the metric.
-
-
Method Detail
-
id
public int id()
Gets the unique integer ID of the metric.- Returns:
- The unique integer ID of the metric.
-
type
public MetricType type()
Gets the type of the metric.- Returns:
- The
MetricType
of the metric.
-
name
public String name()
Gets the name of the metric.- Returns:
- The name of the metric.
-
getValue
public long getValue()
Gets the current value of the metric.- Returns:
- The current value of the metric.
-
setValue
public void setValue(long value)
Sets the current value of the metric. Used internally bySimpleMetricsHandler.recordMetric(int, long)
andSimpleMetricsHandler.incrementMetric(int, long)
.- Parameters:
value
- The new value for the metric.
-
-