wu-sheng opened a new pull request, #803:
URL: https://github.com/apache/skywalking-java/pull/803

   ## Summary
   Add MongoDB driver 5.x support with a new plugin module for 5.2+ and extend 
the existing 4.x plugin to cover 5.0-5.1.
   
   ## Changes
   
   ### MongoDB 4.x plugin extended to 5.0-5.1
   MongoDB driver 5.0-5.1 still uses `MongoClientDelegate` (same API as 4.x). 
Just added versions to support-version.list.
   
   ### New mongodb-5.x-plugin module (5.2+)
   MongoDB driver 5.2 replaced `MongoClientDelegate` with package-private 
`MongoClusterImpl` and `MongoClientDelegate$DelegateOperationExecutor` with 
`MongoClusterImpl$OperationExecutorImpl`.
   
   New interceptors:
   - `MongoClusterImplConstructorInterceptor`: extracts Cluster (arg[1]), gets 
remotePeer, propagates to OperationExecutor
   - `OperationExecutorImplConstructorInterceptor`: propagates remotePeer from 
enclosing MongoClusterImpl (synthetic arg[0] for inner class)
   - Reuses `MongoDBOperationExecutorInterceptor` from 4.x for execute() spans
   
   Key challenge: OperationExecutorImpl is created inside MongoClusterImpl's 
constructor before onConstruct fires, so its constructor interceptor can't read 
the peer yet. Solved by calling getOperationExecutor() via setAccessible 
reflection in MongoClusterImpl.onConstruct().
   
   Note: Same-package helper classes don't work because agent and application 
use different classloaders (different runtime packages even with identical 
package names).
   
   ### Documentation
   Updated CLAUDE.md, plugin development skill, and Java Plugin Development 
Guide with the package-private class access pattern.
   
   ## Test plan
   - [x] mongodb-4.x-scenario: 5.0.1, 5.1.4 passed locally
   - [x] mongodb-5.x-scenario: 5.2.0, 5.5.1 passed locally
   - [ ] CI verification


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to