简体   繁体   中英

Metrics of micrometer (in spring boot) will remain in heap after scraping by Prometheus?

We have Spring application which has micrometer metrics collection enabled, and the metrics are collected by Prometheus server after certain delay. As the metrics are Time Series data, My question is the metrics which are collected at the spring application will they remain in the heap even after they are copied to Prometheus, if such time series data continues to grow then heap will go out-of-memory is not it ? Anyone has bit knowledge on micrometer metrics memory retention, please let us know.

Monitoring approach has a separation of responsibilities. We can name at least two of them:

1. Hold a knowledge about current status of application.

This is a responsibility of Spring application. It should know all status and metrics at the current moment of time. There is no time series data in the application itself. You cannot get something like "What was the application metrics one hour ago?" , because Spring has no idea what was the state of application even seconds ago.

2. Collect history of application status.

This is where Prometheus comes. It scrapes the "current" metrics from application, and maps it to the current timestamp. In such way it builds a time series, so you're able to ask Prometheus "What was the application metrics one hour ago?" .


In other words, in the heap of Spring application only current state is stored, without any history. And because of that no cleaning up needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM