Skip to content

Commit c314d52

Browse files
committed
Debug MetadataNormalisationTest
1 parent f36b049 commit c314d52

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.openjdk.jmc.common.item.IItemCollection;
77
import org.openjdk.jmc.common.item.IItemIterable;
88
import org.openjdk.jmc.common.item.IMemberAccessor;
9+
import org.openjdk.jmc.common.unit.IQuantity;
910
import org.openjdk.jmc.flightrecorder.jdk.JdkAttributes;
1011

1112
import java.lang.reflect.Constructor;
@@ -42,6 +43,29 @@ public void test() throws Exception {
4243
System.out.println(count);
4344
stopProfiler();
4445
IItemCollection executionSamples = verifyEvents("datadog.ExecutionSample");
46+
47+
// Check profiler counters for contention drops
48+
IItemCollection profilerCounters = verifyEvents("datadog.ProfilerCounter");
49+
long contentionDrops = 0;
50+
int countersNum = 0;
51+
for (IItemIterable counters : profilerCounters) {
52+
countersNum++;
53+
IMemberAccessor<String, IItem> nameAccessor = NAME.getAccessor(counters.getType());
54+
IMemberAccessor<IQuantity, IItem> countAccessor = COUNT.getAccessor(counters.getType());
55+
for (IItem item : counters) {
56+
String name = nameAccessor.getMember(item);
57+
if ("calltrace_storage_dropped_traces".equals(name)) {
58+
IQuantity value = countAccessor.getMember(item);
59+
if (value != null) {
60+
contentionDrops = value.longValue();
61+
break;
62+
}
63+
}
64+
}
65+
if (contentionDrops > 0) break;
66+
}
67+
assertTrue(contentionDrops > 0, "Contention drops should be non-zero");
68+
System.out.println("Contention drops detected: " + contentionDrops);
4569
Matcher[] forbiddenPatternMatchers = Stream.of(
4670
"MH.*0x[A-Fa-f0-9]{3}", // method handles
4771
"GeneratedConstructorAccessor\\d+",

0 commit comments

Comments
 (0)