Skip to content

Commit

Permalink
Merge pull request #26871 from radcortez/fix-26216
Browse files Browse the repository at this point in the history
Additional check if Micrometer Metrics Tracer is available
  • Loading branch information
gsmet authored Jul 25, 2022
2 parents f0d0d92 + a12ca3c commit 093af57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.Set;
import java.util.function.BooleanSupplier;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
Expand Down Expand Up @@ -61,8 +62,19 @@ static class MetricsExtensionAvailable implements BooleanSupplier {

@Override
public boolean getAsBoolean() {
return IS_MICROMETER_EXTENSION_AVAILABLE && ConfigProvider.getConfig()
.getOptionalValue("quarkus.micrometer.binder.http-server.enabled", Boolean.class).orElse(true);
Config config = ConfigProvider.getConfig();
if (IS_MICROMETER_EXTENSION_AVAILABLE) {
if (config.getOptionalValue("quarkus.micrometer.enabled", Boolean.class).orElse(true)) {
Optional<Boolean> httpServerEnabled = config
.getOptionalValue("quarkus.micrometer.binder.http-server.enabled", Boolean.class);
if (httpServerEnabled.isPresent()) {
return httpServerEnabled.get();
} else {
return config.getOptionalValue("quarkus.micrometer.binder-enabled-default", Boolean.class).orElse(true);
}
}
}
return false;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
quarkus.micrometer.binder.http-server.enabled=false
quarkus.micrometer.enabled=true
quarkus.micrometer.binder-enabled-default=false

0 comments on commit 093af57

Please sign in to comment.