@@ -44,38 +44,147 @@ protected MetricsVerifier createMetricsVerifier() {
4444 "PS Survivor Space" );
4545 List <String > gcCollectionLabels = Arrays .asList ("PS MarkSweep" , "PS Scavenge" );
4646
47- MetricsVerifier metricsVerifier =
48- MetricsVerifier .create ()
49- .assertGauge ("jvm.classes.loaded" , "number of loaded classes" , "1" )
50- .assertTypedCounter (
51- "jvm.gc.collections.count" ,
52- "total number of collections that have occurred" ,
53- "1" ,
54- gcCollectionLabels )
55- .add (
56- "jvm.gc.collections.elapsed" ,
57- metric ->
58- metric
59- .hasDescription (
60- "the approximate accumulated collection elapsed time in milliseconds" )
61- .hasUnit ("ms" )
62- .isCounter ()
63- .hasTypedDataPoints (gcCollectionLabels ))
64- .assertGauge ("jvm.memory.heap.committed" , "current heap usage" , "by" )
65- .assertGauge ("jvm.memory.heap.init" , "current heap usage" , "by" )
66- .assertGauge ("jvm.memory.heap.max" , "current heap usage" , "by" )
67- .assertGauge ("jvm.memory.heap.used" , "current heap usage" , "by" )
68- .assertGauge ("jvm.memory.nonheap.committed" , "current non-heap usage" , "by" )
69- .assertGauge ("jvm.memory.nonheap.init" , "current non-heap usage" , "by" )
70- .assertGauge ("jvm.memory.nonheap.max" , "current non-heap usage" , "by" )
71- .assertGauge ("jvm.memory.nonheap.used" , "current non-heap usage" , "by" )
72- .assertTypedGauge (
73- "jvm.memory.pool.committed" , "current memory pool usage" , "by" , gcLabels )
74- .assertTypedGauge ("jvm.memory.pool.init" , "current memory pool usage" , "by" , gcLabels )
75- .assertTypedGauge ("jvm.memory.pool.max" , "current memory pool usage" , "by" , gcLabels )
76- .assertTypedGauge ("jvm.memory.pool.used" , "current memory pool usage" , "by" , gcLabels )
77- .assertGauge ("jvm.threads.count" , "number of threads" , "1" );
78-
79- return metricsVerifier ;
47+ return MetricsVerifier .create ()
48+ .add (
49+ "jvm.classes.loaded" ,
50+ metric ->
51+ metric
52+ .hasDescription ("number of loaded classes" )
53+ .hasUnit ("1" )
54+ .isGauge ()
55+ .hasDataPointsWithoutAttributes ())
56+ .add (
57+ "jvm.gc.collections.count" ,
58+ metric ->
59+ metric
60+ .hasDescription ("total number of collections that have occurred" )
61+ .hasUnit ("1" )
62+ .isCounter ()
63+ .hasTypedDataPoints (gcCollectionLabels ))
64+ .add (
65+ "jvm.gc.collections.elapsed" ,
66+ metric ->
67+ metric
68+ .hasDescription (
69+ "the approximate accumulated collection elapsed time in milliseconds" )
70+ .hasUnit ("ms" )
71+ .isCounter ()
72+ .hasTypedDataPoints (gcCollectionLabels ))
73+ .add (
74+ "jvm.memory.heap.committed" ,
75+ metric ->
76+ metric
77+ .hasDescription ("current heap usage" )
78+ .hasUnit ("by" )
79+ .isGauge ()
80+ .hasDataPointsWithoutAttributes ())
81+ .add (
82+ "jvm.memory.heap.init" ,
83+ metric ->
84+ metric
85+ .hasDescription ("current heap usage" )
86+ .hasUnit ("by" )
87+ .isGauge ()
88+ .hasDataPointsWithoutAttributes ())
89+ .add (
90+ "jvm.memory.heap.max" ,
91+ metric ->
92+ metric
93+ .hasDescription ("current heap usage" )
94+ .hasUnit ("by" )
95+ .isGauge ()
96+ .hasDataPointsWithoutAttributes ())
97+ .add (
98+ "jvm.memory.heap.used" ,
99+ metric ->
100+ metric
101+ .hasDescription ("current heap usage" )
102+ .hasUnit ("by" )
103+ .isGauge ()
104+ .hasDataPointsWithoutAttributes ())
105+ .add (
106+ "jvm.memory.nonheap.committed" ,
107+ metric ->
108+ metric
109+ .hasDescription ("current non-heap usage" )
110+ .hasUnit ("by" )
111+ .isGauge ()
112+ .hasDataPointsWithoutAttributes ())
113+ .add (
114+ "jvm.memory.nonheap.init" ,
115+ metric ->
116+ metric
117+ .hasDescription ("current non-heap usage" )
118+ .hasUnit ("by" )
119+ .isGauge ()
120+ .hasDataPointsWithoutAttributes ())
121+ .add (
122+ "jvm.memory.nonheap.max" ,
123+ metric ->
124+ metric
125+ .hasDescription ("current non-heap usage" )
126+ .hasUnit ("by" )
127+ .isGauge ()
128+ .hasDataPointsWithoutAttributes ())
129+ .add (
130+ "jvm.memory.nonheap.used" ,
131+ metric ->
132+ metric
133+ .hasDescription ("current non-heap usage" )
134+ .hasUnit ("by" )
135+ .isGauge ()
136+ .hasDataPointsWithoutAttributes ())
137+ .add (
138+ "jvm.memory.pool.committed" ,
139+ metric ->
140+ metric
141+ .hasDescription ("current memory pool usage" )
142+ .hasUnit ("by" )
143+ .isGauge ()
144+ .hasTypedDataPoints (gcLabels ))
145+ .add (
146+ "jvm.memory.pool.init" ,
147+ metric ->
148+ metric
149+ .hasDescription ("current memory pool usage" )
150+ .hasUnit ("by" )
151+ .isGauge ()
152+ .hasTypedDataPoints (gcLabels ))
153+ .add (
154+ "jvm.memory.pool.max" ,
155+ metric ->
156+ metric
157+ .hasDescription ("current memory pool usage" )
158+ .hasUnit ("by" )
159+ .isGauge ()
160+ .hasTypedDataPoints (gcLabels ))
161+ .add (
162+ "jvm.memory.pool.used" ,
163+ metric ->
164+ metric
165+ .hasDescription ("current memory pool usage" )
166+ .hasUnit ("by" )
167+ .isGauge ()
168+ .hasTypedDataPoints (gcLabels ))
169+ .add (
170+ "jvm.threads.count" ,
171+ metric ->
172+ metric
173+ .hasDescription ("number of threads" )
174+ .hasUnit ("1" )
175+ .isGauge ()
176+ .hasDataPointsWithoutAttributes ());
80177 }
178+
179+ /*
180+ List<String> gcLabels =
181+ Arrays.asList(
182+ "Code Cache",
183+ "PS Eden Space",
184+ "PS Old Gen",
185+ "Metaspace",
186+ "Compressed Class Space",
187+ "PS Survivor Space");
188+ List<String> gcCollectionLabels = Arrays.asList("PS MarkSweep", "PS Scavenge");
189+ */
81190}
0 commit comments