Skip to content

Commit

Permalink
[WFLY-19583-addendum] Deployment-related undertow metrics are not exp…
Browse files Browse the repository at this point in the history
…orted

Fix test non-assertion
  • Loading branch information
jasondlee committed Aug 7, 2024
1 parent 80beb54 commit 0d98009
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,13 @@ public void getMetrics() throws InterruptedException {
final List<PrometheusMetric> metrics = otelCollector.fetchMetrics(metricsToTest.get(0));
metricsToTest.forEach(n -> Assert.assertTrue("Missing metric: " + n,
metrics.stream().anyMatch(m -> m.getKey().startsWith(n))));
}

Map<String, PrometheusMetric> appMetrics =
metrics.stream().filter(m -> m.getTags().entrySet().stream()
.anyMatch(t -> "app".equals(t.getKey()) && DEPLOYMENT_NAME.equals(t.getValue()))
)
.collect(Collectors.toMap(PrometheusMetric::getKey, i -> i));

List.of(
@Test
@RunAsClient
@InSequence(5)
public void testApplicationModelMetrics() throws InterruptedException {
List<String> metricsToTest = List.of(
"undertow_active_sessions",
"undertow_expired_sessions_total",
"undertow_highest_session_count",
Expand All @@ -116,9 +115,20 @@ public void getMetrics() throws InterruptedException {
"undertow_session_avg_alive_time_seconds",
"undertow_session_max_alive_time_seconds",
"undertow_sessions_created_total"
).forEach(appMetrics::containsKey);
);
final List<PrometheusMetric> metrics = otelCollector.fetchMetrics(metricsToTest.get(0));

Map<String, PrometheusMetric> appMetrics =
metrics.stream().filter(m -> m.getTags().entrySet().stream()
.anyMatch(t -> "app".equals(t.getKey()) && DEPLOYMENT_NAME.equals(t.getValue()))
)
.collect(Collectors.toMap(PrometheusMetric::getKey, i -> i));

metricsToTest.forEach(m -> Assert.assertTrue("Missing app metric: " + m, appMetrics.containsKey(m)));
}



@Test
@InSequence(5)
public void testJmxMetrics() throws InterruptedException {
Expand Down

0 comments on commit 0d98009

Please sign in to comment.