Basic introduction

There are many servers that support OpenTracing, and we will always choose one. In this case, jaeger. Jaeger development is more active and supports more client implementations. With Golang development, the distribution package is also relatively simple.

Jaeger’s website is www.jaegertracing.io/

The characteristics of

Jaeger supports a variety of clients, including Go, Java, Node, Python, C++, etc. Jaeger supports udp protocol transmission. HTTP is also supportedCopy the code

Jaeger can solve the following problems

Distributed transaction monitoring performance analysis and performance optimization call chain, find root cause problem Service dependency analysis (big data analysis required)Copy the code

Technical stacks to know for installation:

OpenTracing Golang ElasticSearch Kafka (Optional)Copy the code

The installation

download

Jaeger is a binary distribution that can be downloaded using wget. Here, the Linux version is used as an example.

Wget -c https://github.com/jaegertracing/jaeger/releases/download/v1.11.0/jaeger-1.11.0-linux-amd64.tar.gzCopy the code

Jaeger’s binary distribution contains five binaries:

jaeger-agent
jaeger-collector
jaeger-query
jaeger-standalone
jaeger-ingester	
Copy the code

If you do not have the execution permission, you can use this command

chmod a+x jaeger-*
Copy the code

Example Add execution permission.

Choose to store

Trace data has to go somewhere. Jaeger supports both ES and Canssandra back-end DB. Domestic use of ES is more, we will take ES as an example to introduce its installation.

ES Please install it yourself first.

Since the four commands above have many parameters, we can create several scripts to support the jaeger startup.

start-collector.sh

exportSPAN_STORAGE_TYPE = elasticsearch nohup. / jaeger - collector -- es. Server - urls http://10.66.177.152:9200/ - log level = debug >  collector.log 2>&1 &Copy the code

start-agent.sh

export SPAN_STORAGE_TYPE=elasticsearch
nohup  ./jaeger-agent  --collector.host-port=10.66.177.152:14267 --discovery.min-peers=1 --log-level=debug > agent.log 2>&1 &
Copy the code

start-query.sh

exportSPAN_STORAGE_TYPE=elasticsearch nohup ./jaeger-query --span-storage.type=elasticsearch -- es. Server url = http://10.66.177.152:9200/ - > query. The log > & 1 & 2Copy the code

Deployment way

Jaeger can be deployed in two ways. Here are some of them. If you have a lot of data, kafka buffering is ok (hence the introduction of another component, Jaeger-ingester), without further explanation.

Simple and easy environment

The traffic in these environments is so small that one agent is sufficient.

More concise deployment mode, even agent does not need to send data directly to the collector. For testing purposes, we use this method.

The production environment

The advantage of this approach is that the configuration of the production environment is very simple. Even if your machine is mixed deployed, trace information will be collected normally.

Call diagram

Jaeger’s call diagram was calculated using the Spark task. Project address:

https://github.com/jaegertracing/spark-dependencies
Copy the code

As an optional part, it can only be displayed in jaeger’s background after the calculation is complete.

Port to arrange

Agent

5775 UDP: receives zipkin-compatible data 6831 UDP: receives Jaeger-compatible data 6832 UDP: receives Jaeger-compatible binary data 5778 HTTP. This parameter is not recommended for large amounts of dataCopy the code

The transport protocol between them is based on thrift encapsulation. We use 5775 as the transport port by default.

Collector

14267 TCP Agent sends data in Jaeger. Thrift format. 14250 TCP Agent sends data in Proto format (gRPC)Copy the code

Query

16686 HTTP Jaeger front end, put to user interface 16687 HTTP health checkCopy the code

At this point, our Jaeger is installed.

End

So that’s our environmental preparation. With a server receiving data, the main work of the call chain is client development.

Next, I’ll start with a simple Java program to illustrate how the OpenTracing specification can be used.