Skip to content

Commit

Permalink
Merge pull request #10 from openzipkin/experimental-jdbc
Browse files Browse the repository at this point in the history
Adds WIP JDBC backend
  • Loading branch information
adriancole committed Sep 23, 2015
2 parents 2d1d001 + 81dfc0c commit e94d95d
Show file tree
Hide file tree
Showing 19 changed files with 1,338 additions and 50 deletions.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ zipkin-java-server:
- 9410:9410
- 9411:9411
web:
image: quay.io/openzipkin/zipkin-web:1.6.0
image: quay.io/openzipkin/zipkin-web:1.9.0
links:
- zipkin-java-server:query
- zipkin-java-server:collector
ports:
- 8080:8080
- 9990:9990
2 changes: 1 addition & 1 deletion maven/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Maven download properties
#Tue Sep 01 07:17:40 PDT 2015
#Tue Sep 22 22:17:47 PDT 2015
distributionUrl=https\://repository.apache.org/content/repositories/releases/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip
79 changes: 74 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<module>zipkin-java-scribe</module>
<module>zipkin-java-dependencies</module>
<module>zipkin-java-server</module>
<module>zipkin-java-jdbc</module>
</modules>

<properties>
Expand All @@ -43,6 +44,10 @@
<junit.version>4.12</junit.version>
<assertj.version>3.1.0</assertj.version>

<!-- Dependencies for SpanStoreSpec -->
<zipkin-scala.version>1.9.0</zipkin-scala.version>
<scalatest.version>2.2.5</scalatest.version>

<!-- Run `mvn wrapper:wrapper -N` on updating below -->
<maven.version>3.3.3</maven.version>
<wrapper-maven-plugin.version>0.0.4</wrapper-maven-plugin.version>
Expand All @@ -51,6 +56,10 @@
<maven-source-plugin.version>2.4</maven-source-plugin.version>
<maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version>
<maven-license-plugin.version>2.11</maven-license-plugin.version>
<maven-jar-plugin.version>2.6</maven-jar-plugin.version>
<maven-release-plugin.version>2.5.2</maven-release-plugin.version>
<nexus-staging-maven-plugin.version>1.6.6</nexus-staging-maven-plugin.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
</properties>

<name>Zipkin Java</name>
Expand Down Expand Up @@ -107,6 +116,13 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zipkin-java-query</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zipkin-java-scribe</artifactId>
Expand All @@ -119,6 +135,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zipkin-java-jdbc</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.facebook.swift</groupId>
<artifactId>swift-annotations</artifactId>
Expand Down Expand Up @@ -164,6 +186,50 @@
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
</dependency>

<!-- Dependencies for SpanStoreSpec -->
<dependency>
<groupId>io.zipkin</groupId>
<artifactId>zipkin-common</artifactId>
<version>${zipkin-scala.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.zipkin</groupId>
<artifactId>zipkin-scrooge</artifactId>
<version>${zipkin-scala.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.zipkin</groupId>
<artifactId>zipkin-common</artifactId>
<version>${zipkin-scala.version}</version>
<classifier>test</classifier>
<exclusions>
<exclusion>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.10</artifactId>
<version>${scalatest.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -206,6 +272,11 @@
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin.version}</version>
</plugin>

<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>

Expand Down Expand Up @@ -253,7 +324,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.6</version>
<version>${nexus-staging-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -263,9 +334,8 @@
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<version>${maven-release-plugin.version}</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
Expand Down Expand Up @@ -317,7 +387,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -328,7 +398,6 @@
</execution>
</executions>
</plugin>

</plugins>
</build>
</profile>
Expand Down
22 changes: 22 additions & 0 deletions zipkin-java-core/src/main/java/io/zipkin/BinaryAnnotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ public enum Type {
public int value() {
return value;
}

/** Returns {@link Type#BYTES} if unknown. */
public static Type fromValue(int value) {
switch (value) {
case 0:
return BOOL;
case 1:
return BYTES;
case 2:
return I16;
case 3:
return I32;
case 4:
return I64;
case 5:
return DOUBLE;
case 6:
return STRING;
default:
return BYTES;
}
}
}

public static Builder builder() {
Expand Down
21 changes: 21 additions & 0 deletions zipkin-java-jdbc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# zipkin-java-jdbc

## Applying the schema

```bash
# Barracuda supports compression (In AWS RDS, this must be assigned in a parameter group)
$ mysql -uroot -e "SET GLOBAL innodb_file_format=Barracuda"
# This command should work even in RDS, and return "Barracuda"
$ mysql -uroot -e "show global variables like 'innodb_file_format'"

# install the schema and indexes
$ mysql -uroot -e "create database if not exists zipkin"
$ mysql -uroot -Dzipkin < zipkin-java-jdbc/src/main/resources/mysql.sql
```

## Generating the schema types

```bash
$ rm -rf zipkin-java-jdbc/src/main/java/io/zipkin/jdbc/internal/generated/
$ ./mvnw -pl zipkin-java-jdbc clean org.jooq:jooq-codegen-maven:generate com.mycila:license-maven-plugin:format
```
114 changes: 114 additions & 0 deletions zipkin-java-jdbc/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015 The OpenZipkin Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.zipkin</groupId>
<artifactId>zipkin-java</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>

<artifactId>zipkin-java-jdbc</artifactId>
<name>Zipkin Java JDBC Model</name>
<description>Zipkin Java JDBC Model</description>

<properties>
<jooq.version>3.6.3</jooq.version>
<mysql-connector-java.version>5.1.36</mysql-connector-java.version>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zipkin-java-query</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zipkin-java-dependencies</artifactId>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
</dependencies>
<configuration>
<jdbc>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/zipkin</url>
<user>root</user>
<password></password>
</jdbc>
<generator>
<generate>
<relations>false</relations>
<deprecated>false</deprecated>
<records>false</records>
<pojos>false</pojos>>
</generate>
<database>
<name>org.jooq.util.mysql.MySQLDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<inputSchema>zipkin</inputSchema>
</database>
<target>
<packageName>io.zipkin.jdbc.internal.generated</packageName>
<directory>src/main/java</directory>
</target>
</generator>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Loading

0 comments on commit e94d95d

Please sign in to comment.