Zipkin
DataKit 内嵌的 Zipkin Agent 用于接收,运算,分析 Zipkin Tracing 协议数据。
配置¶
采集器配置¶
进入 DataKit 安装目录下的 conf.d/samples 目录,复制 zipkin.conf.sample 并命名为 zipkin.conf。示例如下:
[[inputs.zipkin]]
pathV1 = "/api/v1/spans"
pathV2 = "/api/v2/spans"
## ignore_tags will work as a blacklist to prevent tags send to data center.
## Every value in this list is a valid string of regular expression.
# ignore_tags = ["block1", "block2"]
## Keep rare tracing resources list switch.
## If some resources are rare enough(not presend in 1 hour), those resource will always send
## to data center and do not consider samplers and filters.
# keep_rare_resource = false
## delete trace message
# del_message = true
## Ignore tracing resources map like service:[resources...].
## The service name is the full service name in current application.
## The resource list is regular expressions uses to block resource names.
## If you want to block some resources universally under all services, you can set the
## service name as "*". Note: double quotes "" cannot be omitted.
# [inputs.zipkin.close_resource]
# service1 = ["resource1", "resource2", ...]
# service2 = ["resource1", "resource2", ...]
# "*" = ["close_resource_under_all_services"]
# ...
## Sampler config uses to set global sampling strategy.
## sampling_rate used to set global sampling rate.
# [inputs.zipkin.sampler]
# sampling_rate = 1.0
# [inputs.zipkin.tags]
# key1 = "value1"
# key2 = "value2"
# ...
## Threads config controls how many goroutines an agent cloud start to handle HTTP request.
## buffer is the size of jobs' buffering of worker channel.
## threads is the total number fo goroutines at running time.
# [inputs.zipkin.threads]
# buffer = 100
# threads = 8
## Storage config a local storage space in hard dirver to cache trace data.
## path is the local file path used to cache data.
## capacity is total space size(MB) used to store data.
# [inputs.zipkin.storage]
# path = "./zipkin_storage"
# capacity = 5120
配置好后,重启 DataKit 即可。
目前可以通过 ConfigMap 方式注入采集器配置来开启采集器。
在 Kubernetes 中支持的环境变量如下表:
| 环境变量名 | 类型 | 示例 |
|---|---|---|
ENV_INPUT_ZIPKIN_PATH_V1 |
string | "/api/v1/spans" |
ENV_INPUT_ZIPKIN_PATH_V2 |
string | "/api/v2/spans" |
ENV_INPUT_ZIPKIN_IGNORE_TAGS |
JSON string | '["block1", "block2"]' |
ENV_INPUT_ZIPKIN_KEEP_RARE_RESOURCE |
bool | true |
ENV_INPUT_ZIPKIN_DEL_MESSAGE |
bool | true |
ENV_INPUT_ZIPKIN_CLOSE_RESOURCE |
JSON string | '{"service1":["resource1"], "service2":["resource2"], "service3":["resource3"]}' |
ENV_INPUT_ZIPKIN_SAMPLER |
float | 0.3 |
ENV_INPUT_ZIPKIN_TAGS |
JSON string | '{"k1":"v1", "k2":"v2", "k3":"v3"}' |
ENV_INPUT_ZIPKIN_THREADS |
JSON string | '{"buffer":1000, "threads":100}' |
ENV_INPUT_ZIPKIN_STORAGE |
JSON string | '{"storage":"./zipkin_storage", "capacity": 5120}' |
链路字段¶
zipkin¶
Following is tags/fields of tracing data
| Tags & Fields | Description |
|---|---|
| base_service ( tag) |
Span base service name |
| container_host ( tag) |
Container hostname. Available in OpenTelemetry. Optional. |
| db_host ( tag) |
DB host name: ip or domain name. Optional. |
| db_name ( tag) |
Database name. Optional. |
| db_system ( tag) |
Database system name:mysql,oracle... Optional. |
| dk_fingerprint ( tag) |
DataKit fingerprint(always DataKit's hostname) |
| endpoint ( tag) |
Endpoint info. Available in SkyWalking, Zipkin. Optional. |
| env ( tag) |
Application environment info. Available in Jaeger. Optional. |
| host ( tag) |
Hostname. |
| http_method ( tag) |
HTTP request method name. Available in DDTrace, OpenTelemetry. Optional. |
| http_route ( tag) |
HTTP route. Optional. |
| http_status_code ( tag) |
HTTP response code. Available in DDTrace, OpenTelemetry. Optional. |
| http_url ( tag) |
HTTP URL. Optional. |
| operation ( tag) |
Span name |
| out_host ( tag) |
This is the database host, equivalent to db_host,only DDTrace-go. Optional. |
| project ( tag) |
Project name. Available in Jaeger. Optional. |
| service ( tag) |
Service name. Optional. |
| source_type ( tag) |
Tracing source type |
| span_type ( tag) |
Span type |
| status ( tag) |
Span status |
| version ( tag) |
Application version info. Available in Jaeger. Optional. |
| duration | Duration of span Type: int | (gauge) Unit: time,μs |
| message | Origin content of span Type: string Unit: N/A |
| parent_id | Parent span ID of current span Type: string Unit: N/A |
| resource | Resource name produce current span Type: string Unit: N/A |
| span_id | Span id Type: string Unit: N/A |
| start | start time of span. Type: int | (gauge) Unit: timeStamp,usec |
| trace_id | Trace id Type: string Unit: N/A |