diff --git a/.cursor/rules/metrics.mdc b/.cursor/rules/metrics.mdc index 8d5c803fa4..93c82ecb46 100644 --- a/.cursor/rules/metrics.mdc +++ b/.cursor/rules/metrics.mdc @@ -1,8 +1,8 @@ --- alwaysApply: false -description: Metrics +description: Metrics API --- -# Java SDK Metrics +# Java SDK Metrics API Metrics are enabled by default. diff --git a/sentry/src/main/java/io/sentry/SentryMetricsEvent.java b/sentry/src/main/java/io/sentry/SentryMetricsEvent.java index 81723afb6e..a55e39e593 100644 --- a/sentry/src/main/java/io/sentry/SentryMetricsEvent.java +++ b/sentry/src/main/java/io/sentry/SentryMetricsEvent.java @@ -107,6 +107,14 @@ public void setSpanId(final @Nullable SpanId spanId) { this.spanId = spanId; } + public @Nullable SentryId getTraceId() { + return traceId; + } + + public void setTraceId(final @Nullable SentryId traceId) { + this.traceId = traceId; + } + public @NotNull Double getValue() { return value; } diff --git a/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java b/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java index cdea169b92..d4bb7e9afb 100644 --- a/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java +++ b/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java @@ -36,8 +36,7 @@ public class LoggerBatchProcessor implements ILoggerBatchProcessor { private final @NotNull Queue queue; private final @NotNull ISentryExecutorService executorService; private volatile @Nullable Future scheduledFlush; - private static final @NotNull AutoClosableReentrantLock scheduleLock = - new AutoClosableReentrantLock(); + private final @NotNull AutoClosableReentrantLock scheduleLock = new AutoClosableReentrantLock(); private volatile boolean hasScheduled = false; private final @NotNull ReusableCountLatch pendingCount = new ReusableCountLatch(); diff --git a/sentry/src/main/java/io/sentry/metrics/MetricsBatchProcessor.java b/sentry/src/main/java/io/sentry/metrics/MetricsBatchProcessor.java index 0b736a0353..169f36b973 100644 --- a/sentry/src/main/java/io/sentry/metrics/MetricsBatchProcessor.java +++ b/sentry/src/main/java/io/sentry/metrics/MetricsBatchProcessor.java @@ -35,8 +35,7 @@ public class MetricsBatchProcessor implements IMetricsBatchProcessor { private final @NotNull Queue queue; private final @NotNull ISentryExecutorService executorService; private volatile @Nullable Future scheduledFlush; - private static final @NotNull AutoClosableReentrantLock scheduleLock = - new AutoClosableReentrantLock(); + private final @NotNull AutoClosableReentrantLock scheduleLock = new AutoClosableReentrantLock(); private volatile boolean hasScheduled = false; private volatile boolean isShuttingDown = false;