|
1 | 1 | /*
|
2 | 2 | **********************************************************************
|
3 |
| - * Copyright (c) 2022 Contributors to the Eclipse Foundation |
| 3 | + * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation |
4 | 4 | *
|
5 | 5 | * See the NOTICES file(s) distributed with this work for additional
|
6 | 6 | * information regarding copyright ownership.
|
@@ -303,28 +303,28 @@ public void testGcTimeMetrics() {
|
303 | 303 | String data = given().header(wantPromMetricsFormat).get("/metrics?scope=base").asString();
|
304 | 304 |
|
305 | 305 | Map<String, MiniMeta> baseNames = getExpectedMetadataFromXmlFile(MetricRegistry.BASE_SCOPE);
|
306 |
| - MiniMeta gcCountMetricMeta = baseNames.get("gc.time"); |
307 |
| - Set<String> expectedTags = gcCountMetricMeta.tags.keySet(); |
| 306 | + MiniMeta gcTimeMetricMeta = baseNames.get("gc.time"); |
| 307 | + Set<String> expectedTags = gcTimeMetricMeta.tags.keySet(); |
308 | 308 |
|
309 | 309 | String[] lines = data.split("\n");
|
310 | 310 |
|
311 | 311 | boolean found = false;
|
312 | 312 | for (String line : lines) {
|
313 | 313 | // explicitly check for the metric line wth value (i.e. the use of `{`)
|
314 |
| - if (line.contains("gc_time_seconds_total{")) { |
315 |
| - final Pattern gcTimeTotalPattern = Pattern.compile("(gc_time_seconds_total\\{.*?\\}) (\\d+\\.\\d+)"); |
316 |
| - assertThat("Line format should be gc_time_seconds_total\\{.*?\\} \\d+\\.\\d+", |
| 314 | + if (line.contains("gc_time_seconds{")) { |
| 315 | + final Pattern gcTimeTotalPattern = Pattern.compile("(gc_time_seconds\\{.*?\\}) (\\d+\\.\\d+)"); |
| 316 | + assertThat("Line format should be gc_time_seconds\\{.*?\\} \\d+\\.\\d+", |
317 | 317 | gcTimeTotalPattern.matcher(line).matches());
|
318 | 318 |
|
319 | 319 | final String metricID = gcTimeTotalPattern.matcher(line).replaceAll("$1");
|
320 |
| - final String tags = metricID.replaceAll("^gc_time_seconds_total\\{", "").replaceAll("\\}$", ""); |
| 320 | + final String tags = metricID.replaceAll("^gc_time_seconds\\{", "").replaceAll("\\}$", ""); |
321 | 321 |
|
322 | 322 | for (String expectedTag : expectedTags) {
|
323 | 323 | assertThat("The metric should contain a " + expectedTag + " tag", tags,
|
324 | 324 | containsString(expectedTag + "="));
|
325 | 325 | }
|
326 | 326 | final String value = gcTimeTotalPattern.matcher(line).replaceAll("$2");
|
327 |
| - Assert.assertTrue("gc.time.seconds.total value should be numeric and not negative", |
| 327 | + Assert.assertTrue("gc.time value should be numeric and not negative", |
328 | 328 | Double.valueOf(value).doubleValue() >= 0);
|
329 | 329 |
|
330 | 330 | found = true;
|
|
0 commit comments