opencensus-java icon indicating copy to clipboard operation
opencensus-java copied to clipboard

Find a way to share utility classes and methods across artifacts.

Open sebright2 opened this issue 7 years ago • 0 comments

There are several reasons to add shared utilities currently:

  • If we remove uses of Guava from the implementation and exporters (issue #1113), we'll need to replace the Guava functionality, such as validating arguments. It would be nice to avoid duplicating the code in every artifact.

  • There are two copies of DaemonThreadFactory, in impl_core and the Stackdriver stats exporter, that could be to combined into one class.

Here are a few possible solutions that would avoid duplicating code:

  • Add a new artifact and upload it to Maven Central so that all OpenCensus artifacts can depend on it.
  • Add a package to opencensus-api that is similar to io.opencensus.internal, but stable enough to be used outside of opencensus-api.
  • Add a new subproject that can be used as a shaded dependency by the other artifacts. It wouldn't need to be uploaded to Maven Central. There is some discussion of this idea in https://github.com/census-instrumentation/opencensus-java/pull/1114#pullrequestreview-109828652, and an experimental branch (https://github.com/sebright/opencensus-java/tree/shadow-plugin).

sebright2 avatar Apr 19 '18 00:04 sebright2