You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Elastic APM与OpenTelemetry Span未关联问题求助

解决OpenTelemetry与Elastic APM Agent的Trace链路关联问题

核心原因

server1的OpenTelemetry Agent仅传播标准W3C traceparent头,而server2的Elastic APM Agent默认仅识别自身的elastic-apm-traceparent头,导致链路无法关联。以下两种方案均可解决问题:

方案一:让Elastic APM Agent识别W3C Trace Context

Elastic APM Agent 1.4.0已支持W3C traceparent头,只需开启多格式传播支持:

  • JVM启动参数方式:给server2添加启动参数:
    -Delastic.apm.propagation_types=w3c,elastic
    
  • 配置文件方式:在server2的elasticapm.properties中添加:
    propagation_types=w3c,elastic
    
    配置后,Elastic APM Agent会同时处理traceparent和elastic-apm-traceparent两种头,自动关联来自OpenTelemetry的Trace。

方案二:让OpenTelemetry Agent同时传播Elastic APM头

通过配置OpenTelemetry Agent,使其在调用时额外携带Elastic的elastic-apm-traceparent头:

  • 给server1添加JVM启动参数:
    -Dotel.propagators=tracecontext,elastic
    
    此配置让OpenTelemetry同时传播W3C标准头和Elastic自定义头,确保server2的Elastic Agent能识别到链路信息。

验证步骤

  1. 重启server1和server2,应用上述任一配置
  2. 再次调用server1的HTTP接口
  3. 打开Kibana的Trace标签页,即可看到server1的Trace链路中包含对server2的调用节点

内容的提问来源于stack exchange,提问作者George Lu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 20:05:01