Class MetricsPollingScheduler

java.lang.Object
com.nmontytskyi.monitoring.server.polling.MetricsPollingScheduler

@Component @ConditionalOnProperty(prefix="monitoring.polling", name="enabled", havingValue="true", matchIfMissing=true) public class MetricsPollingScheduler extends Object
Scheduled component that periodically pulls health and JVM metrics from each registered service's Spring Boot Actuator endpoints.

Runs every monitoring.polling.interval-seconds (default: 30 s). For each active service it calls ActuatorClient to fetch /actuator/health and /actuator/metrics, then converts the responses into MetricSnapshotRequest objects and delegates persistence to MetricsPersistenceService.

This pull-based collection complements the push-based collection performed by the monitoring starter's AOP aspects for per-request response-time data.

Author:
Nazar Montytskyi
See Also:
  • Constructor Details

    • MetricsPollingScheduler

      public MetricsPollingScheduler()
  • Method Details

    • pollAllServices

      @Scheduled(fixedDelayString="${monitoring.polling.interval-seconds:30}000") public void pollAllServices()