Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Quarkus BuildStep

$
0
0

I am trying to transform annotation data using BuildStep as stated on the link below

https://quarkus.io/guides/cdi-integration#annotations_transformer_build_item

However, i am not seeing any indication this is working. I can't verify during build time what is wrong and there is no change at runtime. Below is the sample code:

public class TestTelemetryBuilder {

@BuildStepAnnotationsTransformerBuildItem transform() {    return new AnnotationsTransformerBuildItem(new AnnotationsTransformer() {        @Override        public boolean appliesTo(final org.jboss.jandex.AnnotationTarget.Kind kind) {            return kind == org.jboss.jandex.AnnotationTarget.Kind.CLASS;        }        @Override        public void transform(final TransformationContext context) {            if ("io.quarkus.redis.datasource.value.ValueCommands"                    .equals(context.getTarget().asClass().name().toString())) {                List<MethodInfo> methods = context.getTarget().asClass().methods();                AnnotationInstance annot = AnnotationInstance.builder(DotName.createSimple("io.opentelemetry.instrumentation.annotations.WithSpan")).build();                methods.forEach(t -> t.annotations()                        .add(annot));            }        }    });}

}

I want to add the WithSpan annotation to all the methods on the Redis ValueCommands class whenever called. Does this work only when the class is injected? I tried with RedisDataSource which is injected but couldn't get it to work. Is there anything else i need to setup/configure?

Thank you in advance

SG


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>