-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capture exception snapshots only once an hour #6983
Conversation
public void captureOncePerHour() throws Exception { | ||
Config config = createConfig(); | ||
Clock clockMock = mock(Clock.class); | ||
when(clockMock.instant()).thenReturn(Instant.now()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using mockito to mock clocks I got weird flaky tests in the past about unfinished mockings. Have you ever had that? I decided to have a method with two signatures, one with clock and the other one without the clock using a "default clock" to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no problem with mocking so far 🤞
@@ -59,7 +75,7 @@ public void createProbesForException(String fingerprint, StackTraceElement[] sta | |||
} | |||
|
|||
void addFingerprint(String fingerprint) { | |||
fingerprints.add(fingerprint); | |||
fingerprints.put(fingerprint, Instant.ofEpochSecond(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also Instant.MIN
: https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html#MIN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks 👌
if (lastCapture == null) { | ||
return false; | ||
} | ||
// only capture once an hour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// only capture once an hour | |
// only capture once a captureInterval |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or delete the comment all together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
Keep a timestamp associated to the fingerprint to know when last time we capture snapshots for this exception. Hardcoded once an hour will probably make it a config token for this later
remove comment
afc1d37
to
d3f5525
Compare
BenchmarksStartupLoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 13 metrics, 15 unstable metrics. Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.34.0-SNAPSHOT~d3f5525450, baseline=1.34.0-SNAPSHOT~6978c8eed3
dateFormat X
axisFormat %s
section baseline
no_agent (1.351 ms) : 1332, 1370
. : milestone, 1351,
appsec (1.727 ms) : 1704, 1750
. : milestone, 1727,
appsec_no_iast (1.728 ms) : 1703, 1752
. : milestone, 1728,
iast (1.491 ms) : 1469, 1514
. : milestone, 1491,
profiling (1.535 ms) : 1509, 1561
. : milestone, 1535,
tracing (1.487 ms) : 1463, 1511
. : milestone, 1487,
section candidate
no_agent (1.347 ms) : 1327, 1366
. : milestone, 1347,
appsec (1.745 ms) : 1721, 1770
. : milestone, 1745,
appsec_no_iast (1.726 ms) : 1701, 1750
. : milestone, 1726,
iast (1.512 ms) : 1489, 1535
. : milestone, 1512,
profiling (1.558 ms) : 1532, 1584
. : milestone, 1558,
tracing (1.486 ms) : 1463, 1509
. : milestone, 1486,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.34.0-SNAPSHOT~d3f5525450, baseline=1.34.0-SNAPSHOT~6978c8eed3
dateFormat X
axisFormat %s
section baseline
no_agent (371.82 µs) : 352, 392
. : milestone, 372,
iast (486.892 µs) : 466, 508
. : milestone, 487,
iast_FULL (552.68 µs) : 532, 574
. : milestone, 553,
iast_GLOBAL (499.895 µs) : 479, 520
. : milestone, 500,
iast_HARDCODED_SECRET_DISABLED (481.198 µs) : 461, 502
. : milestone, 481,
iast_INACTIVE (457.387 µs) : 435, 479
. : milestone, 457,
iast_TELEMETRY_OFF (479.318 µs) : 459, 500
. : milestone, 479,
tracing (455.008 µs) : 434, 476
. : milestone, 455,
section candidate
no_agent (377.428 µs) : 358, 397
. : milestone, 377,
iast (481.482 µs) : 461, 502
. : milestone, 481,
iast_FULL (558.277 µs) : 537, 579
. : milestone, 558,
iast_GLOBAL (509.135 µs) : 488, 530
. : milestone, 509,
iast_HARDCODED_SECRET_DISABLED (487.207 µs) : 466, 509
. : milestone, 487,
iast_INACTIVE (453.428 µs) : 433, 474
. : milestone, 453,
iast_TELEMETRY_OFF (485.347 µs) : 463, 508
. : milestone, 485,
tracing (458.73 µs) : 437, 480
. : milestone, 459,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.34.0-SNAPSHOT~d3f5525450, baseline=1.34.0-SNAPSHOT~6978c8eed3
dateFormat X
axisFormat %s
section baseline
no_agent (1.463 ms) : 1452, 1475
. : milestone, 1463,
appsec (2.193 ms) : 2160, 2227
. : milestone, 2193,
iast (1.881 ms) : 1846, 1916
. : milestone, 1881,
iast_GLOBAL (1.912 ms) : 1878, 1947
. : milestone, 1912,
profiling (1.851 ms) : 1816, 1885
. : milestone, 1851,
tracing (1.836 ms) : 1804, 1868
. : milestone, 1836,
section candidate
no_agent (1.46 ms) : 1448, 1471
. : milestone, 1460,
appsec (2.205 ms) : 2170, 2239
. : milestone, 2205,
iast (1.891 ms) : 1856, 1927
. : milestone, 1891,
iast_GLOBAL (1.915 ms) : 1880, 1950
. : milestone, 1915,
profiling (1.857 ms) : 1824, 1891
. : milestone, 1857,
tracing (1.834 ms) : 1802, 1867
. : milestone, 1834,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.34.0-SNAPSHOT~d3f5525450, baseline=1.34.0-SNAPSHOT~6978c8eed3
dateFormat X
axisFormat %s
section baseline
no_agent (15.398 s) : 15398000, 15398000
. : milestone, 15398000,
appsec (15.186 s) : 15186000, 15186000
. : milestone, 15186000,
iast (18.837 s) : 18837000, 18837000
. : milestone, 18837000,
iast_GLOBAL (17.774 s) : 17774000, 17774000
. : milestone, 17774000,
profiling (15.361 s) : 15361000, 15361000
. : milestone, 15361000,
tracing (15.01 s) : 15010000, 15010000
. : milestone, 15010000,
section candidate
no_agent (14.856 s) : 14856000, 14856000
. : milestone, 14856000,
appsec (15.224 s) : 15224000, 15224000
. : milestone, 15224000,
iast (18.79 s) : 18790000, 18790000
. : milestone, 18790000,
iast_GLOBAL (17.727 s) : 17727000, 17727000
. : milestone, 17727000,
profiling (15.094 s) : 15094000, 15094000
. : milestone, 15094000,
tracing (15.325 s) : 15325000, 15325000
. : milestone, 15325000,
|
What Does This Do
Keep a timestamp associated to the fingerprint to know when last time we capture snapshots for this exception. Hardcoded once an hour will probably make it a config token for this later
Motivation
Additional Notes
Jira ticket: DEBUG-2068