Skip to content

Commit

Permalink
Properly perform reflection registration for @Gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Apr 12, 2023
1 parent 68e6c86 commit 9f6dffb
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveMethodBuildItem;
import io.quarkus.deployment.logging.LogCleanupFilterBuildItem;
import io.quarkus.deployment.metrics.MetricsCapabilityBuildItem;
import io.quarkus.deployment.metrics.MetricsFactoryConsumerBuildItem;
Expand Down Expand Up @@ -286,10 +285,12 @@ public void transform(TransformationContext context) {
*/
@BuildStep
void reflectiveMethodsWithGauges(BeanArchiveIndexBuildItem beanArchiveIndex,
BuildProducer<ReflectiveMethodBuildItem> reflectiveMethods) {
BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
for (AnnotationInstance annotation : beanArchiveIndex.getIndex().getAnnotations(GAUGE)) {
if (annotation.target().kind().equals(AnnotationTarget.Kind.METHOD)) {
reflectiveMethods.produce(new ReflectiveMethodBuildItem(annotation.target().asMethod()));
reflectiveClass.produce(
ReflectiveClassBuildItem.builder(annotation.target().asMethod().declaringClass().name().toString())
.methods(true).constructors(true).build());
}
}
}
Expand Down

0 comments on commit 9f6dffb

Please sign in to comment.