@@ -90,36 +90,38 @@ void addThreadMetrics(List<MetricFamilySamples> sampleFamilies, Predicate<String
9090 threadBean .getTotalStartedThreadCount ()));
9191 }
9292
93- if (nameFilter .test (JVM_THREADS_DEADLOCKED )) {
94- sampleFamilies .add (
95- new GaugeMetricFamily (
96- JVM_THREADS_DEADLOCKED ,
97- "Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers" ,
98- nullSafeArrayLength (threadBean .findDeadlockedThreads ())));
99- }
93+ if (!NativeImageChecker .isGraalVmNativeImage ) {
94+ if (nameFilter .test (JVM_THREADS_DEADLOCKED )) {
95+ sampleFamilies .add (
96+ new GaugeMetricFamily (
97+ JVM_THREADS_DEADLOCKED ,
98+ "Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers" ,
99+ nullSafeArrayLength (threadBean .findDeadlockedThreads ())));
100+ }
100101
101- if (nameFilter .test (JVM_THREADS_DEADLOCKED_MONITOR )) {
102- sampleFamilies .add (
103- new GaugeMetricFamily (
104- JVM_THREADS_DEADLOCKED_MONITOR ,
105- "Cycles of JVM-threads that are in deadlock waiting to acquire object monitors" ,
106- nullSafeArrayLength (threadBean .findMonitorDeadlockedThreads ())));
107- }
102+ if (nameFilter .test (JVM_THREADS_DEADLOCKED_MONITOR )) {
103+ sampleFamilies .add (
104+ new GaugeMetricFamily (
105+ JVM_THREADS_DEADLOCKED_MONITOR ,
106+ "Cycles of JVM-threads that are in deadlock waiting to acquire object monitors" ,
107+ nullSafeArrayLength (threadBean .findMonitorDeadlockedThreads ())));
108+ }
108109
109- if (nameFilter .test (JVM_THREADS_STATE )) {
110- GaugeMetricFamily threadStateFamily = new GaugeMetricFamily (
111- JVM_THREADS_STATE ,
112- "Current count of threads by state" ,
113- Collections .singletonList ("state" ));
114-
115- Map <String , Integer > threadStateCounts = getThreadStateCountMap ();
116- for (Map .Entry <String , Integer > entry : threadStateCounts .entrySet ()) {
117- threadStateFamily .addMetric (
118- Collections .singletonList (entry .getKey ()),
119- entry .getValue ()
120- );
110+ if (nameFilter .test (JVM_THREADS_STATE )) {
111+ GaugeMetricFamily threadStateFamily = new GaugeMetricFamily (
112+ JVM_THREADS_STATE ,
113+ "Current count of threads by state" ,
114+ Collections .singletonList ("state" ));
115+
116+ Map <String , Integer > threadStateCounts = getThreadStateCountMap ();
117+ for (Map .Entry <String , Integer > entry : threadStateCounts .entrySet ()) {
118+ threadStateFamily .addMetric (
119+ Collections .singletonList (entry .getKey ()),
120+ entry .getValue ()
121+ );
122+ }
123+ sampleFamilies .add (threadStateFamily );
121124 }
122- sampleFamilies .add (threadStateFamily );
123125 }
124126 }
125127
0 commit comments