Skip to content

fix(agent): report MongoDB wire message lengths - #11914

Closed
jiangjiang248 wants to merge 1 commit into
deepflowio:mainfrom
jiangjiang248:fix/mongodb-wire-lengths-20260925
Closed

jiangjiang248 wants to merge 1 commit into
deepflowio:mainfrom
jiangjiang248:fix/mongodb-wire-lengths-20260925

Conversation

@jiangjiang248

Copy link
Copy Markdown

This PR is for:

  • Agent

Fixes MongoDB request and response lengths being reported as zero

Steps to reproduce the bug

  1. Parse either existing MongoDB capture in agent/resources/test/flow_generator/mongo/.
  2. Inspect the resulting MongoDBInfo: req_len and resp_len remain zero even though the MongoDB message header contains a nonzero length (for example, 230 bytes for the request and 285 bytes for the response in mongo-msg.pcap).

Changes to fix the bug

  • Assign the header length to the MongoDBInfo returned by parse_payload, instead of the parser's internal self.info.
  • Add a unit test showing that request and response lengths come from the wire header even when fewer bytes were captured.
  • Update the two capture test expectations for all 32 parsed MongoDB messages.

Affected branches

  • main

Checklist

  • Added a unit test to verify the fix.
  • rustfmt --edition 2021 --check agent/src/flow_generator/protocol_logs/sql/mongo.rs
  • Checked the 32 updated capture expectations against the message lengths in both PCAP files.
  • Run the Agent Cargo test suite in CI. A full repository checkout was unavailable in the local environment.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants