跳到主要内容

Jaeger trace

Configuration

Example:configs/config_trace_jaeger.json

{
"tracing": {
"enable": true,
"driver": "jaeger",
"config": {
"service_name": "layotto"
}
}
}
FieldsRequiredNote
service_nameYService Name
agent_hostNagent component port
StrategyNData reporting, default using collector method. Optional configuration values include collector and agent
collector_endpointNport number for collector, default http:///127.0.0.1:14268/api/traces

Run Jaeger

cd ${project_path}/diagnostics/jaeger

docker-compose -f jaeger-docker-compose.yaml up -d

Run layotto

A layoto's server: can be started as follows.

Switch directory:

cd ${project_path}/cmd/layotto_multiple_api

Build:

go build -o layotto

Run:

./layotto start -c ../../configs/config_trace_jaeger.json 

Run Demo

The corresponding call end code is inclient.go, which runs the Sayhello interface with layotto:

Switch directory:

 cd ${project_path}/demo/flowcontrol/

Build:

 go build -o customer

Run:

./client

Visit http://localhost:16686

img.png

Clean up resources

cd ${project_path}/diagnostics/jaeger

docker-compose -f jaeger-docker-compose.yaml down