public final class Micrometer
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
DEFAULT_METER_PREFIX
The default "name" to use as a prefix for meter if the instrumented sequence doesn't define a
name . |
构造器和说明 |
---|
Micrometer() |
限定符和类型 | 方法和说明 |
---|---|
static <T> SignalListenerFactory<T,?> |
metrics(io.micrometer.core.instrument.MeterRegistry meterRegistry)
A
SignalListener factory that will ultimately produce Micrometer metrics
to the provided MeterRegistry (and using the registry's configured
Clock in case additional timings are needed). |
static <T> SignalListenerFactory<T,?> |
observation(io.micrometer.observation.ObservationRegistry registry)
A
SignalListener factory that will ultimately produce a Micrometer Observation
representing the runtime of the publisher to the provided ObservationRegistry . |
static Scheduler |
timedScheduler(Scheduler original,
io.micrometer.core.instrument.MeterRegistry meterRegistry,
java.lang.String metricsPrefix)
Wrap a
Scheduler in an instance that gathers various task-related metrics using
the provided MeterRegistry and naming meters using the provided metricsPrefix . |
static Scheduler |
timedScheduler(Scheduler original,
io.micrometer.core.instrument.MeterRegistry meterRegistry,
java.lang.String metricsPrefix,
java.lang.Iterable<io.micrometer.core.instrument.Tag> tags)
Wrap a
Scheduler in an instance that gathers various task-related metrics using
the provided MeterRegistry and naming meters using the provided metricsPrefix . |
public static <T> SignalListenerFactory<T,?> metrics(io.micrometer.core.instrument.MeterRegistry meterRegistry)
SignalListener
factory that will ultimately produce Micrometer metrics
to the provided MeterRegistry
(and using the registry's configured
Clock
in case additional timings are needed).
To be used with either the Flux.tap(SignalListenerFactory)
or
Mono.tap(SignalListenerFactory)
operator.
When used in a Flux.tap(SignalListenerFactory)
operator, meter names use
the Flux.name(String)
set upstream of the tap as id prefix if applicable
or default to DEFAULT_METER_PREFIX
. Similarly, upstream tags are gathered and added
to the default set of tags for meters.
See MicrometerMeterListenerDocumentation
for a documentation of the default set of meters and tags.
Note that some monitoring systems like Prometheus require to have the exact same set of tags for each meter bearing the same name.
T
- the type of onNext in the target publishermeterRegistry
- the MeterRegistry
in which to register and publish metricsSignalListenerFactory
to record metricsMicrometerMeterListenerDocumentation
public static <T> SignalListenerFactory<T,?> observation(io.micrometer.observation.ObservationRegistry registry)
SignalListener
factory that will ultimately produce a Micrometer Observation
representing the runtime of the publisher to the provided ObservationRegistry
.
To be used with either the Flux.tap(SignalListenerFactory)
or
Mono.tap(SignalListenerFactory)
operator.
The Observation
covers the entire length of the sequence, from subscription to termination.
Said termination can be a cancellation, a completion with or without values or an error.
This is denoted by the low cardinality status
KeyValue
.
In case of an exception, a high cardinality exception
KeyValue with the exception class name is also added.
Finally, the low cardinality type
KeyValue informs whether we're observing a Flux
or a Mono
.
Note that the Micrometer context-propagation
is used to populate thread locals
around the opening of the observation (upon onSubscribe(Subscription)
).
The observation is named after the Flux.name(String)
defined upstream
of the tap if applicable or use "reactor.observation"
otherwise (although it is strongly recommended
to provide a meaningful name).
Similarly, Reactor tags defined upstream via eg. Flux.tag(String, String)
)
are gathered and added to the default set of KeyValues
used by the Observation
as low cardinality keyValues
.
See MicrometerObservationListenerDocumentation
for a documentation of the default set of tags.
T
- the type of onNext in the target publisherSignalListenerFactory
to record observationsMicrometerObservationListenerDocumentation
public static Scheduler timedScheduler(Scheduler original, io.micrometer.core.instrument.MeterRegistry meterRegistry, java.lang.String metricsPrefix)
Scheduler
in an instance that gathers various task-related metrics using
the provided MeterRegistry
and naming meters using the provided metricsPrefix
.
Note that no common tags are set up for these meters.
See TimedSchedulerMeterDocumentation
for a documentation of the default set of meters and tags.original
- the original Scheduler
to decorate with metricsmeterRegistry
- the MeterRegistry
in which to register the various metersmetricsPrefix
- the prefix to use in meter names. Must not end with a dot, which is automatically added.Scheduler
that is instrumented with dedicated metricsTimedSchedulerMeterDocumentation
public static Scheduler timedScheduler(Scheduler original, io.micrometer.core.instrument.MeterRegistry meterRegistry, java.lang.String metricsPrefix, java.lang.Iterable<io.micrometer.core.instrument.Tag> tags)
Scheduler
in an instance that gathers various task-related metrics using
the provided MeterRegistry
and naming meters using the provided metricsPrefix
.
User-provided collection of common tags (ie. Tags
) can also be provided to be added to
all the meters of that timed Scheduler.
See TimedSchedulerMeterDocumentation
for a documentation of the default set of meters and tags.original
- the original Scheduler
to decorate with metricsmeterRegistry
- the MeterRegistry
in which to register the various metersmetricsPrefix
- the prefix to use in meter names. Must not end with a dot, which is automatically added.tags
- the tags to put on metersScheduler
that is instrumented with dedicated metricsTimedSchedulerMeterDocumentation