opentracing-contrib / java-agent

Agent-based OpenTracing instrumentation in Java
Apache License 2.0
41 stars 12 forks source link

Tool support for creating an uber jar containing tracer and framework integrations of choice #3

Open objectiser opened 7 years ago

objectiser commented 7 years ago

The opentracing-agent.jar produced by this project is a management mechanism for installing OpenTracing based instrumentation code into a JVM based application - however it does not actually bundle a specific OpenTracing Tracer implementation, rules, or OpenTracing based framework integrations.

This is to enable an end user/organisation to select the Tracer implementation of choice, and also the specific rules/framework integrations (and versions) they require for their applications. They then have two choses, place these dependencies onto the classpath of the application being instrumented, where the agent will detect and install them, or create an 'uber' jar containing the agent and all of the relevant dependencies.

This issue has been created to discuss whether tool support can be provided to make it easier to create the uber jar, e.g. based on some manifest listing the desired tracer, custom rules, framework integrations, etc.

pavolloffay commented 7 years ago

This would be really great!

Maybe another option would be just to package the agent and set a property with fully qualified tracer class which would be used by the agent.

objectiser commented 7 years ago

The agent uses the global-tracer, so as long as the Tracer impl is in the classpath and can be instantiated by the global-tracer then it would be fine. Same approach would apply whether the Trace impl was packaged with, or independent of the agent.

jam01 commented 6 years ago

Hey @objectiser could you decribe more less how to build the uber jar? I followed your java-agent-spring-boot-example but I end up with 2 jars, one is just the original agent and the other is the just the rules and Tracer, no agent.

objectiser commented 6 years ago

@jam01 The uber jar can be built using the maven shade plugin, which can include the agent, list of required rule dependencies and a tracer implementation - however it requires the user to define a maven project. This won't be a problem for some users.

So it just depends whether there is benefit in a separate tool that effectively provides a command line wrapper around the maven shade plugin, being supplied some form of manifest (e.g. yaml) with the list of rules and tracer.