Class ActuatorClient
java.lang.Object
com.nmontytskyi.monitoring.server.polling.ActuatorClient
HTTP client for retrieving monitoring data from Spring Boot Actuator endpoints.
Sends GET requests to /actuator/health (service availability and status)
and /actuator/metrics (JVM CPU, heap, thread, and GC metrics) on behalf of
MetricsPollingScheduler.
Connection and read timeouts are configurable via
PollingProperties.
- Author:
- Nazar Montytskyi
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfetchHealth(String actuatorUrl) fetchMetricValue(String actuatorUrl, String metricName) fetchMetricValue(String actuatorUrl, String metricName, String tag) Fetches a metric filtered by a URL tag dimension (e.g.fetchTimerStatistic(String actuatorUrl, String metricName, String statistic) Fetches a Timer metric and returns the value of a specificstatistic(COUNT, TOTAL_TIME, MAX).
-
Constructor Details
-
ActuatorClient
-
-
Method Details
-
fetchHealth
-
fetchMetricValue
-
fetchMetricValue
Fetches a metric filtered by a URL tag dimension (e.g.area:nonheap). Use this only for metrics where the tag is a real Micrometer tag key, not for timer statistics such as TOTAL_TIME / COUNT / MAX — usefetchTimerStatistic(java.lang.String, java.lang.String, java.lang.String)for those. -
fetchTimerStatistic
public Optional<Double> fetchTimerStatistic(String actuatorUrl, String metricName, String statistic) Fetches a Timer metric and returns the value of a specificstatistic(COUNT, TOTAL_TIME, MAX). The statistic is a field inside themeasurementsarray of the Actuator response — it is NOT a URL tag filter.Returns
Optional.empty()when the metric does not exist yet (e.g. no GC pauses have occurred) or when the requested statistic is absent.
-