opentracing-contrib / java-mongo-driver

OpenTracing Instrumentation for Mongo Driver
Apache License 2.0
13 stars 12 forks source link

Extra host lookup triggered on decorate #16

Open alawrenc opened 4 years ago

alawrenc commented 4 years ago

Would it be possible to add a property flag around adding the IP address and port? Collecting that information isn't useful for us and triggers an extra (undesirable) host lookup on calls. Caused by: java.net.UnknownHostException: REDACTED at java.net.InetAddress.getAllByName0(InetAddress.java:1281) ~[?:1.8.0_232] at java.net.InetAddress.getAllByName(InetAddress.java:1193) ~[?:1.8.0_232] at java.net.InetAddress.getAllByName(InetAddress.java:1127) ~[?:1.8.0_232] at java.net.InetAddress.getByName(InetAddress.java:1077) ~[?:1.8.0_232] at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:188) ~[mongo-java-driver-3.11.0.jar:?] Looking at https://github.com/opentracing-contrib/java-mongo-driver/blob/release-0.1.5/opentracing-mongo-common/src/main/java/io/opentracing/contrib/mongo/common/SpanDecorator.java#L53 it seems like L53-63 could be put in an if-statement

malafeev commented 4 years ago

@alawrenc you should be able to provide own SpanDecorator implementation. flag also is fine. Would you like to submit a PR?