Class Metrics.Builder
- Enclosing class:
- Metrics
Metrics.metric(String).- Since:
- 3.5.0
-
Method Summary
Modifier and TypeMethodDescriptionCollectsMetricTag.OptionalMetricTagthat may exist in aMetricTagContextCollectsMetricTag.OptionalMetricTagthat may exist in aMetricTagContextfromPluginKey(String pluginKey) Attribute a plugin for providing a module that is measuredCreates aHistogramwith information in the builder.voidincrementCounter(Long deltaValue) Does not guarantee safety from lost-updates, check implementations.voidincrementGauge(Long deltaValue) Does not guarantee safety from lost-updates, check implementations.invokerPluginKey(String pluginKey) Attribute the plugin for invoking measured codeCreates aLongRunningMetricTimerwith information in the builder.optionalTag(String key, boolean value) Adds an optional tag to the metric.optionalTag(String key, int value) Adds an optional tag to the metric.optionalTag(String key, String value) Adds an optional tag to the metric.optionalTags(MetricTag.OptionalMetricTag... optionalMetricTags) Adds optional tags to the metric.optionalTags(Iterable<MetricTag.OptionalMetricTag> optionalMetricTags) Adds optional tags to the metric.voidCalled to set the gauge by the valueStarts aLongRunningMetricTimerwith information in the builder.Starts aMetricTimerwith information in the builder.Adds a tag to the metric.Adds a tag to the metric.Adds a tag to the metric.tags(MetricTag.RequiredMetricTag... tags) Adds tags to the metric.tags(Iterable<MetricTag.RequiredMetricTag> requiredMetricTags) Adds tags to the metric.timer()Creates aMetricTimerwith information in the builder.Mark any created metrics to be sent to analytics.Attribute the plugin at the top of the call stack for invoking measured code
-
Method Details
-
collect
CollectsMetricTag.OptionalMetricTagthat may exist in aMetricTagContext- Since:
- 4.0.0
-
collect
CollectsMetricTag.OptionalMetricTagthat may exist in aMetricTagContext- Since:
- 4.0.0
-
tag
Adds a tag to the metric.See
tags(Iterable)for more information about tag behaviour.- Since:
- 4.4.0
-
tag
Adds a tag to the metric.See
tags(Iterable)for more information about tag behaviour.- Since:
- 4.4.0
-
tag
Adds a tag to the metric.See
tags(Iterable)for more information about tag behaviour.- Since:
- 3.5.0
-
tags
Adds tags to the metric.See
tags(Iterable)for more information about tag behaviour.- Since:
- 3.5.0
-
tags
Adds tags to the metric.Note: If there is an existing tag with the same key, the new value will replace the old.
Note: If multiple tags with the same key are passed, the last one will win.
Note: There is no guarantee in the order of tags in the output, that is the responsibility of each
MetricStrategystrategy used.- Since:
- 3.5.0
-
optionalTag
Adds an optional tag to the metric.See
optionalTags(Iterable)for more information about optional tag behaviour.- Since:
- 4.4.0
-
optionalTag
Adds an optional tag to the metric.See
optionalTags(Iterable)for more information about optional tag behaviour.- Since:
- 4.4.0
-
optionalTag
Adds an optional tag to the metric.See
optionalTags(Iterable)for more information about optional tag behaviour.- Since:
- 4.0.0
-
optionalTags
Adds optional tags to the metric.See
optionalTags(Iterable)for more information about optional tag behaviour.- Since:
- 4.0.0
-
optionalTags
@Nonnull public Metrics.Builder optionalTags(Iterable<MetricTag.OptionalMetricTag> optionalMetricTags) Adds optional tags to the metric.Note: If there is an existing
MetricTag.OptionalMetricTagwith the same key, the new value will replace the old.Note: If there is a
MetricTag.RequiredMetricTagwith the same key it will win, regardless of order.Note: If there is an
MetricTag.OptionalMetricTagwith same key in aMetricTagContextthen those provided to the builder will take priorityNote: There is no guarantee in the order of tags in the output, that is the responsibility of each
MetricStrategystrategy used.- Since:
- 4.0.0
-
fromPluginKey
Attribute a plugin for providing a module that is measured- Since:
- 3.6.0
-
invokerPluginKey
Attribute the plugin for invoking measured code- Since:
- 3.6.0
-
withInvokerPluginKey
Attribute the plugin at the top of the call stack for invoking measured codeNo guarantee, that the call stack will be able to be traversed, i.e if work is delegated to another thread.
- Since:
- 3.6.0
-
withAnalytics
Mark any created metrics to be sent to analytics.Reminder: add any tags to the appropriate analytics allow-list.
- Since:
- 3.5.0
-
histogram
Creates aHistogramwith information in the builder.- Returns:
- the created
Histogram - Since:
- 3.5.0
-
incrementCounter
Does not guarantee safety from lost-updates, check implementations.Called to increment to count the number of occurrences with information in the builder. The delta, must be positive.
- Parameters:
deltaValue- the change in gauge that should be recorded- Since:
- 3.7.0
-
incrementGauge
Does not guarantee safety from lost-updates, check implementations.Called to increment the gauge by the value. Starts from 0
- Since:
- 4.8.0
-
setGauge
Called to set the gauge by the value- Since:
- 4.8.0
-
timer
Creates aMetricTimerwith information in the builder.- Returns:
- the created
MetricTimer - Since:
- 3.5.0
-
longRunningTimer
Creates aLongRunningMetricTimerwith information in the builder.- Returns:
- the created
LongRunningMetricTimer - Since:
- 3.6.0
-
startTimer
Starts aMetricTimerwith information in the builder.- Returns:
- a
Tickerto stop the created and startedMetricTimer - Since:
- 3.5.0
-
startLongRunningTimer
Starts aLongRunningMetricTimerwith information in the builder.- Returns:
- a
Tickerto stop the created and startedLongRunningMetricTimer - Since:
- 3.6.0
-