@cryptotaxi247 / netdata-1 / commits / 60d8e6b1c

agent-events: fix metrics (#20065)

* agent-events: fix metrics * fix also the test

Costa Tsaousis committed Apr 6, 2025 at 15:37 UTC 60d8e6b1ceac3ea987a6b4ef05fb14b40960ec76
2 files changed +3 -3
packaging/tools/agent-events/server.go
+2 -2
@@ -144,12 +144,12 @@ func initMetrics() (*prometheus.Exporter, error) {
144 entityTooLargeRequests, _ = createCounter("agent_events_entity_too_large_requests_total", "Total number of requests exceeding size limits")
145 internalErrorRequests, _ = createCounter("agent_events_internal_error_requests_total", "Total number of internal server errors")
146 bytesReceived, _ = createCounter("agent_events_received_bytes_total", "Total number of bytes received in request bodies")
147 - dedupCacheSize, _ = createGauge("agent_events_dedup_cache_entries_size", "Current number of entries in the deduplication cache")
147 + dedupCacheSize, _ = createGauge("agent_events_dedup_cache_entries", "Current number of entries in the deduplication cache")
148 activeConnectionsGauge, _ = createGauge("agent_events_active_connections", "Number of currently active connections")
149 uptimeGauge, _ = createGauge("agent_events_uptime_seconds", "How long the server has been running in seconds")
150 requestDuration, _ = createHistogram("agent_events_request_duration_seconds",
151 "Histogram of request processing times in seconds",
152 - []float64{0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10},
152 + []float64{0.00001, 0.000025, 0.00005, 0.0001, 0.00025, 0.0005, 0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1 },
153 )
154 // Basic check if any metric failed (optional, depends on how critical individual metrics are)
155 // if requestsTotal == nil || ... { return exporter, fmt.Errorf("one or more metrics failed to initialize") }
packaging/tools/agent-events/server_test.go
+1 -1
@@ -247,7 +247,7 @@ func TestHandler(t *testing.T) {
247 "agent_events_requests_total",
248 "agent_events_duplicate_requests_total",
249 "agent_events_method_not_allowed_requests_total",
250 - "agent_events_dedup_cache_entries_size",
250 + "agent_events_dedup_cache_entries",
251 "agent_events_request_duration_seconds_count", // Check for count specifically
252 "go_goroutines",
253 }