Closed sumanmaity112 closed 3 months ago
You might want to take a look at the MeterFilter
again. You can set it per registry so if you have a MeterFilter
on CloudWatchMeterRegistry
but not on SimpleMeterRegistry
, you should get the expected behavior (Boot sets it on CompositeMeterRegistry
by default so it will affect both).
Also, I would be curious why you would not want something in CloudWatch but on the metrics endpoint. That endpoint is for troubleshooting-metrics purposes, you should not scrape it in prod.
Please describe the feature request. Implement a filtering mechanism within Micrometer to selectively transmit metrics to CloudWatch.
Rationale We aim to reduce costs associated with excessive metric transmission while ensuring that all essential metrics remain accessible through the spring-boot-actuator
/metrics
(or similar) endpoint.Additional context We utilize Micrometer alongside the CloudWatch registry for comprehensive metric monitoring within our application ecosystem. However, with the integration of tools like
kafka
, we've noticed a significant increase in the number of metrics being published to CloudWatch. This influx of metrics has resulted in unnecessary costs.Propsed solution to have a
Predicate<Meter>
which will filter out the unnecessary meters. For exampleThis concept is similar to
MeterFilter
(https://github.com/micrometer-metrics/micrometer/blob/main/micrometer-core/src/main/java/io/micrometer/core/instrument/config/MeterFilter.java) but it's only applicable for publishing part.