Skip to content

feat: add MongoDB driver handshake metadata for Java-based client connections - #39504

Open
alexbevi wants to merge 2 commits into
apache:masterfrom
alexbevi:add-client-metadata
Open

feat: add MongoDB driver handshake metadata for Java-based client connections#39504
alexbevi wants to merge 2 commits into
apache:masterfrom
alexbevi:add-client-metadata

Conversation

@alexbevi

Copy link
Copy Markdown

Passes MongoDriverInformation to MongoClients.create() in MongoDBResourceManager so that MongoDB server-side telemetry can identify traffic originating from Apache Beam.

What changes

it/mongodb/src/main/java/.../MongoDBResourceManager.java

  • Adds a package-visible DRIVER_INFO constant (@VisibleForTesting) built with MongoDriverInformation.builder().driverName("Apache Beam").build().
  • Passes it as the second argument to MongoClients.create(connectionString, DRIVER_INFO) when no external MongoClient is provided. When a client is injected via the @VisibleForTesting constructor (e.g. in unit tests), the external client is used unchanged.

This will appear in mongos/d logs similar to:

{"t":{"$date":"..."},"s":"I","c":"NETWORK","id":51800,"ctx":"conn1","msg":"client metadata","attr":{"doc":{"driver":{"name":"mongo-java-driver|Apache Beam","version":"5.5.0"},"os":{"type":"Linux"},"platform":"Java/..."}}}

See the MongoDB handshake specification for more info.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@alexbevi
alexbevi force-pushed the add-client-metadata branch from 145ae9e to 3b5dd20 Compare July 27, 2026 14:15
@alexbevi alexbevi changed the title feat: add MongoDB driver handshake metadata to MongoDBResourceManager feat: add MongoDB driver handshake metadata for Java-based client connections Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@alexbevi
alexbevi force-pushed the add-client-metadata branch from 3b5dd20 to ac9bf8a Compare July 27, 2026 15:55
Resolves Gradle dependency analysis violation caused by using
ConnectionString and MongoDriverInformation classes without
explicitly declaring mongodb-driver-core as a dependency.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @chamikaramj for label java.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant