From 843b48c2ee32557739a54da589ebbeacf1ed04f4 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 1 Oct 2020 04:08:25 +0200 Subject: [PATCH 1/2] Update sentry to 3.0.0 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 43e1b705a..4543cd899 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -30,7 +30,7 @@ object Dependencies { val scalafixScaluzzi = "com.github.vovapolu" %% "scaluzzi" % "0.1.14" val scalafixSortImports = "com.nequissimus" %% "sort-imports" % "0.5.4" val scalaTest = "org.scalatest" %% "scalatest" % "3.2.2" - val sentry = "io.sentry" % "sentry" % "1.7.30" + val sentry = "io.sentry" % "sentry" % "3.0.0" val silencer = "com.github.ghik" % "silencer-plugin" % Versions.silencer cross CrossVersion.full val silencerLib = "com.github.ghik" % "silencer-lib" % Versions.silencer % Provided cross CrossVersion.full val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.30" From 08285d4f5f3998bde13719304bca247fb15d9d46 Mon Sep 17 00:00:00 2001 From: Janecek Jakub Date: Fri, 2 Oct 2020 09:51:51 +0200 Subject: [PATCH 2/2] refactor: Update SentryModule to work with new major version of Sentry BREAKING CHANGE: Tags can no longer be set globally --- .../com/avast/sst/sentry/SentryConfig.scala | 1 - .../com/avast/sst/sentry/SentryModule.scala | 20 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sentry/src/main/scala/com/avast/sst/sentry/SentryConfig.scala b/sentry/src/main/scala/com/avast/sst/sentry/SentryConfig.scala index ba08dbe28..63bd3457a 100644 --- a/sentry/src/main/scala/com/avast/sst/sentry/SentryConfig.scala +++ b/sentry/src/main/scala/com/avast/sst/sentry/SentryConfig.scala @@ -6,6 +6,5 @@ final case class SentryConfig( environment: Option[String] = None, distribution: Option[String] = None, serverName: Option[String] = None, - tags: Map[String, String] = Map.empty, stacktraceAppPackages: List[String] = List.empty ) diff --git a/sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala b/sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala index bf053afd8..9fa6c112d 100644 --- a/sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala +++ b/sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala @@ -1,9 +1,8 @@ package com.avast.sst.sentry import cats.effect.{Resource, Sync} -import io.sentry.{SentryClient, SentryClientFactory} +import io.sentry.{SentryClient, SentryOptions} -import scala.jdk.CollectionConverters._ import scala.reflect.ClassTag object SentryModule { @@ -14,15 +13,16 @@ object SentryModule { Sync[F].delay { val dsnCustomizations = s"${config.stacktraceAppPackages.mkString("stacktrace.app.packages=", ",", "")}" val finalDsn = if (dsnCustomizations.nonEmpty) s"${config.dsn}?$dsnCustomizations" else config.dsn - val sentryClient = SentryClientFactory.sentryClient(finalDsn) - config.release.foreach(sentryClient.setRelease) - config.environment.foreach(sentryClient.setEnvironment) - config.distribution.foreach(sentryClient.setDist) - config.serverName.foreach(sentryClient.setServerName) - sentryClient.setTags(config.tags.asJava) - sentryClient + val options = new SentryOptions() + options.setDsn(finalDsn) + config.release.foreach(options.setRelease) + config.environment.foreach(options.setEnvironment) + config.distribution.foreach(options.setDist) + config.serverName.foreach(options.setServerName) + + new SentryClient(options, null) } - }(sentry => Sync[F].delay(sentry.closeConnection())) + }(sentry => Sync[F].delay(sentry.close())) } /** Makes [[io.sentry.SentryClient]] initialized with the given config and overrides the `release` property