Dubbo-go 支持基于 OpenTelemetry 标准的全链路追踪埋点,同时支持通过以下 exporter 导出到不同的 tracing 后端系统。
请注意,仅支持通过 dubbo.NewInstance
方式创建 dubbo 应用时开启 tracing 功能,也就是我们快速开始中提到的 微服务应用模式,对于 轻量 RPC API 暂时不支持开启 tracing。
可在此查看 完整示例源码地址。
使用 dubbo.WithTracing()
开启 tracing,可以通过多个参数控制 tracing 行为:
如果你在 dubbo.WithTracing()
调用中不指定任何 option 参数,则会使用默认行为:
trace.WithEnabled()
means enable tracingtrace.WithStdoutExporter()
trace.WithJaegerExporter()
trace.WithZipkinExporter()
trace.WithOtlpHttpExporter()
trace.WithOtlpGrpcExporter()
http://localhost:14268/api/traces
trace.WithEndpoint(string)
trace.WithW3cPropagator()
trace.WithB3Propagator()
zipkin exporter default use thistrace.WithAlwaysMode()
trace.WithNeverMode()
trace.WithRatioMode()
trace.WithRatio(float64)