Skip to content

Commit

Permalink
Use MP config directly instead of SE config to avoid GraalVM issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tjquinno committed Nov 27, 2024
1 parent e354ab7 commit 16d347a
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import java.util.Set;

import io.helidon.common.LazyValue;
import io.helidon.common.config.GlobalConfig;

import jakarta.enterprise.inject.spi.CDI;
import jakarta.ws.rs.Priorities;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import org.eclipse.microprofile.rest.client.spi.RestClientListener;

Expand Down Expand Up @@ -52,9 +52,15 @@ private static class Listener {
private final RestClientMetricsFilter restClientMetricsFilter;

private final LazyValue<RestClientMetricsConfig> restClientMetricsConfig =
LazyValue.create(() -> RestClientMetricsConfig.create(
GlobalConfig.config()
.get(RestClientMetricsFilter.REST_CLIENT_METRICS_CONFIG_KEY)));
LazyValue.create(() -> {
boolean enabled = ConfigProvider.getConfig()
.getOptionalValue(RestClientMetricsFilter.REST_CLIENT_METRICS_CONFIG_KEY
+ ".enabled", Boolean.class)
.orElse(true);
return RestClientMetricsConfig.builder()
.enabled(enabled)
.build();
});

private final LazyValue<RestClientMetricsCdiExtension> ext =
LazyValue.create(() -> CDI.current().getBeanManager().getExtension(RestClientMetricsCdiExtension.class));
Expand Down

0 comments on commit 16d347a

Please sign in to comment.