Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use marker annotations for static/runtime init in MicrometerRecorder #42403

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading