Skip to content

Commit 3c6e2c3

Browse files
sschupedroigor
authored andcommitted
15234 switch to micrometer metrics
1 parent b7d7268 commit 3c6e2c3

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

quarkus/deployment/pom.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@
7676
</dependency>
7777
<dependency>
7878
<groupId>io.quarkus</groupId>
79-
<artifactId>quarkus-smallrye-metrics-deployment</artifactId>
79+
<artifactId>quarkus-micrometer-deployment</artifactId>
80+
</dependency>
81+
<dependency>
82+
<groupId>io.quarkus</groupId>
83+
<artifactId>quarkus-micrometer-registry-prometheus-deployment</artifactId>
8084
</dependency>
8185
<dependency>
8286
<groupId>io.quarkus</groupId>

quarkus/runtime/pom.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@
7777
</dependency>
7878
<dependency>
7979
<groupId>io.quarkus</groupId>
80-
<artifactId>quarkus-smallrye-metrics</artifactId>
80+
<artifactId>quarkus-micrometer</artifactId>
81+
</dependency>
82+
<dependency>
83+
<groupId>io.quarkus</groupId>
84+
<artifactId>quarkus-micrometer-registry-prometheus</artifactId>
8185
</dependency>
8286
<dependency>
8387
<groupId>io.quarkus</groupId>

quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/KeycloakRecorder.java

-8
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333

3434
import org.hibernate.cfg.AvailableSettings;
3535
import org.infinispan.manager.DefaultCacheManager;
36-
import io.quarkus.smallrye.metrics.runtime.SmallRyeMetricsHandler;
37-
import io.vertx.core.Handler;
3836
import io.vertx.ext.web.RoutingContext;
3937

4038
import org.keycloak.Config;
@@ -116,12 +114,6 @@ public void run() {
116114
});
117115
}
118116

119-
public Handler<RoutingContext> createMetricsHandler(String path) {
120-
SmallRyeMetricsHandler metricsHandler = new SmallRyeMetricsHandler();
121-
metricsHandler.setMetricsPath(path);
122-
return metricsHandler;
123-
}
124-
125117
public HibernateOrmIntegrationRuntimeInitListener createUserDefinedUnitListener(String name) {
126118
return new HibernateOrmIntegrationRuntimeInitListener() {
127119
@Override

quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/MetricsPropertyMappers.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ private MetricsPropertyMappers(){}
1212
public static PropertyMapper[] getMetricsPropertyMappers() {
1313
return new PropertyMapper[] {
1414
fromOption(MetricsOptions.METRICS_ENABLED)
15-
.to("quarkus.smallrye-metrics.extensions.enabled")
15+
.to("quarkus.micrometer.enabled")
1616
.paramLabel(Boolean.TRUE + "|" + Boolean.FALSE)
1717
.build()
1818
};

quarkus/runtime/src/main/resources/application.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ quarkus.health.extensions.enabled=false
1010
quarkus.datasource.health.enabled=false
1111

1212
# Enables metrics from other extensions if metrics is enabled
13-
quarkus.datasource.metrics.enabled=${quarkus.smallrye-metrics.extensions.enabled}
13+
quarkus.datasource.metrics.enabled=${quarkus.micrometer.enabled}
1414

1515
# Default transaction timeout
1616
quarkus.transaction-manager.default-transaction-timeout=300

quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/MetricsDistTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ void testMetricsEndpointNotEnabled() {
4646
void testMetricsEndpoint() {
4747
when().get("/metrics").then()
4848
.statusCode(200)
49-
.body(containsString("base_gc_total"));
49+
.body(containsString("jvm_gc_"));
5050
}
5151

5252
@Test
5353
@Launch({ "start-dev", "--http-relative-path=/auth", "--metrics-enabled=true" })
5454
void testMetricsEndpointUsingRelativePath() {
5555
when().get("/auth/metrics").then()
5656
.statusCode(200)
57-
.body(containsString("base_gc_total"));
57+
.body(containsString("jvm_gc_"));
5858
}
5959

6060
@Test

quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/QuarkusPropertiesAutoBuildDistTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static class EnableQuarkusMetrics implements Consumer<KeycloakDistributio
167167
@Override
168168
public void accept(KeycloakDistribution distribution) {
169169
distribution.setManualStop(true);
170-
distribution.setQuarkusProperty("quarkus.smallrye-metrics.extensions.enabled","true");
170+
distribution.setQuarkusProperty("quarkus.micrometer.enabled","true");
171171
}
172172
}
173173
}

quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/QuarkusPropertiesDistTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void testUnknownQuarkusBuildTimePropertyApplied(LaunchResult result) {
126126
CLIResult cliResult = (CLIResult) result;
127127
cliResult.assertNoBuild();
128128
when().get("/metrics").then().statusCode(200)
129-
.body(containsString("vendor_hibernate_cache_query_plan_total"));
129+
.body(containsString("jvm_gc_"));
130130
}
131131

132132
public static class UpdateConsoleLogLevelToWarnFromQuarkusProps implements Consumer<KeycloakDistribution> {

0 commit comments

Comments
 (0)