Class SimpleMetricsHandler.Metric

  • Enclosing class:
    SimpleMetricsHandler

    public static class SimpleMetricsHandler.Metric
    extends Object
    Represents an individual metric managed by SimpleMetricsHandler. 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 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 - The MetricType (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.