Open Telemetry Extension – WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher: Instrumentation skipped & Missing class

I have created an Open Telemetry instrument extension (following this) to trace all method call to any interfaces in a package. However the interface method is not traced by OTEL.

This is the InstrumentationModule class:

@AutoService(InstrumentationModule.class)
public class JMoquiInterfacesInstrumentationModule  extends InstrumentationModule {

    protected final static Logger logger = LoggerFactory.getLogger(JMoquiInterfacesInstrumentationModule.class);

    public JMoquiInterfacesInstrumentationModule() {
        super("jmoqui-demo", "jmoqui-99");
        logger.info("JMoquiInterfacesInstrumentationModule instantiated");
    }

    /*
    We want this instrumentation to be applied after the standard servlet instrumentation.
    The latter creates a server span around http request.
    This instrumentation needs access to that server span.
     */
    @Override
    public int order() {
        return 1;
    }

    @Override
    public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
        return AgentElementMatchers.hasClassesNamed("org.moqui.Moqui");
    }

    @Override
    public List<TypeInstrumentation> typeInstrumentations() {
        return singletonList(new JMoquiInterfacesInstrumentation());
    }
}

And this is the custom TypeInstrumentation class:

public class JMoquiInterfacesInstrumentation implements TypeInstrumentation {

    protected final static Logger logger = LoggerFactory.getLogger(JMoquiInterfacesInstrumentation.class);

    @Override
    public ElementMatcher<TypeDescription> typeMatcher() {
        logger.info("typeMatcher");
        return AgentElementMatchers.implementsInterface(
                new NameMatcher<>(new StringMatcher("org.moqui", StringMatcher.Mode.STARTS_WITH) {
                    @Override
                    protected boolean doMatch(String target) {
                        boolean match = super.doMatch(target);
                        if (match) logger.info("doMatch, match: {}", target);
                        return match;
                    }
                })
        );
    }

    @Override
    public void transform(TypeTransformer typeTransformer) {
        logger.info("transform");
        typeTransformer.applyAdviceToMethod(
                any(),
                this.getClass().getName() + "$JMoquiItfAdvice");
    }

    @SuppressWarnings("unused")
    public static class JMoquiItfAdvice {

        protected final static Logger logger = LoggerFactory.getLogger(JMoquiItfAdvice.class);
        private static final Tracer tracer = GlobalOpenTelemetry.getTracer("method-call-tracer");

        @Advice.OnMethodEnter
        public static void onEnter(@Advice.Origin String method) {
            logger.info("onEnter: {}", method);
            Span span = tracer.spanBuilder(method).startSpan();
            span.makeCurrent();
        }

        @Advice.OnMethodExit(onThrowable = Throwable.class)
        public static void onExit(@Advice.Thrown Throwable throwable) {
            Span span = Span.current();
            if (throwable != null) {
                span.recordException(throwable);
            }
            logger.info("onExit");
            span.end();
        }
    }
}

However the onEnter and onExit never printed. After activating otel debug, this WARN showed:

00:35:03.651 [main] INFO com.example.javaagent.instrumentation.JMoquiInterfacesInstrumentation -- doMatch, match: org.moqui.context.L10nFacade
00:35:03.651 [main] INFO com.example.javaagent.instrumentation.JMoquiInterfacesInstrumentation -- doMatch, match: org.moqui.context.LogEventSubscriber
[otel.javaagent 2024-07-15 00:35:03:636 +0800] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - Instrumentation skipped, mismatched references were found: jmoqui-demo [class com.example.javaagent.instrumentation.JMoquiInterfacesInstrumentationModule] on jdk.internal.loader.ClassLoaders$AppClassLoader@76ed5528
[otel.javaagent 2024-07-15 00:35:03:636 +0800] [main] WARN io.opentelemetry.javaagent.tooling.instrumentation.MuzzleMatcher - -- com.example.javaagent.instrumentation.JMoquiInterfacesInstrumentation$JMoquiItfAdvice:0 Missing class com.example.javaagent.instrumentation.JMoquiInterfacesInstrumentation$JMoquiItfAdvice
00:35:03.667 [main] INFO com.example.javaagent.instrumentation.JMoquiInterfacesInstrumentation -- doMatch, match: org.moqui.context.LoggerFacade
00:35:03.667 [main] INFO com.example.javaagent.instrumentation.JMoquiInterfacesInstrumentation -- doMatch, match: org.moqui.context.MessageFacade

The logs from JMoquiInterfacesInstrumentation are correctly shown, however JMoquiInterfacesInstrumentation.JMoquiItfAdvice class is reported missing.

The questions are:

  1. How to fix the missing class?
  2. The “method-call-tracer” on JMoquiItfAdvice is copied over from the example. How does “method-call-tracer” suddenly exists, what does it signifies?
private static final Tracer tracer = GlobalOpenTelemetry.getTracer("method-call-tracer");

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật