From df2c41dac7d29dea49950700b0146229947fdf65 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 2 Oct 2017 16:08:24 -0700 Subject: Minor style changes --- README.md | 1 + src/main/scala/GoogleTracer.scala | 5 +++-- src/main/scala/google/OAuth2.scala | 8 ++++---- src/main/scala/google/api.scala | 6 ++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7ce03f3..4f705ff 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ TODO TODO ### Google Stackdriver Tracing +https://cloud.google.com/trace/docs/reference/v1/rest/v1/projects.traces#Trace TODO diff --git a/src/main/scala/GoogleTracer.scala b/src/main/scala/GoogleTracer.scala index 42fb9fd..144c0ff 100644 --- a/src/main/scala/GoogleTracer.scala +++ b/src/main/scala/GoogleTracer.scala @@ -17,7 +17,8 @@ import scala.util.control._ class GoogleTracer(projectId: String, serviceAccountFile: Path, bufferSize: Int = 1000, - concurrentConnections: Int = 1)(implicit system: ActorSystem, + bufferDelay: FiniteDuration = 2.seconds, + concurrentConnections: Int = 5)(implicit system: ActorSystem, materializer: Materializer) extends Tracer { @@ -27,7 +28,7 @@ class GoogleTracer(projectId: String, private val batchingPipeline: Flow[Span, Traces, _] = Flow[Span] - .groupedWithin(bufferSize, 1.second) + .groupedWithin(bufferSize, bufferDelay) .map { spans => val traces: Seq[Trace] = spans .groupBy(_.traceId) diff --git a/src/main/scala/google/OAuth2.scala b/src/main/scala/google/OAuth2.scala index d17ec78..ff010ef 100644 --- a/src/main/scala/google/OAuth2.scala +++ b/src/main/scala/google/OAuth2.scala @@ -29,7 +29,7 @@ object OAuth2 { /** Request a new access token for the given scopes. * - * Implements the OAUTH2 workflow as descried here + * Implements the OAUTH2 workflow as descried in * https://developers.google.com/identity/protocols/OAuth2ServiceAccount */ def requestAccessToken( @@ -89,18 +89,18 @@ object OAuth2 { http.system.log.info("tracing access token expired, refreshing") requestAccessToken(http, serviceAccountFile, scopes).map { case (newExpiration, newToken) => - http.system.log.debug("new tracing access token otained") + http.system.log.debug("new tracing access token obtained") (request, newExpiration, newToken) } } else { Future.successful((request, expiration, accessToken)) } } - .drop(1) // drop initial element + .drop(1) // drop initial, empty HttpRequest .map { case (request, _, accessToken) => request.withHeaders( - RawHeader("Authorization", "Bearer " + accessToken) + RawHeader("Authorization", s"Bearer $accessToken") ) } diff --git a/src/main/scala/google/api.scala b/src/main/scala/google/api.scala index 17db031..39fc16d 100644 --- a/src/main/scala/google/api.scala +++ b/src/main/scala/google/api.scala @@ -24,9 +24,11 @@ object TraceSpan { sealed trait SpanKind // Unspecified case object Unspecified extends SpanKind - // Indicates that the span covers server-side handling of an RPC or other remote network request. + // Indicates that the span covers server-side handling of an RPC or other + // remote network request. case object RpcServer extends SpanKind - // Indicates that the span covers the client-side wrapper around an RPC or other remote request. + // Indicates that the span covers the client-side wrapper around an RPC or + // other remote request. case object RpcClient extends SpanKind object SpanKind { -- cgit v1.2.3