From 8edb1e6a9f573170c655666eb87d4b350011b6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Willi=20Sch=C3=B6nborn?= Date: Mon, 17 Feb 2020 14:18:10 +0100 Subject: [PATCH] Added readme section about percentiles (#900) --- riptide-micrometer/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/riptide-micrometer/README.md b/riptide-micrometer/README.md index 39d2c826c..8f69d5c93 100644 --- a/riptide-micrometer/README.md +++ b/riptide-micrometer/README.md @@ -55,6 +55,32 @@ new MicrometerPlugin(meterRegistry) .withDefaultTags(Tag.of("aws.region", "eu-central-1")) ``` +### Histogram and percentiles + +The `MicrometerPlugin` does **NOT** configure any histograms or percentiles for two reasons: + +1. It would require Riptide to effectively replicate Micrometer's API and also maintain compatibility without providing any additional value that would justify it. +2. It should be left to users to decide which strategy they want to use: percentiles per instance (non-aggregatable), percentiles per cluster (aggregated centrally) or percentiles per cluster (pre-aggregated per instance) + +The preferred solution is to register a custom `MeterFilter` and configure percentiles that way: + +```java +registry.config().meterFilter( + new MeterFilter() { + @Override + public DistributionStatisticConfig configure(Meter.Id id, DistributionStatisticConfig config) { + if(id.getName().startsWith("myservice")) { + return DistributionStatisticConfig.builder() + .percentiles(0.95) + .build() + .merge(config); + } + return config; + } + }); +``` +For additional information on percentiles and histograms check the docs of [Micrometer](https://micrometer.io/docs/concepts#_histograms_and_percentiles) and [Prometheus](https://prometheus.io/docs/practices/histograms/). + ## Usage The plugin will measure network communication but exclude any logic that is part of the local routing tree, i.e. `greet`