Skip to content

Commit b6bbb97

Browse files
jbachorikclaude
andcommitted
test: read debug counters before stopProfiler to avoid clearStandby reset
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1cf8721 commit b6bbb97

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

ddprof-test/src/test/java/com/datadoghq/profiler/endpoints/EndpointTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public void testEndpoints() {
4040
// reject above size limit
4141
record(new Endpoint(0, UUID.randomUUID().toString(), UUID.randomUUID().toString()), false, sizeLimit);
4242

43+
Map<String, Long> debugCounters = profiler.getDebugCounters();
44+
assertEquals(endpoints.length, debugCounters.get("dictionary_endpoints_keys"));
4345
stopProfiler();
4446
IItemCollection events = verifyEvents("datadog.Endpoint");
4547
IAttribute<String> endpointAttribute = attr("endpoint", "endpoint", "endpoint",
@@ -64,8 +66,6 @@ public void testEndpoints() {
6466
for (int i = 0; i < endpoints.length; i++) {
6567
assertTrue(recovered.get(i), i + " not tested");
6668
}
67-
Map<String, Long> debugCounters = profiler.getDebugCounters();
68-
assertEquals(endpoints.length, debugCounters.get("dictionary_endpoints_keys"));
6969
assertEquals(Arrays.stream(endpoints).mapToInt(ep -> ep.endpoint.length() + 1).sum(), debugCounters.get("dictionary_endpoints_keys_bytes"));
7070
assertBoundedBy(debugCounters.get("dictionary_endpoints_pages"), 300, "endpoint storage too many pages");
7171
assertBoundedBy(debugCounters.get("dictionary_endpoints_bytes"), 300 * DICTIONARY_PAGE_SIZE, "endpoint storage too many pages");

ddprof-test/src/test/java/com/datadoghq/profiler/metadata/DictionaryRotationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ public void dumpCycleSeparatesPreAndPostDumpEntries() throws Exception {
6969
profiler.recordTraceRoot(preDump.length + i, postDump[i], null, sizeLimit);
7070
}
7171

72-
stopProfiler();
73-
7472
// Live counter reflects only post-dump insertions
7573
Map<String, Long> live = profiler.getDebugCounters();
7674
assertEquals((long) postDump.length, live.get("dictionary_endpoints_keys"),
7775
"Live counter must equal number of post-dump endpoints");
7876

77+
stopProfiler();
78+
7979
// Snapshot contains pre-dump endpoints only
8080
Set<String> inSnapshot = endpointNames(verifyEvents(snapshot, "datadog.Endpoint", true));
8181
for (String ep : preDump) {

0 commit comments

Comments
 (0)