11package ru.endlesscode.inspector.report
22
3+ import io.sentry.Integration
34import io.sentry.Sentry
45import io.sentry.SentryEvent
56import io.sentry.protocol.Message
@@ -10,6 +11,7 @@ import io.sentry.protocol.User
1011 */
1112public class SentryReporter private constructor(
1213 dsn : String ,
14+ integrations : List <Integration >,
1315 override val focus : ReporterFocus ,
1416 private val fields : Set <ReportField >,
1517) : Reporter {
@@ -21,9 +23,10 @@ public class SentryReporter private constructor(
2123 init {
2224 Sentry .init { options ->
2325 options.dsn = dsn
24- options.release = focus.environment.appVersion
26+ options.release = " ${ focus.environment.appName} @ ${focus.environment. appVersion} "
2527 options.addInAppInclude(focus.focusedPackage)
2628 options.enableUncaughtExceptionHandler = false
29+ integrations.forEach(options::addIntegration)
2730 }
2831
2932 Sentry .configureScope { scope ->
@@ -63,6 +66,7 @@ public class SentryReporter private constructor(
6366 public class Builder : Reporter .Builder () {
6467
6568 private var dsn: String = " "
69+ private val integrations = mutableListOf<Integration >()
6670
6771 /* *
6872 * Set Sentry [dsn].
@@ -101,6 +105,12 @@ public class SentryReporter private constructor(
101105 return setDsn(dsn)
102106 }
103107
108+ /* * Adds given [integration] to Sentry. */
109+ public fun addIntegration (integration : Integration ): Builder {
110+ this .integrations.add(integration)
111+ return this
112+ }
113+
104114 /* *
105115 * Build configured [SentryReporter].
106116 */
@@ -111,6 +121,7 @@ public class SentryReporter private constructor(
111121
112122 return SentryReporter (
113123 dsn = dsn,
124+ integrations = integrations,
114125 focus = focus,
115126 fields = fields
116127 )
0 commit comments