micrometer-metrics/micrometer

Native image config for netty in statsd module is not relocated during shading

Open

#3,212 创建于 2022年6月9日

在 GitHub 查看
 (7 评论) (0 反应) (0 负责人)Java (935 fork)batch import
bughelp wantedregistry: statsdtheme: native-imagewaiting for feedback

仓库指标

Star
 (4,220 star)
PR 合并指标
 (平均合并 1天 21小时) (30 天内合并 100 个 PR)

描述

statsd module uses a shaded netty that makes its packages io.micrometer.shaded.io.netty, and none of the standard native hints apply.

So far, I had to add (using spring-native) the following to get the app to start at least:

@NativeHint( // Micrometer
        types = @TypeHint(
                access = {TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS, TypeAccess.DECLARED_METHODS},
                typeNames = "io.micrometer.shaded.io.netty.buffer.AbstractByteBufAllocator"
        )
)
@NativeHint(
        types = {
                @TypeHint(
                        typeNames = "io.micrometer.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields",
                        fields = @FieldHint(name = "producerLimit", allowUnsafeAccess = true)
                ),
                @TypeHint(
                        typeNames = "io.micrometer.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields",
                        fields = @FieldHint(name = "consumerIndex", allowUnsafeAccess = true)
                ),
                @TypeHint(
                        typeNames = "io.micrometer.shaded.io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields",
                        fields = @FieldHint(name = "producerIndex", allowUnsafeAccess = true)
                ),
                @TypeHint(
                        typeNames = "io.micrometer.shaded.io.netty.util.ReferenceCountUtil",
                        methods = @MethodHint(name = "touch", parameterTypes = {Object.class})
                )
        }
)

But I might have to add more as I keep testing it.

贡献者指南