Skip to content

Commit

Permalink
Merge pull request wildfly#18111 from jasondlee/WFLY-19583-addendum
Browse files Browse the repository at this point in the history
[WFLY-19583] Deployment-related undertow metrics are not exported
  • Loading branch information
bstansberry authored Aug 8, 2024
2 parents 6584b1b + 0d98009 commit 9441016
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 9441016

Please sign in to comment.