Class MicrometerObservationCollectorBuilder
ObservationCollector
.- Since:
- 5.19.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create the MicrometerObservationCollector
.customProcessObservationConvention
(DeliverObservationConvention customProcessObservationConvention) Custom convention forbasic.deliver
.customPublishObservationConvention
(PublishObservationConvention customPublishObservationConvention) Custom convention forbasic.publish
.customReceiveObservationConvention
(DeliverObservationConvention customReceiveObservationConvention) Custom convention forbasic.get
.defaultProcessObservationConvention
(DeliverObservationConvention defaultProcessObservationConvention) Default convention forbasic.delivery
.defaultPublishObservationConvention
(PublishObservationConvention defaultPublishObservationConvention) Default convention forbasic.publish
.defaultReceiveObservationConvention
(DeliverObservationConvention defaultReceiveObservationConvention) Default convention forbasic.get
.keepObservationStartedOnBasicGet
(boolean keepObservationStartedOnBasicGet) Whether to keep thebasic.get
observation started or not.registry
(io.micrometer.observation.ObservationRegistry registry) Set theObservationRegistry
to use.
-
Constructor Details
-
MicrometerObservationCollectorBuilder
public MicrometerObservationCollectorBuilder()
-
-
Method Details
-
registry
public MicrometerObservationCollectorBuilder registry(io.micrometer.observation.ObservationRegistry registry) Set theObservationRegistry
to use.Default is
ObservationRegistry.NOOP
.- Parameters:
registry
- the registry- Returns:
- this builder instance
-
customPublishObservationConvention
public MicrometerObservationCollectorBuilder customPublishObservationConvention(PublishObservationConvention customPublishObservationConvention) Custom convention forbasic.publish
.If not null, it will override any pre-configured conventions.
Default is
null
.- Parameters:
customPublishObservationConvention
- the convention- Returns:
- this builder instance
- See Also:
-
defaultPublishObservationConvention
public MicrometerObservationCollectorBuilder defaultPublishObservationConvention(PublishObservationConvention defaultPublishObservationConvention) Default convention forbasic.publish
.It will be picked if there was neither custom convention nor a pre-configured one via
ObservationRegistry
.Default is
DefaultPublishObservationConvention
.- Parameters:
defaultPublishObservationConvention
- the convention- Returns:
- this builder instance
- See Also:
-
customProcessObservationConvention
public MicrometerObservationCollectorBuilder customProcessObservationConvention(DeliverObservationConvention customProcessObservationConvention) Custom convention forbasic.deliver
.If not null, it will override any pre-configured conventions.
Default is
null
.- Parameters:
customProcessObservationConvention
- the convention- Returns:
- this builder instance
- See Also:
-
defaultProcessObservationConvention
public MicrometerObservationCollectorBuilder defaultProcessObservationConvention(DeliverObservationConvention defaultProcessObservationConvention) Default convention forbasic.delivery
.It will be picked if there was neither custom convention nor a pre-configured one via
ObservationRegistry
.Default is
DefaultProcessObservationConvention("process")
.- Parameters:
defaultProcessObservationConvention
- the convention- Returns:
- this builder instance
- See Also:
-
customReceiveObservationConvention
public MicrometerObservationCollectorBuilder customReceiveObservationConvention(DeliverObservationConvention customReceiveObservationConvention) Custom convention forbasic.get
.If not null, it will override any pre-configured conventions.
Default is
null
.- Parameters:
customReceiveObservationConvention
- the convention- Returns:
- this builder instance
- See Also:
-
defaultReceiveObservationConvention
public MicrometerObservationCollectorBuilder defaultReceiveObservationConvention(DeliverObservationConvention defaultReceiveObservationConvention) Default convention forbasic.get
.It will be picked if there was neither custom convention nor a pre-configured one via
ObservationRegistry
.Default is
DefaultReceiveObservationConvention("receive")
.- Parameters:
defaultReceiveObservationConvention
- the convention- Returns:
- this builder instance
- See Also:
-
keepObservationStartedOnBasicGet
public MicrometerObservationCollectorBuilder keepObservationStartedOnBasicGet(boolean keepObservationStartedOnBasicGet) Whether to keep thebasic.get
observation started or not.The
MicrometerObservationCollector
starts and stops the observation immediately after the message reception. This way the observation can have all the context from the received message but has a very short duration. This is the default behavior.By setting this flag to
true
the collector does not stop the observation and opens a scope. The processing of the message can then be included in the observation.This is then the responsibility of the developer to retrieve the observation and stop it to avoid memory leaks. Here is an example:
GetResponse response = channel.basicGet(queue, true); // process the message... // stop the observation Observation.Scope scope = observationRegistry.getCurrentObservationScope(); scope.close(); scope.getCurrentObservation().stop();
Default is false, that is stopping the observation immediately.- Parameters:
keepObservationStartedOnBasicGet
- whether to keep the observation started or not- Returns:
- this builder instance
-
build
Create the MicrometerObservationCollector
.- Returns:
- the Micrometer observation collector
-