问题
Small question regarding some metrics exposed in a Spring Webflux 2.4.2 application and the use in Grafana.
In my Spring Webflux application, I have the following bean:
@Bean
public NettyServerCustomizer nettyServerCustomizer() {
return httpServer -> httpServer.metrics(true, () -> new MicrometerChannelMetricsRecorder("myservice", "myservice"));
}
And this bean is doing its job great I would say. It is generating those metrics, among other metrics.
m__myservice_data_sent_bytes_sum{remote_address="12.123.123.123:38838",uri="/myservice",} 427631.0
m__myservice_data_sent_bytes_count{remote_address="12.123.123.122:38838",uri="/myservice",} 2
m__myservice_data_received_bytes_sum
m__myservice_data_received_bytes_count
m__myservice_data_sent_bytes_max
m__myservice_data_received_bytes_max
m__myservice_tls_handshake_time_seconds_max
However, there is an issue, it generates a lots of them. Like a LOT. It is generating some millions of those TLS and data metric within an hour.
So much the /prometheus endpoints takes 10~ seconds to return.
Furthermore, on Grafana, I have the following graph configured.
m__myservice_tls_handshake_time_seconds_max{_ws_="my_ws",_ns_="my_ns"}
irate(m__myservice_data_sent_bytes_max{_ws_="my_ws",_ns_="my_ns"}[5m])
irate(m__myservice_data_sent_bytes_sum{_ws_="my_ws",_ns_="my_ns"}[5m])
irate(m__myservice_data_sent_bytes_sum{_ws_="my_ws",_ns_="my_ns"}[5m])
And after only couple of hours, we receive the Grafana error:
"This query results in more than 1000000 samples.Try applying more filters or reduce time range.”
I don't believe this is normal. Probably I am configuring the bean wrong in the first place.
Also, may I ask what would be a more efficient query so Grafana can still show the metrics please?
Thank you
来源:https://stackoverflow.com/questions/66097881/spring-webflux-grafana-nettyservercustomizer-this-query-results-in-more-tha