Package io.sentry.metrics
Class NoopMetricsAggregator
java.lang.Object
io.sentry.metrics.NoopMetricsAggregator
- All Implemented Interfaces:
IMetricsAggregator
,MetricsApi.IMetricsInterface
,Closeable
,AutoCloseable
@Internal
public final class NoopMetricsAggregator
extends Object
implements IMetricsAggregator, MetricsApi.IMetricsInterface
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
distribution
(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Emits a Distribution metricvoid
flush
(boolean force) void
gauge
(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Emits a Gauge metricstatic NoopMetricsAggregator
@NotNull IMetricsAggregator
void
increment
(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Emits a Counter metricvoid
set
(@NotNull String key, int value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Emits a Set metricvoid
set
(@NotNull String key, @NotNull String value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Emits a Set metricvoid
timing
(@NotNull String key, @NotNull Runnable callback, MeasurementUnit.Duration unit, @Nullable Map<String, String> tags, int stackLevel) Emits a distribution with the time it takes to run a given code block.
-
Constructor Details
-
NoopMetricsAggregator
public NoopMetricsAggregator()
-
-
Method Details
-
getInstance
-
increment
public void increment(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Description copied from interface:IMetricsAggregator
Emits a Counter metric- Specified by:
increment
in interfaceIMetricsAggregator
- Parameters:
key
- A unique key identifying the metricvalue
- The value to be addedunit
- An optional unit, seeMeasurementUnit
tags
- Optional Tags to associate with the metrictimestampMs
- The time when the metric was emitted. Defaults to the time at which the metric is emitted, if no value is provided.stackLevel
- Optional number of stacks levels to ignore when determining the code location
-
gauge
public void gauge(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Description copied from interface:IMetricsAggregator
Emits a Gauge metric- Specified by:
gauge
in interfaceIMetricsAggregator
- Parameters:
key
- A unique key identifying the metricvalue
- The value to be addedunit
- An optional unit, seeMeasurementUnit
tags
- Optional Tags to associate with the metrictimestampMs
- The time when the metric was emitted. Defaults to the time at which the metric is emitted, if no value is provided.stackLevel
- Optional number of stacks levels to ignore when determining the code location
-
distribution
public void distribution(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Description copied from interface:IMetricsAggregator
Emits a Distribution metric- Specified by:
distribution
in interfaceIMetricsAggregator
- Parameters:
key
- A unique key identifying the metricvalue
- The value to be addedunit
- An optional unit, seeMeasurementUnit
tags
- Optional Tags to associate with the metrictimestampMs
- The time when the metric was emitted. Defaults to the time at which the metric is emitted, if no value is provided.stackLevel
- Optional number of stacks levels to ignore when determining the code location
-
set
public void set(@NotNull @NotNull String key, int value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Description copied from interface:IMetricsAggregator
Emits a Set metric- Specified by:
set
in interfaceIMetricsAggregator
- Parameters:
key
- A unique key identifying the metricvalue
- The value to be addedunit
- An optional unit, seeMeasurementUnit
tags
- Optional Tags to associate with the metrictimestampMs
- The time when the metric was emitted. Defaults to the time at which the metric is emitted, if no value is provided.stackLevel
- Optional number of stacks levels to ignore when determining the code location
-
set
public void set(@NotNull @NotNull String key, @NotNull @NotNull String value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, long timestampMs, int stackLevel) Description copied from interface:IMetricsAggregator
Emits a Set metric- Specified by:
set
in interfaceIMetricsAggregator
- Parameters:
key
- A unique key identifying the metricvalue
- The value to be addedunit
- An optional unit, seeMeasurementUnit
tags
- Optional Tags to associate with the metrictimestampMs
- The time when the metric was emitted. Defaults to the time at which the metric is emitted, if no value is provided.stackLevel
- Optional number of stacks levels to ignore when determining the code location
-
timing
public void timing(@NotNull @NotNull String key, @NotNull @NotNull Runnable callback, @NotNull MeasurementUnit.Duration unit, @Nullable @Nullable Map<String, String> tags, int stackLevel) Description copied from interface:IMetricsAggregator
Emits a distribution with the time it takes to run a given code block.- Specified by:
timing
in interfaceIMetricsAggregator
- Parameters:
key
- A unique key identifying the metriccallback
- The code block to measureunit
- An optional unit, seeMeasurementUnit.Duration
, defaults to secondstags
- Optional Tags to associate with the metricstackLevel
- Optional number of stacks levels to ignore when determining the code location
-
flush
public void flush(boolean force) - Specified by:
flush
in interfaceIMetricsAggregator
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getMetricsAggregator
- Specified by:
getMetricsAggregator
in interfaceMetricsApi.IMetricsInterface
-
getDefaultTagsForMetrics
- Specified by:
getDefaultTagsForMetrics
in interfaceMetricsApi.IMetricsInterface
-