Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
20 changes: 10 additions & 10 deletions sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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
Expand Down