You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring Boot configures http clients (resttemplate & webclient) by default to gather metrics using micrometer.
We use the property management.metrics.enable.http.client.requests to disable http client request metrics by default but under the hood micrometer Meter.Id instances are still being created for every permutation of tags measured.
Given enough permutations this can create something close to a memoryleak as it will create (and cache) all these Meter.Ids and cause severe pressure on GC or even apps dying due to an OOME.
as a workaround we can set management.metrics.web.client.request.autotime.enabled to false but I would expect this to be disabled automatically when http client request metrics are disabled.
This is on Spring boot 2.7.3
The text was updated successfully, but these errors were encountered:
The management.metrics.enable property is described as "whether to prevent meters from emitting any metrics". As such, the behavior that you have observed is to be expected – the meters for HTTP client requests are still created but no metrics are emitted from them.
To disable auto-timing of client request metrics, you should set management.metrics.web.client.request.autotime.enabled to false as you have done. Alternatively, you can exclude HttpClientMetricsAutoConfiguration entirely.
Based on the description of the property me and my colleagues expected no meters would be created with management.metrics.enable set to false. It was only after they investigated out-of-memory issues that they discovered that lots of meter objects were still being created.
Maybe we could expand the property description to make it explicit that it affects emitting metrics, but doesn’t affect creation of meters? And maybe add a reference to management.metrics.web.client.request.autotime.enabled for the latter? We could create a PR for this.
wilkinsona
changed the title
Metrics should not be gathered when Http client request metrics are disabled
Clarify documentation on disabling web client request metrics
Aug 31, 2022
Thanks, @breun. I hadn't noticed that management.metrics.web.client.request.autotime.enabled is only mentioned in the appendix. I've added something about it to the main section on HTTP client metrics and tried to clarify the filtering behavior in 7d983be.
Spring Boot configures http clients (resttemplate & webclient) by default to gather metrics using micrometer.
We use the property
management.metrics.enable.http.client.requests
to disable http client request metrics by default but under the hood micrometer Meter.Id instances are still being created for every permutation of tags measured.Given enough permutations this can create something close to a memoryleak as it will create (and cache) all these Meter.Ids and cause severe pressure on GC or even apps dying due to an OOME.
as a workaround we can set
management.metrics.web.client.request.autotime.enabled
tofalse
but I would expect this to be disabled automatically when http client request metrics are disabled.This is on Spring boot
2.7.3
The text was updated successfully, but these errors were encountered: