Replies: 1 comment 1 reply
-
public ElementMatcher<TypeDescription> typeMatcher() {
return new ElementMatcher<TypeDescription>() {
@Override
public boolean matches(TypeDescription target) {
return target.getActualName().endsWith("foo");
}
};
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dmarkwat
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm in the process of evaluating another stack for instrumentation (pekko-grpc) and the type matching is proving somewhat challenging.
pekko-grpc uses gradle/sbt/maven plugins to generate classes, but the generated objects and classes don't share any runtime annotations or super types to hook into in the otel instrumentation. The result is resorting to matching on class name suffix...which as I discovered today isn't supported (I can imagine many reasons why).
So while I pursue upstreaming some meta types to make this simpler in the long-term (to be clear, there's no such guarantee I will get my wish), I want to ask what are the alternatives here? I've come up with a few but wondering if any of these would be suitable or if there are suggestions:
typeMatcher
to then chain the classes togethertypeMatcher
method which a) I don't know how to do off-hands, and b) feels slightly broken? (though please correct me if I'm wrong)(3) has some obvious pitfalls, (1) is pushing compile-time information up to the runtime which is counterintuitive when it's all known very literally at compile time (if instrumentation was all more granularly opt-in, I'd feel differently), and (2) may offer the best alternative I can conceive in this moment given the situation.
Thoughts? Suggestions?
Beta Was this translation helpful? Give feedback.
All reactions