Package io.sentry.metrics
Class MetricsApi
java.lang.Object
io.sentry.metrics.MetricsApi
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
distribution
(@NotNull String key, double value) Emits a Distribution metricvoid
distribution
(@NotNull String key, double value, @Nullable MeasurementUnit unit) Emits a Distribution metricvoid
distribution
(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Distribution metricvoid
distribution
(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Distribution metricvoid
Emits a Gauge metricvoid
gauge
(@NotNull String key, double value, @Nullable MeasurementUnit unit) Emits a Gauge metricvoid
gauge
(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Gauge metricvoid
gauge
(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Gauge metricvoid
Emits an increment of 1.0 for a countervoid
Emits a Counter metricvoid
increment
(@NotNull String key, double value, @Nullable MeasurementUnit unit) Emits a Counter metricvoid
increment
(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Counter metricvoid
increment
(@NotNull String key, double value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Counter metricvoid
Emits a Set metricvoid
set
(@NotNull String key, int value, @Nullable MeasurementUnit unit) Emits a Set metricvoid
set
(@NotNull String key, int value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Set metricvoid
set
(@NotNull String key, int value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Set metricvoid
Emits a Set metricvoid
set
(@NotNull String key, @NotNull String value, @Nullable MeasurementUnit unit) Emits a Set metricvoid
set
(@NotNull String key, @NotNull String value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags) Emits a Set metricvoid
set
(@NotNull String key, @NotNull String value, @Nullable MeasurementUnit unit, @Nullable Map<String, String> tags, @Nullable Long timestampMs) Emits a Set metricvoid
Emits a distribution with the time it takes to run a given code block.void
timing
(@NotNull String key, @NotNull Runnable callback, MeasurementUnit.Duration unit) Emits a distribution with the time it takes to run a given code block.void
timing
(@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, seeMeasurementUnit
tags
- 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, 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.
-
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, seeMeasurementUnit
tags
- 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, 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.
-
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, seeMeasurementUnit
tags
- 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, 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.
-
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, seeMeasurementUnit
tags
- 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, 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.
-
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, seeMeasurementUnit
tags
- 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, 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.
-
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.Duration
tags
- Optional Tags to associate with the metric
-