Skip to content

Commit d3f5525

Browse files
committed
use seconds instead of millisecs with Instant.MIN
1 parent c4e0247 commit d3f5525

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/exception/ExceptionProbeManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class ExceptionProbeManager {
3131
// FIXME: if this becomes a bottleneck, find a way to make it concurrent weak identity hashmap
3232
private final Map<Throwable, ThrowableState> snapshotsByThrowable =
3333
Collections.synchronizedMap(new WeakIdentityHashMap<>());
34-
private final long captureIntervalMS;
34+
private final long captureIntervalS;
3535
private final Clock clock;
3636

3737
public ExceptionProbeManager(ClassNameFiltering classNameFiltering, Duration captureInterval) {
@@ -45,7 +45,7 @@ public ExceptionProbeManager(ClassNameFiltering classNameFiltering, Duration cap
4545
ExceptionProbeManager(
4646
ClassNameFiltering classNameFiltering, Duration captureInterval, Clock clock) {
4747
this.classNameFiltering = classNameFiltering;
48-
this.captureIntervalMS = captureInterval.toMillis();
48+
this.captureIntervalS = captureInterval.getSeconds();
4949
this.clock = clock;
5050
}
5151

@@ -105,7 +105,7 @@ boolean shouldCaptureException(String fingerprint, Clock clock) {
105105
if (lastCapture == null) {
106106
return false;
107107
}
108-
return ChronoUnit.MILLIS.between(lastCapture, Instant.now(clock)) >= captureIntervalMS;
108+
return ChronoUnit.SECONDS.between(lastCapture, Instant.now(clock)) >= captureIntervalS;
109109
}
110110

111111
public void addSnapshot(Snapshot snapshot) {

dd-java-agent/agent-debugger/src/test/java/com/datadog/debugger/exception/ExceptionProbeManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void instrumentSingleFrame() {
4545

4646
String fingerprint = Fingerprinter.fingerprint(exception, classNameFiltering);
4747
assertEquals("1c27b291764c9d387fb85247bb7c2711f885aadfbf2f64fed34b2e0c64c5a2", fingerprint);
48-
exceptionProbeManager.createProbesForException(fingerprint, exception.getStackTrace());
48+
exceptionProbeManager.createProbesForException(exception.getStackTrace());
4949
assertEquals(1, exceptionProbeManager.getProbes().size());
5050
ExceptionProbe exceptionProbe = exceptionProbeManager.getProbes().iterator().next();
5151
assertEquals(

0 commit comments

Comments
 (0)