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 TypeMethodDescriptionvoidclose()voiddistribution(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel, @Nullable LocalMetricsAggregator localMetricsAggregator) Emits a Distribution metricvoidflush(boolean force) voidgauge(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel, @Nullable LocalMetricsAggregator localMetricsAggregator) Emits a Gauge metricstatic NoopMetricsAggregator@Nullable LocalMetricsAggregator@NotNull IMetricsAggregatorvoidincrement(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel, @Nullable LocalMetricsAggregator localMetricsAggregator) Emits a Counter metricvoidset(@NotNull String key, int value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel, @Nullable LocalMetricsAggregator localMetricsAggregator) Emits a Set metricvoidset(@NotNull String key, @NotNull String value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, int stackLevel, @Nullable LocalMetricsAggregator localMetricsAggregator) Emits a Set metric@Nullable ISpanstartSpanForMetric(@NotNull String op, @NotNull String description) voidtiming(@NotNull String key, @NotNull Runnable callback, MeasurementUnit.Duration unit, @Nullable Map<String, String> tags, int stackLevel, @Nullable LocalMetricsAggregator localMetricsAggregator) 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, @Nullable @Nullable LocalMetricsAggregator localMetricsAggregator) Description copied from interface:IMetricsAggregatorEmits a Counter metric- Specified by:
incrementin interfaceIMetricsAggregator- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- 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 locationlocalMetricsAggregator- The local metrics aggregator for creating span summaries
-
gauge
public void gauge(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, long timestampMs, int stackLevel, @Nullable @Nullable LocalMetricsAggregator localMetricsAggregator) Description copied from interface:IMetricsAggregatorEmits a Gauge metric- Specified by:
gaugein interfaceIMetricsAggregator- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- 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 locationlocalMetricsAggregator- The local metrics aggregator for creating span summaries
-
distribution
public void distribution(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, long timestampMs, int stackLevel, @Nullable @Nullable LocalMetricsAggregator localMetricsAggregator) Description copied from interface:IMetricsAggregatorEmits a Distribution metric- Specified by:
distributionin interfaceIMetricsAggregator- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- 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 locationlocalMetricsAggregator- The local metrics aggregator for creating span summaries
-
set
public void set(@NotNull @NotNull String key, int value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, long timestampMs, int stackLevel, @Nullable @Nullable LocalMetricsAggregator localMetricsAggregator) Description copied from interface:IMetricsAggregatorEmits a Set metric- Specified by:
setin interfaceIMetricsAggregator- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- 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 locationlocalMetricsAggregator- The local metrics aggregator for creating span summaries
-
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, @Nullable @Nullable LocalMetricsAggregator localMetricsAggregator) Description copied from interface:IMetricsAggregatorEmits a Set metric- Specified by:
setin interfaceIMetricsAggregator- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- 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 locationlocalMetricsAggregator- The local metrics aggregator for creating span summaries
-
timing
public void timing(@NotNull @NotNull String key, @NotNull @NotNull Runnable callback, @NotNull MeasurementUnit.Duration unit, @Nullable @Nullable Map<String, String> tags, int stackLevel, @Nullable @Nullable LocalMetricsAggregator localMetricsAggregator) Description copied from interface:IMetricsAggregatorEmits a distribution with the time it takes to run a given code block.- Specified by:
timingin 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 locationlocalMetricsAggregator- The local metrics aggregator for creating span summaries
-
flush
public void flush(boolean force) - Specified by:
flushin interfaceIMetricsAggregator
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getMetricsAggregator
- Specified by:
getMetricsAggregatorin interfaceMetricsApi.IMetricsInterface
-
getLocalMetricsAggregator
- Specified by:
getLocalMetricsAggregatorin interfaceMetricsApi.IMetricsInterface
-
getDefaultTagsForMetrics
- Specified by:
getDefaultTagsForMetricsin interfaceMetricsApi.IMetricsInterface
-
startSpanForMetric
@Nullable public @Nullable ISpan startSpanForMetric(@NotNull @NotNull String op, @NotNull @NotNull String description) - Specified by:
startSpanForMetricin interfaceMetricsApi.IMetricsInterface
-