Open virtuald opened 8 years ago
fodder for examples, here's the only custom collector I'm aware of on github https://github.com/spring-cloud/spring-cloud-sleuth/tree/master/spring-cloud-sleuth-zipkin-stream
another example, is a standalone server with no collector or UI components: https://github.com/openzipkin/zipkin/tree/master/zipkin-server/src/it/minimal-dependencies
Since last time we discussed how to deal with bootstrapping third parties and now, there's something brewing from @dsyer called https://github.com/dsyer/spring-boot-thin-launcher
The idea is that you could mix and match components this way, for example, adding the core zipkin server with elasticsearch storage and azure collector autoconfiguration deps.
A stable docker image could still be created by doing a "dry run" which just downloads the dependencies listed in the manifest during the build.
What do you all think about trying this? @aliostad @shakuzen @marcingrzejszczak @llinder @devinsba @anuraaga @kevinmdavis @denyska
I am happy to follow the lead from you guys. As I have said, I am new to this.
Initially it seemed a stand-alone collector is cleaner but frankly since it has to have access to storage, it seems that needs zipkin-server (core bits) anyway. UI obviously is not necessary.
The thin launcher thing sounds interesting. Reading the docs it seems like it would be about the same amount of work as making a new fat jar. To the thin launchers advantage it sounds like it should avoid the extra bloat in the docker container since the thin wrapper could make informed decisions to only layer in new jars. Also it would hopefully maintain easy local testing/debugging like the fat jar provides.
one subtle plus to the thin launcher is that it would not have the problem of composing fat jars (classpath duplication). Ex unless I misunderstand, the classpath would resolve to a single version on conflict, so you don't accidentally have mixed version of zipkin core jars.
copied from #1488
Update: figured out how to get modularity working. It is a little constrained, but it works now.
Here's how.
The classifier name "module" is arbitrary, but I think it works. Take extreme care to not duplicate jars already in zipkin-server's exec jar. Here's an example configuration for the SQS collector:
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<layout>MODULE</layout>
<classifier>module</classifier>
<!-- https://github.com/spring-projects/spring-boot/issues/3426 transitive exclude doesn't work -->
<excludeGroupIds>io.zipkin.java,org.springframework.boot,org.springframework,commons-codec,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat,org.apache.httpcomponents,commons-logging,joda-time,software.amazon.ion</excludeGroupIds>
<!-- already packaged in zipkin-server -->
<excludeArtifactIds>aws-java-sdk-core,aws-java-sdk-sts,jmespath-java</excludeArtifactIds>
</configuration>
</plugin>
</plugins>
</build>
This will make a file like.. autoconfigure/collector-sqs/target/zipkin-autoconfigure-collector-sqs-0.0.4-SNAPSHOT-module.jar
I cannot get the PropertiesLauncher configuration to accept the module-jar directly. However, the following does work.
PropertiesLauncher
with loader.path
set to include that directoryExample:
$ java -Dloader.path=/tmp/extensions -cp zipkin.jar org.springframework.boot.loader.PropertiesLauncher --zipkin.collector.sqs.queue-url=http://foobar
Note: the module jar is self-contained.. when doing your devopsian things, feel free to just curl it from jcenter, like we do for the server jar.
this works fine now. both in aws and azure. we just need to polish instructions
This involves some spring magic and isn't particularly obvious on how to do it. I did it earlier today, but I'll have to look at it tomorrow to remember what exactly is needed. Here's what I remember so far:
POM modifications:
Creating the collector:
Creating a main function to run:
@Bean
in itFinally, make sure that you don't mess up the annotation compilation, otherwise you'll get really weird errors and it won't work.
At some point, it might be useful to make a sample project with all of these.
Execution is however one would normally execute a spring boot application.