Class Metrics
MetricTimer, LongRunningMetricTimer, and Histogram.
Please move to using the builder.
try (Ticker autoclosed = Metrics.metric("my-timer").startTimer()) {
// monitored code block here
}
- Since:
- 3.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA metric builder, to get started callmetric(String). -
Method Summary
Modifier and TypeMethodDescriptionstatic MetricsConfigurationGet the currentMetricsConfiguration.static HistogramDeprecated.static Histogramhistogram(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static Histogramhistogram(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static LongRunningMetricTimerlongRunningTimer(String name) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static LongRunningMetricTimerlongRunningTimer(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static LongRunningMetricTimerlongRunningTimer(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static Metrics.BuilderStart creating a metric using theMetrics.Builderstatic voidresetMetric(MetricKey metricKey) Resets (that may mean removal depending on the metric strategy) a specific metric that exactly matches aMetricKey.static TickerstartLongRunningTimer(String name) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static TickerstartLongRunningTimer(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static TickerstartLongRunningTimer(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static TickerstartTimer(String name) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static TickerstartTimer(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static TickerstartTimer(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static MetricTimerDeprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static MetricTimertimer(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.static MetricTimertimer(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.
-
Method Details
-
resetMetric
Resets (that may mean removal depending on the metric strategy) a specific metric that exactly matches aMetricKey.- Parameters:
metricKey- metric key to be reset.- Since:
- 4.9.0
-
getConfiguration
Get the currentMetricsConfiguration.- Returns:
- the current configuration.
- Since:
- 3.0.0
-
histogram
Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Creates aHistogramwith the given name.- Returns:
- the created
Histogram - Since:
- 3.4.0
-
histogram
@Deprecated @Nonnull public static Histogram histogram(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Creates aHistogramwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- the created
Histogram - Since:
- 3.4.0
-
histogram
@Deprecated @Nonnull public static Histogram histogram(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Creates aHistogramwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- the created
Histogram - Since:
- 3.4.0
-
timer
Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Creates aMetricTimerwith the given name.- Returns:
- the created
MetricTimer - Since:
- 3.4.0
-
timer
@Deprecated @Nonnull public static MetricTimer timer(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Creates aMetricTimerwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- the created
MetricTimer - Since:
- 3.4.0
-
timer
@Deprecated @Nonnull public static MetricTimer timer(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Creates aMetricTimerwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- the created
MetricTimer - Since:
- 3.4.0
-
longRunningTimer
Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Creates aLongRunningMetricTimerwith the given name.- Returns:
- the created
LongRunningMetricTimer - Since:
- 3.5.0
-
longRunningTimer
@Deprecated @Nonnull public static LongRunningMetricTimer longRunningTimer(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Creates aLongRunningMetricTimerwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- the created
LongRunningMetricTimer - Since:
- 3.5.0
-
longRunningTimer
@Deprecated @Nonnull public static LongRunningMetricTimer longRunningTimer(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Creates aLongRunningMetricTimerwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- the created
LongRunningMetricTimer - Since:
- 3.5.0
-
startTimer
Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Starts aMetricTimerwith the given name.- Returns:
- a
Tickerto stop the created and startedMetricTimer - Since:
- 3.4.0
-
startTimer
@Deprecated @Nonnull public static Ticker startTimer(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Starts aMetricTimerwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- a
Tickerto stop the created and startedMetricTimer - Since:
- 3.4.0
-
startTimer
@Deprecated @Nonnull public static Ticker startTimer(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Starts aMetricTimerwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- a
Tickerto stop the created and startedMetricTimer - Since:
- 3.4.0
-
startLongRunningTimer
Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Starts aLongRunningMetricTimerwith the given name, and tags it with the given tags.- Returns:
- a
Tickerto stop the created and startedLongRunningMetricTimer - Since:
- 3.5.0
-
startLongRunningTimer
@Deprecated @Nonnull public static Ticker startLongRunningTimer(String name, MetricTag.RequiredMetricTag... tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Starts aLongRunningMetricTimerwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- a
Tickerto stop the created and startedLongRunningMetricTimer - Since:
- 3.5.0
-
startLongRunningTimer
@Deprecated @Nonnull public static Ticker startLongRunningTimer(String name, Collection<MetricTag.RequiredMetricTag> tags) Deprecated.since 4.3.0, for removal in 5.0.0, use themetric(String)builder instead.Starts aLongRunningMetricTimerwith the given name, and tags it with the given tags.See
Metrics.Builder.tags(Iterable)for more information about tag behaviour.- Returns:
- a
Tickerto stop the created and startedLongRunningMetricTimer - Since:
- 3.5.0
-
metric
Start creating a metric using theMetrics.Builder- Parameters:
name- metric name- Returns:
- a metric builder
- Since:
- 3.5.0
-
metric(String)builder instead.