Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Collector for Azure EventHub #1488

Closed
aliostad opened this issue Jan 15, 2017 · 23 comments
Closed

Implementing Collector for Azure EventHub #1488

aliostad opened this issue Jan 15, 2017 · 23 comments

Comments

@aliostad
Copy link

aliostad commented Jan 15, 2017

Hi,

I am working on a Zipkin collector for Azure EventHub. The work itself is not demanding since most of the heavy lifting is done by the Azure Java SDK itself.

However I am not sure if I should contribute as part of Zipkin itself or it is able to load plugins and configurations from outside.

Can you please guide what is the best route?

Thanks

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jan 16, 2017 via email

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jan 16, 2017 via email

@codefromthecrypt
Copy link
Member

I pinged twitter to hopefully interest others in contributing or helping https://twitter.com/zipkinproject/status/820801744833691651

@aliostad
Copy link
Author

@adriancole Awesome mate! That is excellent.

Thanks I believe I have all I need. As you can see, it is only the skeleton with no embellishment, etc. As you might have guessed, Java is not my primary language but I will make the effort to ensure this is of the quality rest of zipkin is akin to.

I will close the issue but I might get back to you soon.

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jan 16, 2017 via email

@aliostad aliostad reopened this Jan 18, 2017
@aliostad
Copy link
Author

OK, I have made progress and trying to get it run. I know this could be a silly question but I am new to all this: how is zipkin-aws supposed to run for example?

My expectation for zipkin-collector-eventhub is that I drop zipkin-collector-eventhub.jar along with the zipkin-server.jar and run the zipkin-server.jar and specify configurations in application.yaml or application.properties and the Spring Boot autoconfig will load it and start running my host in addition to zipkin-server. But I have not been able to get this to work. Do I need to make my jar a Spring Boot application, like Stackdriver Trace Zipkin Collector?

Can you please provide some pointers?

Thanks a lot.

@codefromthecrypt
Copy link
Member

hi, @aliostad Thanks for the update.

Right now, people are working with custom images, though there is a means to change how things work by using "zip" layout on the server, which allows use of the more customizable property launcher

There's another approach, too, a thin launcher.. I mention things about it here: #1219 (comment)

It is high time we had a suggested and testable way to compose server binaries.. let's follow-through on this.

@llinder
Copy link
Member

llinder commented Jan 19, 2017

@aliostad to answer the question about how I do this with zipkin-aws. Right now we make a fat jar by depending on zipkin and our extra auto configuration libs. From there we create a new layer on the zipkin docker container by exploding the fat jar in the same way the upstream build does. This is fairly easy though it does make the container larger than needed since the old layer still remains.

Ideally we need to figure out an elegant way to only layer in new jars. Both the property launcher and thin launcher sound promising though I don't have experience with either so I'm anxious to see what the developer experience would be like.

@aliostad
Copy link
Author

@llinder Hi, thanks for the comments. So this fat jar, what script gets used to build this? I would like to see what the process is.

This weekend I will spend some time getting my head around thin launcher.

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jan 20, 2017 via email

@aliostad
Copy link
Author

aliostad commented Jan 21, 2017

OK I have been looking into samples of thin launcher. I cannot see any ZIP layout so properties can be changed, am I missing something or we can configure thin launcher in other means?

[UPDATE]

I finally got zipkin-server to read application.properties using --spring.config.location. So I guess I don't need any magic for supplying config as I can use the same trick.

@codefromthecrypt
Copy link
Member

actually, the thin plugin is available, you just need to use snapshot repo

ex.
http://repo.spring.io/libs-snapshot/org/springframework/boot/experimental/spring-boot-thin-maven-plugin/

@codefromthecrypt
Copy link
Member

Update: figured out how to get modularity working. It is a little constrained, but it works now.

Here's how.

Step 1: Add spring boot plugin to your autoconfig module, adding a "module" jar

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

Step 2: Extract this module jar when composing a server layer

I cannot get the PropertiesLauncher configuration to accept the module-jar directly. However, the following does work.

  1. extract your module jar somewhere (Ex to an extensions folder)
  2. explicitly start zipkin using PropertiesLauncher with loader.path set to include that directory

Example:

$ 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.

@aliostad
Copy link
Author

Wow! @adriancole that is so nice! Thanks a lot. I will hopefully get to play with this today or tomorrow.

@aliostad
Copy link
Author

aliostad commented Jan 23, 2017

So unless I am missing something, this is not launcher, no?

So do you think it is worth to try that out (I was trying to get my head around it and made some progress) or this is the canonical way to go (using MODULE to create a fat jar)?

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jan 24, 2017 via email

@aliostad
Copy link
Author

aliostad commented Jan 24, 2017

Thank you. I will carry on with this. Do I need to define Start-Class (was not in your configuration above)? Here is what I get:

Exception in thread "main" java.lang.IllegalStateException: No 'loader.main' or 'Start-Class' specified
	at org.springframework.boot.loader.PropertiesLauncher.getMainClass(PropertiesLauncher.java:317)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
	at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:521)

And if so, I guess it should be from zipkin-server?

Using java -jar works but does not load my stuff.

PS. Sorry for asking many questions... I am actually pleased I have made it this far. With little background soon will be publishing my contribution 👍

@codefromthecrypt
Copy link
Member

@aliostad so keep in mind this is using the default zipkin exec jar (which has the start class). You would be making the module that adds to it.

Ex. you should be able to download and use an unmodified zipkin-server jar like below.. (which was zipkin.jar in my example)

https://github.com/openzipkin/zipkin#quick-start

also feel free to hop on https://gitter.im/openzipkin/zipkin if you get stuck! Thanks for the help on this

@aliostad
Copy link
Author

aliostad commented Jan 24, 2017

Sure, I will go to gitter. Just to clarify I WAS using the original zipkin.jar but as I said, it was not working with -cp.

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jan 25, 2017 via email

@aliostad
Copy link
Author

OK, this is working now 👍

Impossible without your help. I am closing this now, I have everything I need.

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jan 26, 2017 via email

@aliostad
Copy link
Author

I am pleased this helped pushing for better modularity! It looks awesomely clean yet pluggable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants