openzipkin / brave

Java distributed tracing implementation compatible with Zipkin backend services.
Apache License 2.0
2.35k stars 714 forks source link

Support MongoDB client version 5.x #1430

Closed j-musca closed 3 months ago

j-musca commented 3 months ago

Describe the Bug

TraceMongoCommandListener calls connectionDescription.getServerAddress().getSocketAddress(). This throws a MethodNotFound exception in combination with the latest MongoDB client versions 5.x.

Steps to Reproduce

Create a dummy project with brave MongoDB instrumentation + MongoDB client version 5.x and try to compile it.

Expected Behaviour

The recommendation is to use "new InetSocketAddress(InetAddress.getByName(host), port);" to get the address.

codefromthecrypt commented 3 months ago

I looked into it, and basically this is a request to support mongodb-driver-core (5.x).

It is clear that mongo intentionally broke API to create the new driver infrastructure, even if some things are similar. For example, the constructors of the final classes representing events also broke.

Rather than use reflection and also hacks to get the unit tests to compile again, I suggest making a new module called mongodb-driver-core and addressing all the drift without use of reflection.

Make sure when doing so, the RATIONALE and README.md are adjusted for drift also.

codefromthecrypt commented 3 months ago

actually I got this

codefromthecrypt commented 3 months ago

https://github.com/openzipkin/brave/pull/1431 should fix it. I figured a way to keep everything in the same module, which is also nicer as it contains the eventuality of CVEs in the v3 version