@@ -96,14 +96,16 @@ private static void collectCompilerStatistics(Registry registry, RecordingStream
96
96
}
97
97
98
98
private static void collectThreadStatistics (Registry registry , RecordingStream rs ) {
99
+ Gauge nonDaemonThreadCount = registry .gauge ("jvm.thread.threadCount" , "id" , "non-daemon" );
100
+ Gauge daemonThreadCount = registry .gauge ("jvm.thread.threadCount" , "id" , "daemon" );
99
101
Counter threadsStarted = registry .counter ("jvm.thread.threadsStarted" );
100
102
AtomicLong prevAccumulatedCount = new AtomicLong ();
101
103
consume (JavaThreadStatistics , rs , event -> {
102
104
long activeCount = event .getLong ("activeCount" );
103
105
long daemonCount = event .getLong ("daemonCount" );
104
106
long nonDaemonCount = activeCount - daemonCount ;
105
- registry . gauge ( "jvm.thread.threadCount" , "id" , "non-daemon" ) .set (nonDaemonCount );
106
- registry . gauge ( "jvm.thread.threadCount" , "id" , "daemon" ) .set (daemonCount );
107
+ nonDaemonThreadCount .set (nonDaemonCount );
108
+ daemonThreadCount .set (daemonCount );
107
109
long accumulatedCount = event .getLong ("accumulatedCount" );
108
110
accumulatedCount = accumulatedCount - prevAccumulatedCount .getAndSet (accumulatedCount );
109
111
threadsStarted .increment (accumulatedCount );
@@ -126,8 +128,8 @@ private static void collectGcEvents(Registry registry, RecordingStream rs) {
126
128
// ZGC and Shenandoah are not covered by the generic event, there is
127
129
// a ZGC specific event to get coverage there, right now there doesn't
128
130
// appear to be similar data available for Shenandoah
129
- Gauge tenuringThreshold = registry .gauge ("jvm.gc.tenuringThreshold" );
130
- Consumer <RecordedEvent > tenuringThresholdFn = event ->
131
+ Gauge tenuringThreshold = registry .gauge ("jvm.gc.tenuringThreshold" );
132
+ Consumer <RecordedEvent > tenuringThresholdFn = event ->
131
133
tenuringThreshold .set (event .getLong ("tenuringThreshold" ));
132
134
consume (YoungGarbageCollection , rs , tenuringThresholdFn );
133
135
consume (ZYoungGarbageCollection , rs , tenuringThresholdFn );
0 commit comments