Etcd开启trace

针对处理耗时超过100ms的grpc请求,etcd打印包含耗时长的阶段的trace日志。

# etcd容器增加环境变量
env:
- name: ETCD_LOGGER
  value: zap

trace日志举例

{
    "level": "info",
    "ts": "2024-05-13T14:16:45.478Z",
    "caller": "traceutil/trace.go:145",
    "msg": "trace[617423573] range",
    "detail": "{range_begin:/registry/services/specs/default/kubernetes; range_end:; response_count:1; response_revision:8900; }",
    "duration": "144.954538ms",
    "start": "2024-05-13T14:16:45.333Z",
    "end": "2024-05-13T14:16:45.478Z",
    "steps": [
        "trace[617423573] 'agreement among raft nodes before linearized reading'  (duration: 106.014756ms)",
        "trace[617423573] 'range keys from bolt db'  (duration: 38.634484ms)"
    ]
}

 

posted on 2024-05-13 22:23  王景迁  阅读(35)  评论(0编辑  收藏  举报

导航