Permalink
Browse files

Upgrade to Finagle 1.9.5. Pass in Tracer.Factory to TracingQuery

  • Loading branch information...
1 parent 6d457b6 commit 6b44a7d70241aa9d5bc4eb4360fc614fb1643149 @johanoskarsson johanoskarsson committed Nov 8, 2011
@@ -29,7 +29,7 @@ with SubversionPublisher {
with SubversionPublisher
val utilVersion = "1.11.8"
- val finagleVersion = "1.9.2"
+ val finagleVersion = "1.9.5"
class CoreProject(info: ProjectInfo) extends StandardLibraryProject(info) with Defaults {
val utilCore = "com.twitter" % "util-core" % utilVersion
@@ -10,7 +10,9 @@ import java.net.{UnknownHostException, InetSocketAddress, InetAddress}
* This data is then processed and sent off with a Finagle compatible tracer.
*/
class TracingQuery(query: Query, connection: Connection, queryClass: QueryClass,
- serviceName: String, tracer: Tracer) extends QueryProxy(query: Query) {
+ serviceName: String, tracerFactory: Tracer.Factory) extends QueryProxy(query: Query) {
+
+ val tracer = tracerFactory()
override protected def delegate[A](f: => A) = {
Trace.unwind {
@@ -46,11 +48,11 @@ class TracingQuery(query: Query, connection: Connection, queryClass: QueryClass,
}
}
-class TracingQueryFactory(queryFactory: QueryFactory, serviceName: String, tracer: Tracer)
- extends QueryFactory {
+class TracingQueryFactory(queryFactory: QueryFactory, serviceName: String,
+ tracerFactory: Tracer.Factory) extends QueryFactory {
def apply(connection: Connection, queryClass: QueryClass, query: String, params: Any*) = {
new TracingQuery(queryFactory(connection, queryClass, query, params: _*),
- connection, queryClass, serviceName, tracer)
+ connection, queryClass, serviceName, tracerFactory)
@freels

freels Nov 9, 2011

perhaps continue to pass in an instantiated tracer here.

}
}
@@ -22,7 +22,8 @@ class TracingQuerySpec extends Specification with JMocker {
}
val query = new SqlQuery(connection, queryString)
- val tracingQuery = new TracingQuery(query, connection, QueryClass.Select, "service", tracer)
+ val tracingQuery = new TracingQuery(query, connection, QueryClass.Select,
+ "service", () => tracer)
tracingQuery.execute()
}
}

0 comments on commit 6b44a7d

Please sign in to comment.