Package io.sentry.metrics
Class MetricsApi
java.lang.Object
io.sentry.metrics.MetricsApi
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddistribution(@NotNull String key, double value) Emits a Distribution metricvoiddistribution(@NotNull String key, double value, @Nullable MeasurementUnit unit) Emits a Distribution metricvoiddistribution(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Distribution metricvoiddistribution(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Distribution metricvoidEmits a Gauge metricvoidgauge(@NotNull String key, double value, @Nullable MeasurementUnit unit) Emits a Gauge metricvoidgauge(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Gauge metricvoidgauge(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Gauge metricvoidEmits an increment of 1.0 for a countervoidEmits a Counter metricvoidincrement(@NotNull String key, double value, @Nullable MeasurementUnit unit) Emits a Counter metricvoidincrement(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Counter metricvoidincrement(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Counter metricvoidEmits a Set metricvoidset(@NotNull String key, int value, @Nullable MeasurementUnit unit) Emits a Set metricvoidset(@NotNull String key, int value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Set metricvoidset(@NotNull String key, int value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Set metricvoidEmits a Set metricvoidset(@NotNull String key, @NotNull String value, @Nullable MeasurementUnit unit) Emits a Set metricvoidset(@NotNull String key, @NotNull String value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Set metricvoidset(@NotNull String key, @NotNull String value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Set metricvoidEmits a distribution with the time it takes to run a given code block.voidtiming(@NotNull String key, @NotNull Runnable callback, MeasurementUnit.Duration unit) Emits a distribution with the time it takes to run a given code block.voidtiming(@NotNull String key, @NotNull Runnable callback, MeasurementUnit.Duration unit, @Nullable Map<String, String> tags) Emits a distribution with the time it takes to run a given code block.
-
Constructor Details
-
MetricsApi
-
-
Method Details
-
increment
Emits an increment of 1.0 for a counter- Parameters:
key- A unique key identifying the metric
-
increment
Emits a Counter metric- Parameters:
key- A unique key identifying the metricvalue- The value to be added
-
increment
public void increment(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit) Emits a Counter metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnit
-
increment
public void increment(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags) Emits a Counter metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- Optional Tags to associate with the metric
-
increment
public void increment(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, @Nullable @Nullable Long timestampMs) Emits a Counter metric- 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.
-
gauge
Emits a Gauge metric- Parameters:
key- A unique key identifying the metricvalue- The value to be added
-
gauge
public void gauge(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit) Emits a Gauge metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnit
-
gauge
public void gauge(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags) Emits a Gauge metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- Optional Tags to associate with the metric
-
gauge
public void gauge(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, @Nullable @Nullable Long timestampMs) Emits a Gauge metric- 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.
-
distribution
Emits a Distribution metric- Parameters:
key- A unique key identifying the metricvalue- The value to be added
-
distribution
public void distribution(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit) Emits a Distribution metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnit
-
distribution
public void distribution(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags) Emits a Distribution metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- Optional Tags to associate with the metric
-
distribution
public void distribution(@NotNull @NotNull String key, double value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, @Nullable @Nullable Long timestampMs) Emits a Distribution metric- 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.
-
set
Emits a Set metric- Parameters:
key- A unique key identifying the metricvalue- The value to be added
-
set
Emits a Set metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnit
-
set
public void set(@NotNull @NotNull String key, int value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags) Emits a Set metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- Optional Tags to associate with the metric
-
set
public void set(@NotNull @NotNull String key, int value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, @Nullable @Nullable Long timestampMs) Emits a Set metric- 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.
-
set
Emits a Set metric- Parameters:
key- A unique key identifying the metricvalue- The value to be added
-
set
public void set(@NotNull @NotNull String key, @NotNull @NotNull String value, @Nullable @Nullable MeasurementUnit unit) Emits a Set metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnit
-
set
public void set(@NotNull @NotNull String key, @NotNull @NotNull String value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags) Emits a Set metric- Parameters:
key- A unique key identifying the metricvalue- The value to be addedunit- An optional unit, seeMeasurementUnittags- Optional Tags to associate with the metric
-
set
public void set(@NotNull @NotNull String key, @NotNull @NotNull String value, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String, String> tags, @Nullable @Nullable Long timestampMs) Emits a Set metric- 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.
-
timing
Emits a distribution with the time it takes to run a given code block.- Parameters:
key- A unique key identifying the metriccallback- The code block to measure
-
timing
public void timing(@NotNull @NotNull String key, @NotNull @NotNull Runnable callback, @NotNull MeasurementUnit.Duration unit) Emits a distribution with the time it takes to run a given code block.- Parameters:
key- A unique key identifying the metriccallback- The code block to measureunit- An optional unit, seeMeasurementUnit.Duration
-
timing
public void timing(@NotNull @NotNull String key, @NotNull @NotNull Runnable callback, @Nullable MeasurementUnit.Duration unit, @Nullable @Nullable Map<String, String> tags) Emits a distribution with the time it takes to run a given code block.- Parameters:
key- A unique key identifying the metriccallback- The code block to measureunit- An optional unit, seeMeasurementUnit.Durationtags- Optional Tags to associate with the metric
-