deepflowio / deepflow

eBPF Observability - Distributed Tracing and Profiling
https://deepflow.io
Apache License 2.0
2.81k stars 309 forks source link

[BUG] AutoTracing is ineffective for Java clients using JDBC #5180

Closed Ghostbaby closed 7 months ago

Ghostbaby commented 8 months ago

Search before asking

DeepFlow Component

Grafana Dashbaord

What you expected to happen

java 服务在用 jdbc 客户端操作 mysql 的时候,使用事务之后只能记录 SET autocommit=0 执行时间慢,无法跟真正执行 insert 语句关联起来,查询慢查询、慢写入的时候只能看到一堆的 SET autocommit=0 语句。 WechatIMG1389

How to reproduce

java 程序使用 jdbc 使用事务操作数据库

DeepFlow version

Name: deepflow-server community edition
Branch: v6.4.3
CommitID: 8e168feb8335c5938959516ba62b34ea0143c237
RevCount: 9294
Compiler: go version go1.20.11 linux/amd64
CompileTime: 2023-11-24 02:25:13
Name: deepflow-agent community edition
Branch: v6.4.3
CommitId: 8e168feb8335c5938959516ba62b34ea0143c237
RevCount: 9294
Compiler: rustc 1.73.0 (cc66ad468 2023-10-03)
CompileTime: 2023-11-24 02:27:06

DeepFlow agent list

No response

Kubernetes CNI

No response

Operation-System/Kernel version

No response

Anything else

No response

Are you willing to submit a PR?

Code of Conduct

taloric commented 8 months ago

@Ghostbaby hello 可以先通过这些步骤排查一下

  1. 在 Grafana 的 Distributed Tracing 面板上,过滤 request_resource = SET autocommit=1 看能否找到对应的 commit & set autocommit & commit 之前的 dml 语句,先确认这些语句有被正常采集到;
  2. 点击 commit / set autocommit =1 的 span,并截图火焰图右下角中的 Related Data 对比(示例如下)我们看下,主要看 syscall_trace_id_request + syscall_trace_id_resepon + req_tcp_seq + resp_tcp_seq image

如操作有阻碍请告知,我找你远程看下

Ghostbaby commented 8 months ago

@taloric Hi

  1. 可以关联到 对应 dml 语句
  2. image
taloric commented 7 months ago

已沟通

  1. 确认可以取到 set autocommit=1 之前的查询/执行语句
  2. 此问题确认为 set autocommit=1 不正常地时延高

与研发沟通,问题为请求响应合并不对,ebpf capseq 同方向的记录有问题导致上层合并错了,已在 649 前修复,升级到 v.6.4.9 确认问题解决