-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bootstrap.kt
39 lines (33 loc) · 1.24 KB
/
Bootstrap.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.example.common
import io.micronaut.context.annotation.Value
import io.micronaut.runtime.event.annotation.EventListener
import io.micronaut.runtime.server.event.ServerStartupEvent
import io.sentry.Sentry
import io.sentry.SentryOptions
import jakarta.inject.Inject
import jakarta.inject.Singleton
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@Singleton
class Bootstrap {
val log: Logger = LoggerFactory.getLogger("Bootstrap")
@Inject
lateinit var sentryDsn: SentryConfiguration
@EventListener
fun onStartupEvent(event: ServerStartupEvent) {
configureSentry()
log.info("This Event got trigger during Startup")
log.error("This Dummy Event got trigger during Startup")
log.error("This Event got trigger during Startup")
}
private fun configureSentry() {
Sentry.init { options: SentryOptions ->
options.dsn = sentryDsn.dsn
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0
// When first trying Sentry it's good to see what the SDK is doing:
// options.setDebug(true)
}
}
}