10.1 Jaeger
introduce
Jaeger is a distributed tracking system developed and open source by Uber. Compatible with OpenTracing API, Jaeger is suitable for the following scenarios:
- Distributed trace information delivery
- Distributed transaction monitoring
- Problem analysis
- Service dependency analysis
- Performance optimization
The full-link tracking function of Jaeger is mainly performed by three roles:
client
: Is responsible for timing, sampling at each call point on the whole link, and willtracing
Data is sent locallyagent
.agent
: Responsible for collectionclient
From thetracing
Data, and tothrift
Protocol forward tocollector
.collector
: Responsible for collecting allagent
reportedtracing
Data, unified storage.
10.2 go-zero
useJaeger
Link to track
The Go-Zero framework has already enabled link tracing (see: Go-zero link tracing), and integrated support for Jaeger and Zipkin link tracing reporting tools. With simple configuration, we can visually view the complete call chain of a request, as well as the call situation and performance of each link.
10.2.1 adduser api
serviceTelemetry
configuration
$ vim mall/service/user/api/etc/user.yaml
Copy the code
Name: User
Host: 0.0. 0. 0
Port: 8000
.
Telemetry:
Name: user.api
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger
Copy the code
10.2.2 adduser rpc
serviceTelemetry
configuration
$ vim mall/service/user/rpc/etc/user.yaml
Copy the code
Name: user.rpc
ListenOn: 0.0. 0. 0: 9000
.
Telemetry:
Name: user.rpc
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger
Copy the code
10.2.3 addproduct api
serviceTelemetry
configuration
$ vim mall/service/product/api/etc/product.yaml
Copy the code
Name: Product
Host: 0.0. 0. 0
Port: 8001
.
Telemetry:
Name: product.api
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger
Copy the code
10.2.4 addproduct rpc
serviceTelemetry
configuration
$ vim mall/service/product/rpc/etc/product.yaml
Copy the code
Name: product.rpc
ListenOn: 0.0. 0. 0: 9001
.
Telemetry:
Name: product.rpc
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger
Copy the code
10.2.5 addorder api
serviceTelemetry
configuration
$ vim mall/service/order/api/etc/order.yaml
Copy the code
Name: Order
Host: 0.0. 0. 0
Port: 8002
.
Telemetry:
Name: order.api
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger
Copy the code
10.2.6 addorder rpc
serviceTelemetry
configuration
$ vim mall/service/order/rpc/etc/order.yaml
Copy the code
Name: order.rpc
ListenOn: 0.0. 0. 0: 9002
.
Telemetry:
Name: order.rpc
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger
Copy the code
10.2.7 addpay api
serviceTelemetry
configuration
$ vim mall/service/pay/api/etc/pay.yaml
Copy the code
Name: Pay
Host: 0.0. 0. 0
Port: 8003
.
Telemetry:
Name: pay.api
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger
Copy the code
10.2.8 addpay rpc
serviceTelemetry
configuration
$ vim mall/service/pay/rpc/etc/pay.yaml
Copy the code
Name: pay.rpc
ListenOn: 0.0. 0. 0: 9003
.
Telemetry:
Name: pay.rpc
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger
Copy the code
! Note: The modification takes effect only after the service is restarted.
10.3 the use ofJaeger UI
See the link
- access
/api/user/userinfo
API interface
- inChapter 2 Environment ConstructionWe integrate
Jaeger
Serve, and forJaeger UI
The port number16686
Made the host port5000
“, so enter it in your browserhttp://127.0.0.1:5000/
accessJaeger UI
Interface. chooseSearch
The menu,Service
Select a value from the drop-down list boxuser.api
And then clickFind Traces
Button to query to the one you just visited/api/user/userinfo
Link tracing data of the interface.
- Click in, and you can see this
/api/user/userinfo
Link timing diagram of the interface, as well as service dependencies, and time consumption.
- Different data presentation styles can be selected from the drop-down menu in the upper right corner.
- Link tracing renderings of other interfaces
Project address: Github
Previous article “Go-Zero: Making Microservices Go — 9 Service Monitoring Prometheus”
Go Zero: Making Microservices Go — 11 Distributed Transaction DTM