-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
83 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
dependencies { | ||
compile "io.ratpack:ratpack-core:${ratpackVersion}" | ||
compile "io.ratpack:ratpack-guice:${ratpackVersion}" | ||
|
||
compile 'com.datastax.cassandra:cassandra-driver-core:3.1.0' | ||
compile 'smartthings.brave:smartthings-brave-cassandra-latencytracker:0.1.14' | ||
compile project(':ratpack-cassandra') | ||
|
||
testCompile "io.ratpack:ratpack-groovy-test:${ratpackVersion}" | ||
//Note cassandra unit pulls in netty-all which may need changed if the version conflicts with Ratpacks | ||
testCompile 'org.cassandraunit:cassandra-unit:3.0.0.1' | ||
} |
33 changes: 33 additions & 0 deletions
33
...ra-tracing/src/main/java/smartthings/ratpack/cassandra/zipkin/CassandraTracingModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package smartthings.ratpack.cassandra.zipkin; | ||
|
||
import com.datastax.driver.core.Session; | ||
import com.google.inject.Scopes; | ||
import smartthings.ratpack.cassandra.CassandraHealthCheck; | ||
import smartthings.ratpack.cassandra.CassandraModule; | ||
import smartthings.ratpack.cassandra.CassandraService; | ||
import smartthings.ratpack.cassandra.RatpackSession; | ||
|
||
public class CassandraTracingModule extends CassandraModule { | ||
|
||
@Override | ||
protected void configure() { | ||
bind(TracedSession.class).in(Scopes.SINGLETON); | ||
bind(Session.class).to(TracedSession.class); | ||
bind(RatpackSession.class).to(TracedSession.class); | ||
bind(CassandraService.class).in(Scopes.SINGLETON); | ||
bind(CassandraHealthCheck.class).in(Scopes.SINGLETON); | ||
} | ||
|
||
public static class Config extends CassandraModule.Config { | ||
String serviceName; | ||
|
||
public String getServiceName() { | ||
return serviceName; | ||
} | ||
|
||
public void setServiceName(String serviceName) { | ||
this.serviceName = serviceName; | ||
} | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...k-cassandra-tracing/src/main/java/smartthings/ratpack/cassandra/zipkin/TracedSession.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package smartthings.ratpack.cassandra.zipkin; | ||
|
||
import com.datastax.driver.core.Cluster; | ||
import com.datastax.driver.core.Session; | ||
import com.github.kristofa.brave.Brave; | ||
import com.google.inject.Inject; | ||
import smartthings.ratpack.cassandra.AbstractSession; | ||
|
||
public final class TracedSession extends AbstractSession { | ||
|
||
private final Brave brave; | ||
private final Cluster cluster; | ||
private final String keyspace; | ||
private final CassandraTracingModule.Config config; | ||
|
||
@Inject | ||
public TracedSession(Cluster cluster, Brave brave, CassandraTracingModule.Config config) { | ||
super(cluster, config.getKeyspace()); | ||
this.brave = brave; | ||
this.cluster = cluster; | ||
this.keyspace = config.getKeyspace(); | ||
this.config = config; | ||
} | ||
|
||
protected Session createDelegate() { | ||
Session session = (keyspace != null && !keyspace.equals("")) ? cluster.connect(keyspace) : cluster.connect(); | ||
|
||
return smartthings.brave.cassandra.TracedSession.create(session, brave, config.getServiceName()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
include 'ratpack-cassandra' | ||
include 'ratpack-cassandra-rx' | ||
include 'ratpack-cassandra-migrate' | ||
include 'ratpack-cassandra-tracing' | ||
|
||
rootProject.name='ratpack-cassandra-parent' | ||
|