Configuring Jaeger and Zipkin in Unified Agent

There are two OpenTracing input plug-ins supporting Zipkin and Jaeger protocols for any custom user apps to connect to OpenTracing service provided by IBM® Cloud App Management. When you deploy the Unified Agent, you need to specify some configuration parameter for Jaeger and Zipkin.

About this task

The Unified Agent as a Daemonset is installed in a namespace named UA, and there is a service named trace. For all Kubernetes applications, Unified Agent endpoints for OpenTracing can be found in the following table:
Table 1. Unified Agent endpoints for Open tracing
Protocols Endpoints
Jaeger http://trace.ua:14268/api/traces
Zipkin v1 http://trace.ua:9411/api/v1/spans
Zipkin v2 http://trace.ua:9411/api/v2/spans
Note: If the user application is not a Kubernetes app, replace trace.ua with the host name of Unified Agent.

The Unified Agent can also be used to connect existing tracing systems, for example, Istio trace to Opentracing.

To deploy the Unified Agent with Opentracing plug-ins, do the following steps:

Procedure

  1. Ensure you complete steps 1-3 as instructed in Installing and configuring the Unified Agent to deploy the Unified Agent.
  2. Specify the Zipkin listening port, default is 9411.
  3. Specify the Jaeger listening port, default is 14268.

Results

Jaeger and Zipkin is successfully installed and configured in Unified Agent.

What to do next

For normal user instrumented apps with Zipkin or Jaeger protocols, there are no special considerations to use Unified Agent plug-ins for OpenTracing except for specifying the target endpoint. For example, for most Jaeger users, the only task is to set environment variable JAEGER_ENDPOINT to define the Unified Agent endpoint for Jaeger and let all user code as is.
export JAEGER_ENDPOINT=http://trace.ua:14268/api/traces
To connect a Spring Boot application to OpenTracing with Unified Agent, do the following steps:
  1. Add the following dependencies into your pom.xml file:
    <dependency>
      <groupId>io.opentracing.contrib</groupId>
      <artifactId>opentracing-spring-web-autoconfigure</artifactId>
      <version>0.3.2</version>
    </dependency>
    
    <dependency>
      <groupId>io.jaegertracing</groupId>
      <artifactId>jaeger-core</artifactId>
      <version>0.34.0</version>
    </dependency>
  2. Add the following functions into the SpringBootApplication class:
    @Bean
    public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
      return restTemplateBuilder.build();
    }
    
    @Bean
    public io.opentracing.Tracer tracer() {
      SamplerConfiguration samplerConfig = SamplerConfiguration.fromEnv().withType(ConstSampler.TYPE).withParam(1);
      ReporterConfiguration reporterConfig = ReporterConfiguration.fromEnv().withLogSpans(true).withSender(
          Configuration.SenderConfiguration.fromEnv().withAgentHost("9.42.82.80").withAgentPort(null));
      Configuration config = new Configuration("MySpring").withSampler(samplerConfig).withReporter(reporterConfig);
      return config.getTracer();
    }