|
2 | 2 |
|
3 | 3 | import static io.sentry.DateUtils.doubleToBigDecimal; |
4 | 4 |
|
5 | | -import org.jetbrains.annotations.NotNull; |
6 | | -import org.jetbrains.annotations.Nullable; |
7 | | - |
| 5 | +import io.sentry.protocol.SentryId; |
| 6 | +import io.sentry.vendor.gson.stream.JsonToken; |
8 | 7 | import java.io.IOException; |
9 | 8 | import java.util.HashMap; |
10 | 9 | import java.util.Map; |
11 | | - |
12 | | -import io.sentry.protocol.SentryId; |
13 | | -import io.sentry.vendor.gson.stream.JsonToken; |
| 10 | +import org.jetbrains.annotations.NotNull; |
| 11 | +import org.jetbrains.annotations.Nullable; |
14 | 12 |
|
15 | 13 | public final class SentryMetricsEvent implements JsonUnknown, JsonSerializable { |
16 | 14 |
|
17 | 15 | private @NotNull SentryId traceId; |
18 | 16 | private @Nullable SpanId spanId; |
19 | | - /** |
20 | | - * Timestamp in seconds (epoch time) indicating when the metric was recorded. |
21 | | - */ |
| 17 | + |
| 18 | + /** Timestamp in seconds (epoch time) indicating when the metric was recorded. */ |
22 | 19 | private @NotNull Double timestamp; |
| 20 | + |
23 | 21 | /** |
24 | | - * The name of the metric. |
25 | | - * This should follow a hierarchical naming convention using dots as separators |
26 | | - * (e.g., api.response_time, db.query.duration). |
| 22 | + * The name of the metric. This should follow a hierarchical naming convention using dots as |
| 23 | + * separators (e.g., api.response_time, db.query.duration). |
27 | 24 | */ |
28 | 25 | private @NotNull String name; |
29 | | - /** |
30 | | - * The unit of measurement for the metric value. |
31 | | - */ |
| 26 | + |
| 27 | + /** The unit of measurement for the metric value. */ |
32 | 28 | private @Nullable String unit; |
| 29 | + |
33 | 30 | /** |
34 | | - * The type of metric. One of: |
35 | | - * - counter: A metric that increments counts |
36 | | - * - gauge: A metric that tracks a value that can go up or down |
37 | | - * - distribution: A metric that tracks the statistical distribution of values |
| 31 | + * The type of metric. One of: - counter: A metric that increments counts - gauge: A metric that |
| 32 | + * tracks a value that can go up or down - distribution: A metric that tracks the statistical |
| 33 | + * distribution of values |
38 | 34 | */ |
39 | 35 | private @NotNull String type; |
| 36 | + |
40 | 37 | /** |
41 | | - * The numeric value of the metric. The interpretation depends on the metric type: |
42 | | - * - For counter metrics: the count to increment by (should default to 1) |
43 | | - * - For gauge metrics: the current value |
| 38 | + * The numeric value of the metric. The interpretation depends on the metric type: - For counter |
| 39 | + * metrics: the count to increment by (should default to 1) - For gauge metrics: the current value |
44 | 40 | * - For distribution metrics: a single measured value |
45 | 41 | */ |
46 | 42 | private @NotNull Double value; |
@@ -279,7 +275,8 @@ public static final class Deserializer implements JsonDeserializer<SentryMetrics |
279 | 275 | throw exception; |
280 | 276 | } |
281 | 277 |
|
282 | | - final SentryMetricsEvent logEvent = new SentryMetricsEvent(traceId, timestamp, name, type, value); |
| 278 | + final SentryMetricsEvent logEvent = |
| 279 | + new SentryMetricsEvent(traceId, timestamp, name, type, value); |
283 | 280 |
|
284 | 281 | logEvent.setAttributes(attributes); |
285 | 282 | logEvent.setSpanId(spanId); |
|
0 commit comments