Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] COM_STMT_EXECUTE 采集不到原始的sql #3590

Closed
3 tasks done
wuzongling opened this issue Jul 13, 2023 · 2 comments
Closed
3 tasks done

[FR] COM_STMT_EXECUTE 采集不到原始的sql #3590

wuzongling opened this issue Jul 13, 2023 · 2 comments
Assignees
Labels

Comments

@wuzongling
Copy link

Search before asking

  • I had searched in the issues and found no similar feature requirement.

DeepFlow Component

Agent

What you expected to happen

COM_STMT_EXECUTE 类型采集不到原始的sql。错误的时候可以有错误信息,看了下mysql 协议,应该是有个statement id的,通过这个id是否可以关联出sql呢

How to reproduce

No response

DeepFlow version

No response

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?

  • Yes I am willing to submit a PR!

Code of Conduct

@wuzongling wuzongling added the bug Something isn't working label Jul 13, 2023
@Nick-0314 Nick-0314 added feature and removed bug Something isn't working labels Aug 25, 2023
@Nick-0314 Nick-0314 changed the title [BUG] COM_STMT_EXECUTE 采集不到原始的sql [FR] COM_STMT_EXECUTE 采集不到原始的sql Aug 25, 2023
@yuanchaoa
Copy link
Contributor

了解了下Mysql Statement交互逻辑大致为:

  1. 客户端发送 Request Prepare Statement(COM_STMT_PREPARE),其中带有具体的sql语句
  2. 服务端发送 Response ,其中带有Statement id
  3. 客户端发送 Request Execute Statement(COM_STMT_EXECUTE ), 带有Statement id,但是没有sql语句
  4. 服务端发送 Response Ok
    目前我们会将1,2聚合成一个会话,3,4聚合成一个会话;3,4的会话信息中没有sql不方便定位问题。可以考虑将statement id解析出来将前后两个会话关联起来

@yuanchaoa
Copy link
Contributor

通过采集COM_STMT_PREPARE响应的statement id和COM_STMT_EXECUTE请求的statement id,并将其存入应用日志的request id中,应用日志搜素可以通过statement id查询到对应的sql;注意部分非COM_STMT_PREPARE响应的包可能误报statement id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants