The documentation you are viewing is for Dapr v1.8 which is an older version of Dapr. For up-to-date documentation, see the latest version.
操作方法: 为分布式跟踪安装 Zipkin
配置自托管模式
For self hosted mode, on running dapr init
:
- The following YAML file is created by default in
$HOME/.dapr/config.yaml
(on Linux/Mac) or%USERPROFILE%\.dapr\config.yaml
(on Windows) and it is referenced by default ondapr run
calls unless otherwise overridden `:
- config.yaml
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: daprConfig
namespace: default
spec:
tracing:
samplingRate: "1"
zipkin:
endpointAddress: "http://localhost:9411/api/v2/spans"
- The openzipkin/zipkin docker container is launched on running
dapr init
or it can be launched with the following code.
Launch Zipkin using Docker:
docker run -d -p 9411:9411 openzipkin/zipkin
- The applications launched with
dapr run
by default reference the config file in$HOME/.dapr/config.yaml
or%USERPROFILE%\.dapr\config.yaml
and can be overridden with the Dapr CLI using the--config
param:
dapr run --app-id mynode --app-port 3000 node app.js
查看 Traces
To view traces, in your browser go to http://localhost:9411 and you will see the Zipkin UI.
配置 Kubernetes
The following steps shows you how to configure Dapr to send distributed tracing data to Zipkin running as a container in your Kubernetes cluster, and how to view them.
设置
First, deploy Zipkin:
kubectl create deployment zipkin --image openzipkin/zipkin
Create a Kubernetes service for the Zipkin pod:
kubectl expose deployment zipkin --type ClusterIP --port 9411
接下来,在本地创建以下YAML文件:
- tracing.yaml configuration
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: tracing
namespace: default
spec:
tracing:
samplingRate: "1"
zipkin:
endpointAddress: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
Now, deploy the the Dapr configuration file:
kubectl apply -f tracing.yaml
为了启用您的 Dapr sidecar 的配置,请在您的pod spec模板中添加以下注释:
annotations:
dapr.io/config: "tracing"
就这么简单! Your sidecar is now configured to send traces to Zipkin.
查看追踪数据
To view traces, connect to the Zipkin service and open the UI:
kubectl port-forward svc/zipkin 9411:9411
In your browser, go to http://localhost:9411
and you will see the Zipkin UI.
参考资料
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.