diff options
author | John St John <johnthesaintjohn@gmail.com> | 2017-10-05 15:39:30 -0700 |
---|---|---|
committer | John St John <johnthesaintjohn@gmail.com> | 2017-10-05 15:39:30 -0700 |
commit | 84a67e00581aecb0a7d440a8730834944e4829eb (patch) | |
tree | 05e5b4fa2d0b1d907689e9610fa823c9e636c8bf /src/main/scala/xyz/driver/core/trace/GoogleStackdriverTrace.scala | |
parent | db83f93f8e63211b538d371f83c780fc01239770 (diff) | |
download | driver-core-84a67e00581aecb0a7d440a8730834944e4829eb.tar.gz driver-core-84a67e00581aecb0a7d440a8730834944e4829eb.tar.bz2 driver-core-84a67e00581aecb0a7d440a8730834944e4829eb.zip |
cleanup logging, remove old tracing, use new tracing library
Diffstat (limited to 'src/main/scala/xyz/driver/core/trace/GoogleStackdriverTrace.scala')
-rw-r--r-- | src/main/scala/xyz/driver/core/trace/GoogleStackdriverTrace.scala | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/main/scala/xyz/driver/core/trace/GoogleStackdriverTrace.scala b/src/main/scala/xyz/driver/core/trace/GoogleStackdriverTrace.scala deleted file mode 100644 index fe4bb5c..0000000 --- a/src/main/scala/xyz/driver/core/trace/GoogleStackdriverTrace.scala +++ /dev/null @@ -1,56 +0,0 @@ -package xyz.driver.core.trace - -import java.io.FileInputStream -import java.nio.file.{Files, Paths} -import java.util - -import akka.http.scaladsl.model.HttpRequest -import com.google.auth.oauth2.GoogleCredentials -import com.google.cloud.trace.grpc.v1.GrpcTraceConsumer -import com.google.cloud.trace.v1.consumer.TraceConsumer -import com.typesafe.scalalogging.Logger - -final class GoogleStackdriverTrace(projectId: String, - clientSecretsFile: String, - appName: String, - appEnvironment: String, - log: Logger, - bufferSize: Int = 1024, - scheduledDelay: Int = 15) - extends GoogleServiceTracer { - - // initialize our various tracking storage systems - private val clientSecretsInputStreamOpt: Option[FileInputStream] = if (Files.exists(Paths.get(clientSecretsFile))) { - Some(new FileInputStream(clientSecretsFile)) - } else { - None - } - // if the google credentials are invalid, just log the traces - private val traceConsumer: TraceConsumer = clientSecretsInputStreamOpt.fold[TraceConsumer] { - log.warn(s"Google credentials not found in path: $clientSecretsFile") - new LoggingTraceConsumer(log) - } { clientSecretsInputStream => - GrpcTraceConsumer - .createWithCredentials( - GoogleCredentials - .fromStream(clientSecretsInputStream) - .createScoped(util.Arrays.asList("https://www.googleapis.com/auth/trace.append")) - ) - } - - private val googleServiceTracer = - new GoogleStackdriverTraceWithConsumer(projectId, - appName, - appEnvironment, - traceConsumer, - log, - bufferSize, - scheduledDelay) - - override def startSpan(httpRequest: HttpRequest): GoogleStackdriverTraceSpan = - googleServiceTracer.startSpan(httpRequest) - - override def endSpan(span: GoogleStackdriverTraceSpan): Unit = googleServiceTracer.endSpan(span) - - override def flush(): Unit = googleServiceTracer.flush() -} |