@cryptotaxi247 / netdata-1 / commits / 4eb601270

agent-events: fix metric names (#20064)

* fix metric names * fix logs path

Costa Tsaousis committed Apr 6, 2025 at 15:20 UTC 4eb6012700b78cae4266dc47e64978707815e884
3 files changed +11 -11
packaging/tools/agent-events/run.sh
+1 -1
@@ -1,6 +1,6 @@
1 #!/usr/bin/env bash
2
3 -stdbuf -oL /opt/agent-events/server --port=30001 --dedup-key agent.id --dedup-window 1800 2>/var/log/agent-events.log \
3 +stdbuf -oL /opt/agent-events/server --port=30001 --dedup-key agent.id --dedup-window 1800 2>/opt/agent-events/log/agent-events.log \
4 | stdbuf -oL log2journal json \
5 --prefix 'AE_' \
6 --inject 'SYSLOG_IDENTIFIER=agent-events' \
packaging/tools/agent-events/server.go
+7 -7
@@ -138,13 +138,13 @@ func initMetrics() (*prometheus.Exporter, error) {
138 }
139
140 requestsTotal, _ = createCounter("agent_events_requests_total", "Total number of requests received")
141 - duplicateRequests, _ = createCounter("agent_events_requests_duplicate_total", "Total number of duplicate requests detected")
142 - methodNotAllowedRequests, _ = createCounter("agent_events_requests_method_not_allowed_total", "Total number of requests with incorrect HTTP method")
143 - badRequestsTotal, _ = createCounter("agent_events_requests_bad_request_total", "Total number of requests with invalid JSON")
144 - entityTooLargeRequests, _ = createCounter("agent_events_requests_entity_too_large_total", "Total number of requests exceeding size limits")
145 - internalErrorRequests, _ = createCounter("agent_events_requests_internal_error_total", "Total number of internal server errors")
146 - bytesReceived, _ = createCounter("agent_events_bytes_received_total", "Total number of bytes received in request bodies")
147 - dedupCacheSize, _ = createGauge("agent_events_dedup_cache_size", "Current number of entries in the deduplication cache")
141 + duplicateRequests, _ = createCounter("agent_events_duplicate_requests_total", "Total number of duplicate requests detected")
142 + methodNotAllowedRequests, _ = createCounter("agent_events_method_not_allowed_requests_total", "Total number of requests with incorrect HTTP method")
143 + badRequestsTotal, _ = createCounter("agent_events_bad_request_requests_total", "Total number of requests with invalid JSON")
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")
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",
packaging/tools/agent-events/server_test.go
+3 -3
@@ -245,9 +245,9 @@ func TestHandler(t *testing.T) {
245 // Check for presence of key metrics (adjust names if needed)
246 expectedMetrics := []string{
247 "agent_events_requests_total",
248 - "agent_events_requests_duplicate_total",
249 - "agent_events_requests_method_not_allowed_total",
250 - "agent_events_dedup_cache_size",
248 + "agent_events_duplicate_requests_total",
249 + "agent_events_method_not_allowed_requests_total",
250 + "agent_events_dedup_cache_entries_size",
251 "agent_events_request_duration_seconds_count", // Check for count specifically
252 "go_goroutines",
253 }