Class MetricService

java.lang.Object
host.anzo.commons.emergency.metric.MetricService

public class MetricService extends Object
Service for collecting and managing diagnostic metrics from various components.

This service automatically discovers and registers all metric implementations annotated with Metric during initialization. Metrics can be organized into groups and retrieved in a structured JSON format.

The service follows the singleton pattern and is initialized during application startup (marked with StartupComponent).

Since:
05.04.2021
See Also:
  • Method Details

    • getMetrics

      public String getMetrics()
      Collects and formats all registered metrics into a JSON string.

      Example output:

      
       {
           "version": "1.0.0",
           "metricGroup1": {
               "metric1": "value1",
               "metric2": "value2"
           },
           "metricGroup2": {
               "metric3": "value3",
               "metric4": "value4"
           }
       }
       
      Returns:
      JSON formatted string containing all collected metrics
      See Also: