Skip to content

Commit

Permalink
Merge pull request #42403 from geoand/micrometer-markers
Browse files Browse the repository at this point in the history
Use marker annotations for static/runtime init in MicrometerRecorder
  • Loading branch information
geoand authored Aug 8, 2024
2 parents 53f837b + 21ac5fc commit 1703ccb
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.ShutdownContext;
import io.quarkus.runtime.annotations.Recorder;
import io.quarkus.runtime.annotations.RuntimeInit;
import io.quarkus.runtime.annotations.StaticInit;
import io.quarkus.runtime.metrics.MetricsFactory;

@Recorder
Expand All @@ -52,15 +54,15 @@ public class MicrometerRecorder {
public static String nonApplicationUri = "/q/";
public static String httpRootUri = "/";

/* STATIC_INIT */
@StaticInit
public RuntimeValue<MeterRegistry> createRootRegistry(MicrometerConfig config, String qUri, String httpUri) {
factory = new MicrometerMetricsFactory(config, Metrics.globalRegistry);
nonApplicationUri = qUri;
httpRootUri = httpUri;
return new RuntimeValue<>(Metrics.globalRegistry);
}

/* RUNTIME_INIT */
@RuntimeInit
public void configureRegistries(MicrometerConfig config,
Set<Class<? extends MeterRegistry>> registryClasses,
ShutdownContext context) {
Expand Down Expand Up @@ -263,7 +265,7 @@ static String getExceptionTag(Throwable throwable) {
return throwable.getCause().getClass().getSimpleName();
}

/* RUNTIME_INIT */
@RuntimeInit
public RuntimeValue<HttpBinderConfiguration> configureHttpMetrics(
boolean httpServerMetricsEnabled,
boolean httpClientMetricsEnabled,
Expand Down

0 comments on commit 1703ccb

Please sign in to comment.