pinpoint agent not instrument simple dubbo consumer

Created on 5 Jan 2018  路  3Comments  路  Source: pinpoint-apm/pinpoint

hi , A weird thing happened to me when i tried to apply pinpoint to a simple dubbo consumer. Dubbo provider is ok. Agent didn't trace the dubbo consumer , just recognize it as remote user . Below is my simple code of simple consumer . what happen?

public class AppLauncher
{
    public static void main(String[] args)
    {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:META-INF/spring/dubbo-consumer.xml");
        context.start();
        log.info("Consumer start.");
        DemoService demoService = (DemoService) context.getBean("DemoService");


        while (true)
        {
            double random = Math.random();

            int sleepTime = (int) (random * 1000);

            try
            {
                Thread.sleep(sleepTime);
            }
            catch (InterruptedException e)
            {
                e.printStackTrace();
            }

           // log.info("Get value from server: {}", demoService.getValue("ip"));


        }
    }
}
question stale

Most helpful comment

@08s011003
Hi, I have found the same problem.. I read the dubbo' plugin source code, then I found that the Trace is generated by the Provider Interceptor, not the Consumer Interceptor. So the agent didn't trace the dubbo Consumer.

I think only when the request is incoming, the agent will generate the Trace, such as tomcat , jetty...

In your test code, you can run 2 apps. 1st is not only the provider but also the consumer, 2nd is only the provider. 2nd is called by 1st, then you will find the agent works normally.

All 3 comments

@08s011003
Hi, I have found the same problem.. I read the dubbo' plugin source code, then I found that the Trace is generated by the Provider Interceptor, not the Consumer Interceptor. So the agent didn't trace the dubbo Consumer.

I think only when the request is incoming, the agent will generate the Trace, such as tomcat , jetty...

In your test code, you can run 2 apps. 1st is not only the provider but also the consumer, 2nd is only the provider. 2nd is called by 1st, then you will find the agent works normally.

Hi @08s011003
It's been a while but to add to what @yanpeng-ali have said,

The consumer code provided by your code above will not generate any trace consumer-side. This is because for any trace to start, it needs an "entry point".
The "entry point" is usually defined and handled by interceptors for methods that accept RPCs such as WAS plugins, Thrift plugin, or Dubbo plugin (dubbo provider interceptor is one such example).

Back to your code above, the reason why your consumer is not getting traced is because it doesn't have an "entry point" in which to start a trace.
It seems like a new trace should start when demoService.getValue(...) method is called, but there is no way for the agent to know this automatically.
So you must tell the agent that demoService.getValue(...) is an entry point, and that it should generate a new trace whenever it is invoked.

You can specify custom entry points by setting profiler.entrypoint in pinpoint.config, for example,

profiler.entrypoint=x.x.x.DemoService.getValue

Let me know if you've more questions.
Thanks.

This issue/proposal has been automatically marked as stale because it hasn't had any recent activity. It will automatically be closed if no further activity occurs for 20days. If you think this should still be open, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for your interest and contribution to the Pinpoint Community.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VidushaZ picture VidushaZ  路  6Comments

zilingliyu picture zilingliyu  路  4Comments

balotelli1011 picture balotelli1011  路  4Comments

igo3r picture igo3r  路  3Comments

duwupeng picture duwupeng  路  4Comments