java-dogstatsd-client icon indicating copy to clipboard operation
java-dogstatsd-client copied to clipboard

Make Unix Domain Socket functionality optional

Open deadok22 opened this issue 5 years ago • 1 comments

Not all usages of the library need Unix Domain Socket transport. Let's figure out how to make it optional.

Some wins we can get by making Unix Domain Socket transport optional:

  • Extra dependencies. java-dogstatsd-client only depends on JARs brought in by com.github.jnr:jnr-unixsocket. If we remove this dependency, projects not requiring Unix Domain Socket transport will have to import 1 JAR instead of 14.
  • Get rid of issues caused by ASM not being repackaged. See https://github.com/jnr/jnr-ffi/issues/193 for more details. Here is an example of an issue caused by those dependencies: https://github.com/DataDog/java-dogstatsd-client/issues/68

Some approaches we could take to address this:

  1. Split Unix Domain Socket transport to a separate JAR.
  2. Make com.github.jnr:jnr-unixsocket an optional dependency and add some workarounds to prevent eager loading of classes from that JAR.

deadok22 avatar Aug 14 '19 06:08 deadok22

Another advantage of this is that jnr-unixsocket currently pulls in an LGPL licensed dependency jnr-posix:

[INFO] +- com.datadoghq:java-dogstatsd-client:jar:2.8:compile
[INFO] |  \- com.github.jnr:jnr-unixsocket:jar:0.18:compile
[INFO] |     +- com.github.jnr:jnr-ffi:jar:2.1.4:compile
[INFO] |     |  +- com.github.jnr:jffi:jar:1.2.15:compile
[INFO] |     |  +- com.github.jnr:jffi:jar:native:1.2.15:runtime
[INFO] |     |  +- org.ow2.asm:asm:jar:5.0.3:compile
[INFO] |     |  +- org.ow2.asm:asm-commons:jar:5.0.3:compile
[INFO] |     |  +- org.ow2.asm:asm-analysis:jar:5.0.3:compile
[INFO] |     |  +- org.ow2.asm:asm-tree:jar:5.0.3:compile
[INFO] |     |  +- org.ow2.asm:asm-util:jar:5.0.3:compile
[INFO] |     |  \- com.github.jnr:jnr-x86asm:jar:1.0.2:compile
[INFO] |     +- com.github.jnr:jnr-constants:jar:0.9.8:compile
[INFO] |     +- com.github.jnr:jnr-enxio:jar:0.16:compile
[INFO] |     \- com.github.jnr:jnr-posix:jar:3.0.35:compile

Many organisations won't be able to use this library at the moment because of that dependency (we currently can't upgrade past v2.5).

JamJar00 avatar Aug 20 '19 14:08 JamJar00