Class MeasurementTaker.FluentMeasurementContext
java.lang.Object
dk.cloudcreate.essentials.shared.measurement.MeasurementTaker.FluentMeasurementContext
- Enclosing class:
- MeasurementTaker
A fluent builder for constructing a measurement context and recording its execution.
Example usage:
return measurementTaker.context("essentials.eventstore.append_to_stream")
.description("Time taken to append events to the event store")
.tag("aggregateType", operation.getAggregateType())
.record(chain::proceed);
-
Method Summary
Modifier and TypeMethodDescriptiondescription(String description) Sets the description for the measurement.optionalTag(String key, String value) Adds an optional tag to the measurement.<T> TExecutes the supplied code block, measuring its execution time using the built measurement context.Adds a tag to the measurement.tag(String key, CharSequence value) Adds a tag to the measurement.Adds a tag to the measurement.
-
Method Details
-
description
Sets the description for the measurement.- Parameters:
description- the description text- Returns:
- this FluentMeasurementContext instance for fluent chaining
-
tag
Adds a tag to the measurement.- Parameters:
key- the tag keyvalue- the tag value- Returns:
- this FluentMeasurementContext instance for fluent chaining
-
tag
Adds a tag to the measurement.- Parameters:
key- the tag keyvalue- the tag value- Returns:
- this FluentMeasurementContext instance for fluent chaining
-
tag
Adds a tag to the measurement.- Parameters:
key- the tag keyvalue- the tag value- Returns:
- this FluentMeasurementContext instance for fluent chaining
-
record
Executes the supplied code block, measuring its execution time using the built measurement context.- Type Parameters:
T- the type of result returned by the code block- Parameters:
block- the code block to execute and measure- Returns:
- the result of executing the code block
-
optionalTag
Adds an optional tag to the measurement. If the value is null then the tag isn't added- Parameters:
key- the tag keyvalue- the tag value- Returns:
- this FluentMeasurementContext instance for fluent chaining
-