quarkus: Intersection of Smallrye, MP Metrics and micrometer not working
Describe the bug When trying to call a method that uses a fault tolerance feature, @CircuitBreaker, for example, having the quarkus-micrometer in the pom.xml I get an exception:
java.lang.UnsupportedOperationException: Can not register a pre-constructed Metric with Micrometer at io.quarkus.micrometer.runtime.binder.mpmetrics.MetricRegistryAdapter.register(MetricRegistryAdapter.java:46) at io.smallrye.faulttolerance.metrics.MetricsCollectorFactory$MetricsCollectorImpl.gaugeRegister(MetricsCollectorFactory.java:79) at io.smallrye.faulttolerance.metrics.MetricsCollectorFactory$MetricsCollectorImpl.circuitBreakerClosedTimeProvider(MetricsCollectorFactory.java:164) at io.smallrye.faulttolerance.core.circuit.breaker.CircuitBreaker.<init>(CircuitBreaker.java:73) at io.smallrye.faulttolerance.FaultToleranceInterceptor.prepareSyncStrategy(FaultToleranceInterceptor.java:320) at io.smallrye.faulttolerance.FaultToleranceInterceptor.lambda$syncFlow$4(FaultToleranceInterceptor.java:202) at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705) at io.smallrye.faulttolerance.internal.StrategyCache.getStrategy(StrategyCache.java:23) at io.smallrye.faulttolerance.FaultToleranceInterceptor.syncFlow(FaultToleranceInterceptor.java:201) at io.smallrye.faulttolerance.FaultToleranceInterceptor.interceptCommand(FaultToleranceInterceptor.java:159) at io.smallrye.faulttolerance.FaultToleranceInterceptor_Bean.intercept(FaultToleranceInterceptor_Bean.zig:555) at org.jboss.resteasy.microprofile.client.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:154) at org.jboss.resteasy.microprofile.client.InvocationContextImpl.invokeNext(InvocationContextImpl.java:53) at org.jboss.resteasy.microprofile.client.InvocationContextImpl.proceed(InvocationContextImpl.java:89) at org.jboss.resteasy.microprofile.client.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:141)
To Reproduce
Will create soon.
Additional context
This issue is related to #12000 and per @ebullient :
That is one of those places we’ll have to sort out re: intersection of smallrye and MP Metrics and micrometer. Fault Tolerance is pre-creating an MP Meter (probably a Counter or a Gauge), instead of letting the registry create and return it. This will be a new issue, and may need a fix in Smallrye FT
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (22 by maintainers)
OK, I re-read it and I’ve got two things:
MetricRegistryImplwould implement in addition to the MP MetricsMetricRegistry. That should alleviate all compatibility concerns. I’d just make sure that the methods prescribed by that interface have unique names that don’t collide with future MP Metrics methods.