hengyuss opened a new issue, #4214: URL: https://github.com/apache/hertzbeat/issues/4214
### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior When a Prometheus-type metrics collection times out, monitorCollectTaskTimeout invokes the single-argument overload dispatchCollectData(Timeout, Metrics, CollectRep.MetricsData). This method constructs the monitorKey without a Prometheus-specific branch, defaulting to job.getId() + "-" + metrics.getName(). However, the key was originally inserted in dispatchMetricsTask() as String.valueOf(job.getId()). This mismatch causes metricsTime to always be null for Prometheus metrics in the timeout path. Note: The normal collection path is not affected because Prometheus metrics use the list-based overload dispatchCollectData(Timeout, Metrics, List<CollectRep.MetricsData>) which correctly uses String.valueOf(job.getId()) as the key. Impact 1. Metrics recording loss on timeout: metricsCollector.recordCollectMetrics() is never executed for Prometheus metrics that time out, so hertzbeat.collect.total and hertzbeat.collect.duration are missing timeout records for Prometheus-type monitors. 2. Memory leak: The MetricsTime entry for Prometheus metrics is never removed from metricsTimeoutMonitorMap via the normal dispatchCollectData path. Over time, stale entries accumulate as Prometheus monitors continue running. ### Expected Behavior _No response_ ### Steps To Reproduce _No response_ ### Environment ```markdown HertzBeat version(s):latest ``` ### Debug logs _No response_ ### Anything else? i will fix it -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
