From 224b224fa2cdee20c25ea15d87a68edb22935c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20J=C4=99drzejczyk?= Date: Wed, 7 Aug 2024 10:33:55 +0200 Subject: [PATCH] [docs] Highlight Micrometer.observation vs Micrometer.metrics difference Related to #3424 --- docs/modules/ROOT/pages/metrics.adoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/modules/ROOT/pages/metrics.adoc b/docs/modules/ROOT/pages/metrics.adoc index 3fdb9bf48d..e173c23c05 100644 --- a/docs/modules/ROOT/pages/metrics.adoc +++ b/docs/modules/ROOT/pages/metrics.adoc @@ -142,6 +142,16 @@ listenToEvents() The detail of the observation and its tags is provided in xref:metrics-details.adoc#micrometer-details-observation[Micrometer.observation()]. +WARNING: The set of meters collected with + xref:metrics-details.adoc#micrometer-details-observation[`Micrometer.observation()`] + differs from the set of meters that + xref:metrics-details.adoc#micrometer-details-metrics[`Micrometer.metrics()`] provides. + `Micrometer.observation()` covers the lifecycle of an entire reactive chain, while + `Micrometer.metrics()` provides some insight into individual signals within the chain. + Due to the generic nature of `Micrometer.observation()` (like providing traces aside + from metrics) it might require wrapping unitsof work, like `Mono.just(processedItem)` + and observing a sub-chain using a `flatMap`-like operator. + You can also fully customize Micrometer's Observation via `Micrometer.observation(ObservationRegistry registry, Function observationSupplier)` with your own Observation supplier, as follows: