Package io.sentry
Class MetricsAggregator
java.lang.Object
io.sentry.MetricsAggregator
- All Implemented Interfaces:
IMetricsAggregator,Closeable,AutoCloseable,Runnable
@Internal
public final class MetricsAggregator
extends Object
implements IMetricsAggregator, Runnable, Closeable
-
Constructor Summary
ConstructorsConstructorDescriptionMetricsAggregator(@NotNull IMetricsClient client, @NotNull ILogger logger, @NotNull SentryDateProvider dateProvider, int maxWeight, SentryOptions.BeforeEmitMetricCallback beforeEmitCallback, @NotNull ISentryExecutorService executorService) MetricsAggregator(@NotNull SentryOptions options, @NotNull IMetricsClient client) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddistribution(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, @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, @Nullable LocalMetricsAggregator localMetricsAggregator) Emits a Gauge metricvoidincrement(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, @Nullable LocalMetricsAggregator localMetricsAggregator) Emits a Counter metricvoidrun()voidset(@NotNull String key, int value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, @Nullable LocalMetricsAggregator localMetricsAggregator) Emits a Set metricvoidset(@NotNull String key, @NotNull String value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, long timestampMs, @Nullable LocalMetricsAggregator localMetricsAggregator) Emits a Set metric
-
Constructor Details
-
MetricsAggregator
public MetricsAggregator(@NotNull @NotNull SentryOptions options, @NotNull @NotNull IMetricsClient client) -
MetricsAggregator
@TestOnly public MetricsAggregator(@NotNull @NotNull IMetricsClient client, @NotNull @NotNull ILogger logger, @NotNull @NotNull SentryDateProvider dateProvider, int maxWeight, @Nullable SentryOptions.BeforeEmitMetricCallback beforeEmitCallback, @NotNull @NotNull ISentryExecutorService executorService)
-
-
Method Details
-
increment
public void increment(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, long timestampMs, @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.localMetricsAggregator- 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, @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.localMetricsAggregator- 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, @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.localMetricsAggregator- 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, @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.localMetricsAggregator- 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, @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.localMetricsAggregator- 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
-
run
public void run()
-