aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@driver.xyz>2017-10-02 16:08:24 -0700
committerJakob Odersky <jakob@driver.xyz>2017-10-02 16:08:24 -0700
commitdf2c41dac7d29dea49950700b0146229947fdf65 (patch)
treed5e09ac2d1f1527e965f92d5733a5761acf8edb1
parent7f4a7648894be1f07300f6d66f00ff443dc83826 (diff)
downloadtracing-df2c41dac7d29dea49950700b0146229947fdf65.tar.gz
tracing-df2c41dac7d29dea49950700b0146229947fdf65.tar.bz2
tracing-df2c41dac7d29dea49950700b0146229947fdf65.zip
Minor style changes
-rw-r--r--README.md1
-rw-r--r--src/main/scala/GoogleTracer.scala5
-rw-r--r--src/main/scala/google/OAuth2.scala8
-rw-r--r--src/main/scala/google/api.scala6
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 {