From ba6260dd7583c1cca4b9dcadc83d7c2c434c323c Mon Sep 17 00:00:00 2001 From: Tristan Garwood Date: Tue, 7 Mar 2023 16:58:53 -0500 Subject: [PATCH 1/2] ID-361 Add breadcrumbs and release hash for sentry. --- build.sbt | 3 ++- src/main/resources/logback.xml | 1 + src/main/scala/thurloe/Main.scala | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 00f1bf89..56ac8424 100644 --- a/build.sbt +++ b/build.sbt @@ -23,7 +23,8 @@ libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % "3.9.5", "com.typesafe.akka" %% "akka-http-spray-json" % "10.2.9", "com.google.protobuf" % "protobuf-java" % "4.0.0-rc-2", - "io.sentry" % "sentry" % "6.9.2", + "io.sentry" % "sentry" % "6.15.0", + "io.sentry" % "sentry-logback" % "6.15.0", "org.broadinstitute.dsde.workbench" %% "workbench-google" % workbenchGoogleV exclude("com.typesafe.akka", "akka-protobuf-v3_2.13") exclude("com.google.protobuf", "protobuf-java") diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 81464542..6e7cec67 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -35,6 +35,7 @@ ERROR + DEBUG diff --git a/src/main/scala/thurloe/Main.scala b/src/main/scala/thurloe/Main.scala index b8124c37..b600c69d 100644 --- a/src/main/scala/thurloe/Main.scala +++ b/src/main/scala/thurloe/Main.scala @@ -16,10 +16,13 @@ import scala.concurrent.ExecutionContext.Implicits.global import scala.jdk.CollectionConverters._ object Main extends App { + val releaseHash: Option[String] = sys.env.get("GIT_SHA") sys.env.get("SENTRY_DSN").foreach { dsn => val options = new SentryOptions() options.setDsn(dsn) options.setEnvironment(sys.env.getOrElse("SENTRY_ENVIRONMENT", "unknown")) + releaseHash.foreach(options.setRelease) + Sentry.init(options) } From b196897424dfa9ac906457dca55bdc564e08e8cb Mon Sep 17 00:00:00 2001 From: Tristan Garwood Date: Tue, 7 Mar 2023 17:07:35 -0500 Subject: [PATCH 2/2] ID-361 Add breadcrumbs and release hash for sentry. --- src/main/resources/logback.xml | 2 +- src/main/scala/thurloe/Main.scala | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 6e7cec67..1bd54dbb 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -31,7 +31,7 @@ - + ERROR diff --git a/src/main/scala/thurloe/Main.scala b/src/main/scala/thurloe/Main.scala index b600c69d..e41726cf 100644 --- a/src/main/scala/thurloe/Main.scala +++ b/src/main/scala/thurloe/Main.scala @@ -16,12 +16,13 @@ import scala.concurrent.ExecutionContext.Implicits.global import scala.jdk.CollectionConverters._ object Main extends App { - val releaseHash: Option[String] = sys.env.get("GIT_SHA") + val version: Option[String] = Option(getClass.getPackage.getImplementationVersion) + sys.env.get("SENTRY_DSN").foreach { dsn => val options = new SentryOptions() options.setDsn(dsn) options.setEnvironment(sys.env.getOrElse("SENTRY_ENVIRONMENT", "unknown")) - releaseHash.foreach(options.setRelease) + options.setRelease(version.getOrElse("unknown")) Sentry.init(options) }