Skip to content

Commit

Permalink
Merge pull request #78 from openzipkin/in-mem
Browse files Browse the repository at this point in the history
Decouples InMemorySpanStore and tests from zipkin-server
  • Loading branch information
adriancole committed Feb 16, 2016
2 parents a6b3d51 + 9c38e31 commit 80d7827
Show file tree
Hide file tree
Showing 21 changed files with 371 additions and 255 deletions.
2 changes: 1 addition & 1 deletion interop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zipkin-server</artifactId>
<artifactId>spanstore-jdbc</artifactId>
</dependency>

<!-- for ScalaSpanStoreAdapter -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package zipkin.server;
package zipkin;

import com.twitter.zipkin.common.Span;
import com.twitter.zipkin.storage.DependencyStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package zipkin.server;
package zipkin;

import com.twitter.zipkin.storage.SpanStore;
import com.twitter.zipkin.storage.SpanStoreSpec;
Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zipkin</artifactId>
<type>test-jar</type>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>spanstore-jdbc</artifactId>
Expand Down
241 changes: 0 additions & 241 deletions zipkin-server/src/main/java/zipkin/server/InMemorySpanStore.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import zipkin.Codec;
import zipkin.InMemorySpanStore;
import zipkin.Sampler;
import zipkin.SpanStore;
import zipkin.jdbc.JDBCSpanStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.github.kristofa.brave.Brave;
import com.github.kristofa.brave.LocalTracer;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import zipkin.DependencyLink;
Expand Down Expand Up @@ -52,7 +53,7 @@ public List<List<Span>> getTraces(QueryRequest request) {
}

@Override
public List<List<Span>> getTracesByIds(List<Long> traceIds) {
public List<List<Span>> getTracesByIds(Collection<Long> traceIds) {
tracer.startNewSpan(component, "get-traces-by-ids");
try {
return delegate.getTracesByIds(traceIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import zipkin.BinaryAnnotation;
import zipkin.Constants;
import zipkin.Endpoint;
import zipkin.InMemorySpanStore;
import zipkin.Sampler;
import zipkin.Span;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import zipkin.Constants;
import zipkin.Endpoint;
import zipkin.Span;
import zipkin.server.InMemorySpanStore;
import zipkin.InMemorySpanStore;

import static java.util.Collections.singletonList;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
Expand Down
13 changes: 13 additions & 0 deletions zipkin-spanstores/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@
<version>${jooq.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zipkin</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -166,7 +167,7 @@ public void accept(Iterator<Span> spans) {
}
}

private List<List<Span>> getTraces(@Nullable QueryRequest request, @Nullable List<Long> traceIds) {
List<List<Span>> getTraces(@Nullable QueryRequest request, @Nullable Collection<Long> traceIds) {
final Map<Long, List<Span>> spansWithoutAnnotations;
final Map<Pair<?>, List<Record>> dbAnnotations;
try (Connection conn = datasource.getConnection()) {
Expand Down Expand Up @@ -248,7 +249,7 @@ private DSLContext context(Connection conn) {
}

@Override
public List<List<Span>> getTracesByIds(List<Long> traceIds) {
public List<List<Span>> getTracesByIds(Collection<Long> traceIds) {
return traceIds.isEmpty() ? emptyList() : getTraces(null, traceIds);
}

Expand Down
Loading

0 comments on commit 80d7827

Please sign in to comment.