DEV Community

Query Filter
Query Filter

Posted on

bridge53

new AgentBuilder.Default()
    // 1. CRITICAL: This allows ByteBuddy to modify classes already in the JVM memory
    .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)

    // 2. Optional: Helps troubleshoot why some classes might be skipped
    .with(AgentBuilder.Listener.StreamWriting.toSystemOut()) 

    .type(typeDescription -> targetClassSet.contains(typeDescription.getName()))
    .transform((builder, typeDescription, classLoader, module) ->
        builder.method(ElementMatchers.any()
                .and(ElementMatchers.not(ElementMatchers.isAbstract()))
                .and(ElementMatchers.not(ElementMatchers.isNative())))
                .intercept(Advice.to(ProfilerAdvice.class))
    )
    .installOn(inst);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)