From d645159a9f6cd6cd53c34307828d133f9bf915d9 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com.> Date: Wed, 19 Mar 2025 00:23:22 +0000 Subject: [PATCH] cleanup --- .../SPDF/service/MetricsAggregatorService.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/service/MetricsAggregatorService.java b/src/main/java/stirling/software/SPDF/service/MetricsAggregatorService.java index 7415719b9..2af8ad232 100644 --- a/src/main/java/stirling/software/SPDF/service/MetricsAggregatorService.java +++ b/src/main/java/stirling/software/SPDF/service/MetricsAggregatorService.java @@ -24,9 +24,6 @@ public class MetricsAggregatorService { private final EndpointInspector endpointInspector; private final Map lastSentMetrics = new ConcurrentHashMap<>(); - // Flag to decide behavior if no endpoints are discovered - private boolean allowAllGetEndpointsIfNoneDiscovered = true; - @Autowired public MetricsAggregatorService( MeterRegistry meterRegistry, @@ -37,17 +34,11 @@ public class MetricsAggregatorService { this.endpointInspector = endpointInspector; } - @Scheduled(fixedRate = 72000) // Run every 2 hours + @Scheduled(fixedRate = 7200000) // Run every 2 hours public void aggregateAndSendMetrics() { Map metrics = new HashMap<>(); - int endpointCount = endpointInspector.getValidGetEndpoints().size(); - - boolean validateGetEndpoints = true; - if (endpointCount == 0 && allowAllGetEndpointsIfNoneDiscovered) { - validateGetEndpoints = false; - } - final boolean validateGetEndpointsFinal = validateGetEndpoints; + final boolean validateGetEndpoints = endpointInspector.getValidGetEndpoints().size() != 0; Search.in(meterRegistry) .name("http.requests") .counters() @@ -81,7 +72,7 @@ public class MetricsAggregatorService { } // For GET requests, validate if we have a list of valid endpoints if ("GET".equals(method) - && validateGetEndpointsFinal + && validateGetEndpoints && !endpointInspector.isValidGetEndpoint(uri)) { logger.debug("Skipping invalid GET endpoint: {}", uri); return;