31
31
import java .io .IOException ;
32
32
import java .io .StringWriter ;
33
33
import java .io .Writer ;
34
+ import java .util .ArrayList ;
34
35
import java .util .Enumeration ;
35
- import java .util .LinkedList ;
36
36
import java .util .List ;
37
37
import java .util .Set ;
38
38
import java .util .concurrent .ConcurrentHashMap ;
@@ -194,12 +194,12 @@ public DistributionSummary newDistributionSummary(Meter.Id id, DistributionStati
194
194
double count = summary .count ();
195
195
196
196
if (percentileValues .length > 0 ) {
197
- List <String > quantileKeys = new LinkedList <>(tagKeys );
197
+ List <String > quantileKeys = new ArrayList <>(tagKeys );
198
198
quantileKeys .add ("quantile" );
199
199
200
200
// satisfies https://prometheus.io/docs/concepts/metric_types/#summary
201
201
for (ValueAtPercentile v : percentileValues ) {
202
- List <String > quantileValues = new LinkedList <>(tagValues );
202
+ List <String > quantileValues = new ArrayList <>(tagValues );
203
203
quantileValues .add (Collector .doubleToGoString (v .percentile ()));
204
204
samples .add (new Collector .MetricFamilySamples .Sample (
205
205
conventionName , quantileKeys , quantileValues , v .value ()));
@@ -211,23 +211,23 @@ public DistributionSummary newDistributionSummary(Meter.Id id, DistributionStati
211
211
// Prometheus doesn't balk at a metric being BOTH a histogram and a summary
212
212
type = Collector .Type .HISTOGRAM ;
213
213
214
- List <String > histogramKeys = new LinkedList <>(tagKeys );
214
+ List <String > histogramKeys = new ArrayList <>(tagKeys );
215
215
String sampleName = conventionName + "_bucket" ;
216
216
switch (summary .histogramFlavor ()) {
217
217
case Prometheus :
218
218
histogramKeys .add ("le" );
219
219
220
220
// satisfies https://prometheus.io/docs/concepts/metric_types/#histogram
221
221
for (CountAtBucket c : histogramCounts ) {
222
- final List <String > histogramValues = new LinkedList <>(tagValues );
222
+ final List <String > histogramValues = new ArrayList <>(tagValues );
223
223
histogramValues .add (Collector .doubleToGoString (c .bucket ()));
224
224
samples .add (new Collector .MetricFamilySamples .Sample (
225
225
sampleName , histogramKeys , histogramValues , c .count ()));
226
226
}
227
227
228
228
if (Double .isFinite (histogramCounts [histogramCounts .length - 1 ].bucket ())) {
229
229
// the +Inf bucket should always equal `count`
230
- final List <String > histogramValues = new LinkedList <>(tagValues );
230
+ final List <String > histogramValues = new ArrayList <>(tagValues );
231
231
histogramValues .add ("+Inf" );
232
232
samples .add (new Collector .MetricFamilySamples .Sample (
233
233
sampleName , histogramKeys , histogramValues , count ));
@@ -237,7 +237,7 @@ public DistributionSummary newDistributionSummary(Meter.Id id, DistributionStati
237
237
histogramKeys .add ("vmrange" );
238
238
239
239
for (CountAtBucket c : histogramCounts ) {
240
- final List <String > histogramValuesVM = new LinkedList <>(tagValues );
240
+ final List <String > histogramValuesVM = new ArrayList <>(tagValues );
241
241
histogramValuesVM .add (FixedBoundaryVictoriaMetricsHistogram .getRangeTagValue (c .bucket ()));
242
242
samples .add (new Collector .MetricFamilySamples .Sample (
243
243
sampleName , histogramKeys , histogramValuesVM , c .count ()));
@@ -336,13 +336,13 @@ protected Meter newMeter(Meter.Id id, Meter.Type type, Iterable<Measurement> mea
336
336
applyToCollector (id , (collector ) -> {
337
337
List <String > tagValues = tagValues (id );
338
338
collector .add (tagValues , (conventionName , tagKeys ) -> {
339
- List <String > statKeys = new LinkedList <>(tagKeys );
339
+ List <String > statKeys = new ArrayList <>(tagKeys );
340
340
statKeys .add ("statistic" );
341
341
342
342
return Stream .of (new MicrometerCollector .Family (finalPromType , conventionName ,
343
343
stream (measurements .spliterator (), false )
344
344
.map (m -> {
345
- List <String > statValues = new LinkedList <>(tagValues );
345
+ List <String > statValues = new ArrayList <>(tagValues );
346
346
statValues .add (m .getStatistic ().toString ());
347
347
348
348
String name = conventionName ;
@@ -393,12 +393,12 @@ private void addDistributionStatisticSamples(DistributionStatisticConfig distrib
393
393
double count = histogramSnapshot .count ();
394
394
395
395
if (percentileValues .length > 0 ) {
396
- List <String > quantileKeys = new LinkedList <>(tagKeys );
396
+ List <String > quantileKeys = new ArrayList <>(tagKeys );
397
397
quantileKeys .add ("quantile" );
398
398
399
399
// satisfies https://prometheus.io/docs/concepts/metric_types/#summary
400
400
for (ValueAtPercentile v : percentileValues ) {
401
- List <String > quantileValues = new LinkedList <>(tagValues );
401
+ List <String > quantileValues = new ArrayList <>(tagValues );
402
402
quantileValues .add (Collector .doubleToGoString (v .percentile ()));
403
403
samples .add (new Collector .MetricFamilySamples .Sample (
404
404
conventionName , quantileKeys , quantileValues , v .value (TimeUnit .SECONDS )));
@@ -410,7 +410,7 @@ private void addDistributionStatisticSamples(DistributionStatisticConfig distrib
410
410
// Prometheus doesn't balk at a metric being BOTH a histogram and a summary
411
411
type = Collector .Type .HISTOGRAM ;
412
412
413
- List <String > histogramKeys = new LinkedList <>(tagKeys );
413
+ List <String > histogramKeys = new ArrayList <>(tagKeys );
414
414
415
415
String sampleName = conventionName + "_bucket" ;
416
416
switch (prometheusConfig .histogramFlavor ()) {
@@ -419,14 +419,14 @@ private void addDistributionStatisticSamples(DistributionStatisticConfig distrib
419
419
420
420
// satisfies https://prometheus.io/docs/concepts/metric_types/#histogram
421
421
for (CountAtBucket c : histogramCounts ) {
422
- final List <String > histogramValues = new LinkedList <>(tagValues );
422
+ final List <String > histogramValues = new ArrayList <>(tagValues );
423
423
histogramValues .add (Collector .doubleToGoString (c .bucket (TimeUnit .SECONDS )));
424
424
samples .add (new Collector .MetricFamilySamples .Sample (
425
425
sampleName , histogramKeys , histogramValues , c .count ()));
426
426
}
427
427
428
428
// the +Inf bucket should always equal `count`
429
- final List <String > histogramValues = new LinkedList <>(tagValues );
429
+ final List <String > histogramValues = new ArrayList <>(tagValues );
430
430
histogramValues .add ("+Inf" );
431
431
samples .add (new Collector .MetricFamilySamples .Sample (
432
432
sampleName , histogramKeys , histogramValues , count ));
@@ -435,7 +435,7 @@ private void addDistributionStatisticSamples(DistributionStatisticConfig distrib
435
435
histogramKeys .add ("vmrange" );
436
436
437
437
for (CountAtBucket c : histogramCounts ) {
438
- final List <String > histogramValuesVM = new LinkedList <>(tagValues );
438
+ final List <String > histogramValuesVM = new ArrayList <>(tagValues );
439
439
histogramValuesVM .add (FixedBoundaryVictoriaMetricsHistogram .getRangeTagValue (c .bucket ()));
440
440
samples .add (new Collector .MetricFamilySamples .Sample (
441
441
sampleName , histogramKeys , histogramValuesVM , c .count ()));
0 commit comments