Skip to content

Support MongoDB 7.0 and 8.0 in $currentOp pipeline#19

Open
vtomasr5 wants to merge 1 commit into
mainfrom
support-mongodb-7-and-8
Open

Support MongoDB 7.0 and 8.0 in $currentOp pipeline#19
vtomasr5 wants to merge 1 commit into
mainfrom
support-mongodb-7-and-8

Conversation

@vtomasr5

@vtomasr5 vtomasr5 commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Detect server version on connect and parse serverStatus.version into (major, minor); gate truncateOps (added in MongoDB 7.1) so the tool keeps working against 7.0, which rejects unknown $currentOp fields.
  • Extend the $project stage with MongoDB 8.0 fields: queryFramework, cursor, progress, msg, numYields, appName, host, connectionId, prepareReadConflicts, writeConflicts, dataThroughputLastSecond, dataThroughputAverage, twoPhaseCommitCoordinator, shard. Projecting a field that doesn't exist on a 7.0 doc is a no-op, so the projection itself is back-compat.
  • Render the new fields in OperationDetailsScreen when present (status msg, progress %, cursor block, transaction params incl. readConcern.level, 2PC coordinator, throughput, shard, app name, host+conn id, numYields, queryFramework).

Test plan

  • uv run pytest -v — 119 passed
  • uv run ruff check src/ tests/
  • uv run ruff format --check src/ tests/
  • Unit tests cover 7.0, 7.1, 8.0, and unparseable-version paths for truncateOps, plus a version-string parser test and an end-to-end connect-parses-version test
  • Manual smoke against a real 7.0 cluster
  • Manual smoke against a real 8.0 cluster

Detect the server version on connect and gate truncateOps (added in 7.1)
so the tool keeps working against 7.0 servers, which reject unknown
$currentOp fields. Extend the projection with MongoDB 8.0 fields
(queryFramework, cursor, progress, msg, numYields, appName, host,
connectionId, write/prepare conflicts, throughput, twoPhaseCommitCoordinator,
shard) and surface them in the operation details screen when present.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

self.server_version: tuple[int, int] = (0, 0)

@staticmethod
def _parse_server_version(version: str) -> tuple[int, int]:
Comment on lines +174 to +178
if write_conflicts:
details.append(f"Write Conflicts: {write_conflicts}")

prepare_read_conflicts = op.get("prepareReadConflicts")
if prepare_read_conflicts:
Comment on lines +246 to +251
if locks:
details.append("\nLocks:")
for key, value in locks.items():
details.append(f" {key}: {value}")
if op.get("waitingForLock"):
details.append(" waitingForLock: True")
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