Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixes

- Use `System.nanoTime()` for cron check-in duration measurement to avoid incorrect durations from wall-clock adjustments ([#5611](https://github.com/getsentry/sentry-java/pull/5611))
- Fix crash when `getHistoricalProcessStartReasons` is called from an isolated or wrong-userId process ([#5597](https://github.com/getsentry/sentry-java/pull/5597))
- Release `MediaMuxer` when a replay segment has no encodable frames to avoid a resource leak ([#5583](https://github.com/getsentry/sentry-java/pull/5583))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl
TracingUtils.startNewTrace(scopes);

@Nullable SentryId checkInId = null;
final long startTime = System.currentTimeMillis();
final long startTime = System.nanoTime();
boolean didError = false;

try {
Expand All @@ -105,7 +105,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl
} finally {
final @NotNull CheckInStatus status = didError ? CheckInStatus.ERROR : CheckInStatus.OK;
CheckIn checkIn = new CheckIn(checkInId, monitorSlug, status);
checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime));
checkIn.setDuration(DateUtils.nanosToSeconds(System.nanoTime() - startTime));
scopes.captureCheckIn(checkIn);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl
TracingUtils.startNewTrace(scopes);

@Nullable SentryId checkInId = null;
final long startTime = System.currentTimeMillis();
final long startTime = System.nanoTime();
boolean didError = false;

try {
Expand All @@ -105,7 +105,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl
} finally {
final @NotNull CheckInStatus status = didError ? CheckInStatus.ERROR : CheckInStatus.OK;
CheckIn checkIn = new CheckIn(checkInId, monitorSlug, status);
checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime));
checkIn.setDuration(DateUtils.nanosToSeconds(System.nanoTime() - startTime));
scopes.captureCheckIn(checkIn);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl
TracingUtils.startNewTrace(scopes);

@Nullable SentryId checkInId = null;
final long startTime = System.currentTimeMillis();
final long startTime = System.nanoTime();
boolean didError = false;

try {
Expand All @@ -108,7 +108,7 @@ public Object invoke(final @NotNull MethodInvocation invocation) throws Throwabl
} finally {
final @NotNull CheckInStatus status = didError ? CheckInStatus.ERROR : CheckInStatus.OK;
CheckIn checkIn = new CheckIn(checkInId, monitorSlug, status);
checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime));
checkIn.setDuration(DateUtils.nanosToSeconds(System.nanoTime() - startTime));
scopes.captureCheckIn(checkIn);
}
}
Expand Down
4 changes: 2 additions & 2 deletions sentry/src/main/java/io/sentry/util/CheckInUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static <U> U withCheckIn(
try (final @NotNull ISentryLifecycleToken ignored =
Sentry.forkedScopes("CheckInUtils").makeCurrent()) {
final @NotNull IScopes scopes = Sentry.getCurrentScopes();
final long startTime = System.currentTimeMillis();
final long startTime = System.nanoTime();
boolean didError = false;

TracingUtils.startNewTrace(scopes);
Expand All @@ -61,7 +61,7 @@ public static <U> U withCheckIn(
if (environment != null) {
checkIn.setEnvironment(environment);
}
checkIn.setDuration(DateUtils.millisToSeconds(System.currentTimeMillis() - startTime));
checkIn.setDuration(DateUtils.nanosToSeconds(System.nanoTime() - startTime));
scopes.captureCheckIn(checkIn);
}
}
Expand Down
Loading