fstab / promagent

Prometheus Monitoring for Java Web Applications without Modifying their Source Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Here's a question that promagent can not work @Controller

javazhangyi opened this issue · comments

Here's a question that promagent can not work @Controller

it's show that “org.springframework.web.util.NestedServletException: Handler dispatch failed“,

i konw that spring classloader can not find class AnnotateInterceptor.class , this is my code

private static AgentBuilder applyHooks(AgentBuilder agentBuilder, SortedSet<HookMetadata> hookMetadata, ClassLoaderCache classLoaderCache) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        return agentBuilder.type(isAnnotatedWith(named("org.springframework.stereotype.Controller")))
                .transform(new AgentBuilder.Transformer() {
                    @Override
                    public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDescription typeDescription,
                                                            ClassLoader classLoader, JavaModule javaModule) {
                        return  builder
                                .method(ElementMatchers.any())
                                .intercept(MethodDelegation.to(AnnotateInterceptor.class));
                    }
                });

it's resource E:\Users\zhangyi_m\promagent3\promagent\promagent-framework\promagent-internal\src\main\java\io\promagent\internal\Promagent.java

i can‘t the better way to solve the problem