Search code examples
javaistiojaeger

Application can not report to jaeger from istio container


My java code:

Class.forName("com.mysql.jdbc.Driver");
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:tracing:mysql://my-db:3306/my-db");
config.setUsername("user");
config.setPassword("pwd");
config.setDriverClassName("io.opentracing.contrib.jdbc.TracingDriver");
HikariDataSource ds = new HikariDataSource(config);

// some db operation

My gradle dependencies:

compile('io.opentracing.contrib:opentracing-jdbc:0.0.7')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework:spring-jdbc:5.0.8.RELEASE')
compile group: 'io.opentracing.contrib', name: 'opentracing-jdbc', version: '0.0.7'
compile('io.jaegertracing:jaeger-client:0.30.4')
compile group: 'org.springframework.boot', name: 'spring-boot-starter-logging', version: '2.0.4.RELEASE'
compile('com.zaxxer:HikariCP:3.1.0')
runtime('mysql:mysql-connector-java')
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
testCompile('org.springframework.boot:spring-boot-starter-test')

This code works in localhost.

I have already passed the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT env to the container.

And I can see the Jaeger Initialized log in remote:

Using the UDP Sender to send spans to the agent. Using sender UdpSender(udpTransport=ThriftUdpTransport(socket=java.net.DatagramSocket@27e16046, receiveBuf=null, receiveOffSet=-1, receiveLength=0)) Using sender UdpSender(udpTransport=ThriftUdpTransport(socket=java.net.DatagramSocket@27e16046, receiveBuf=null, receiveOffSet=-1, receiveLength=0)) 2018-08-16 13:24:32.809 INFO 1 --- [http-nio-8080-exec-1] io.jaegertracing.Configuration : Initialized tracer=JaegerTracer(version=Java-0.30.4, serviceName=

But I can see it in Jaeger UI.

And I tried to use tcpdump, I cannot find the udp package.


Solution

  • I resolved this. It related to the sample rate. After I configured the JAEGER_SAMPLER_TYPE and JAEGER_SAMPLER_PARAM, I can see the data.