|
2 | 2 |
|
3 | 3 | import io.prometheus.client.CollectorRegistry;
|
4 | 4 |
|
5 |
| -import java.util.ArrayList; |
6 |
| -import java.util.Collections; |
7 |
| -import java.util.Enumeration; |
8 |
| -import java.util.HashMap; |
9 |
| -import java.util.List; |
10 |
| -import java.util.Map; |
11 |
| -import java.util.Objects; |
12 |
| -import java.util.Set; |
| 5 | +import java.util.*; |
13 | 6 | import java.util.function.Consumer;
|
14 | 7 | import java.util.function.Function;
|
15 | 8 | import java.util.stream.Collectors;
|
@@ -79,7 +72,7 @@ public static Function<List<Double>, Double> getConversionFunction(String update
|
79 | 72 | return MetricManagerUtils::division;
|
80 | 73 | case "mqobject_get_average_destructive_mqget_persistent_and_non_persistent_message_size_bytes":
|
81 | 74 | return MetricManagerUtils::averageSum;
|
82 |
| - case "mqobject_get_queue_queue_fill_percentage": |
| 75 | + case "mqobject_queue_queue_fill_percentage": |
83 | 76 | return MetricManagerUtils::divisionInPercentage;
|
84 | 77 | default:
|
85 | 78 | return MetricManagerUtils::defaultConversion;
|
@@ -124,19 +117,22 @@ public static Map<List<String>, List<Double>> getMetricsUsedToUpdate(Set<String>
|
124 | 117 | if (!arrayListDoubleMap.isEmpty()) mapWithValues.put(metricFamilySamples.name, arrayListDoubleMap);
|
125 | 118 | });
|
126 | 119 |
|
127 |
| - List<Map<List<String>, Double>> listWithValues = metricsNamesUsedToUpdate.stream() |
128 |
| - .map(mapWithValues::get) |
129 |
| - .collect(Collectors.toList()); |
130 | 120 | Map<List<String>, List<Double>> params = new HashMap<>();
|
131 |
| - listWithValues.forEach(l -> l.forEach((k, v) -> { |
132 |
| - if (!params.containsKey(k)) params.put(k, new ArrayList<>(Collections.singletonList(v))); |
133 |
| - else { |
134 |
| - List<Double> paramList = params.get(k); |
135 |
| - paramList.add(v); |
136 |
| - params.replace(k, paramList); |
| 121 | + |
| 122 | + if (mapWithValues.size() == metricsNamesUsedToUpdate.size()) { |
| 123 | + List<Map<List<String>, Double>> listWithValues = metricsNamesUsedToUpdate.stream() |
| 124 | + .map(mapWithValues::get) |
| 125 | + .collect(Collectors.toList()); |
| 126 | + listWithValues.forEach(l -> l.forEach((k, v) -> { |
| 127 | + if (!params.containsKey(k)) params.put(k, new ArrayList<>(Collections.singletonList(v))); |
| 128 | + else { |
| 129 | + List<Double> paramList = params.get(k); |
| 130 | + paramList.add(v); |
| 131 | + params.replace(k, paramList); |
| 132 | + } |
137 | 133 | }
|
138 |
| - } |
139 |
| - )); |
| 134 | + )); |
| 135 | + } |
140 | 136 | return params;
|
141 | 137 | }
|
142 | 138 |
|
|
0 commit comments