Skip to content

Commit

Permalink
Add Sentry monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
pvannierop committed Sep 11, 2024
1 parent c97ea7d commit 88fc634
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
12 changes: 12 additions & 0 deletions data-dashboard-backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
kotlin("plugin.noarg")
kotlin("plugin.jpa")
kotlin("plugin.allopen")
id("io.sentry.jvm.gradle") version "4.10.0"
}

application {
Expand All @@ -19,6 +20,7 @@ dependencies {
runtimeOnly("org.postgresql:postgresql:${Versions.postgresql}")
}
implementation("org.radarbase:radar-commons-kotlin:${Versions.radarCommons}")
annotationProcessor("org.apache.logging.log4j:log4j-core:2.20.0")

testImplementation("org.mockito:mockito-core:${Versions.mockitoKotlin}")
testImplementation("org.mockito.kotlin:mockito-kotlin:${Versions.mockitoKotlin}")
Expand All @@ -32,3 +34,13 @@ allOpen {
annotation("jakarta.persistence.MappedSuperclass")
annotation("jakarta.persistence.Embeddable")
}

sentry {
// Generates a JVM (Java, Kotlin, etc.) source bundle and uploads your source code to Sentry.
// This enables source context, allowing you to see your source
// code as part of your stack traces in Sentry.
includeSourceContext = true
org = "radar-base"
projectName = "data-dashboard-backend"
authToken = System.getenv("SENTRY_AUTH_TOKEN")
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package org.radarbase.datadashboard.api

import io.sentry.Sentry
import io.sentry.SentryOptions
import org.radarbase.datadashboard.api.config.DashboardApiConfig
import org.radarbase.jersey.GrizzlyServer
import org.radarbase.jersey.config.ConfigLoader
Expand Down
39 changes: 39 additions & 0 deletions data-dashboard-backend/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ /*
~ * Copyright 2024 The Hyve
~ *
~ * Licensed under the Apache License, Version 2.0 (the "License");
~ * you may not use this file except in compliance with the License.
~ * You may obtain a copy of the License at
~ *
~ * http://www.apache.org/licenses/LICENSE-2.0
~ *
~ * Unless required by applicable law or agreed to in writing, software
~ * distributed under the License is distributed on an "AS IS" BASIS,
~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ * See the License for the specific language governing permissions and
~ * limitations under the License.
~ */
-->

<configuration status="warn">
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout
pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
/>
</Console>
<!-- For Sentry to work the DSN must be set via SENTRY_DSN environment variable
When SENTRY_DSN is empty string, the Sentry SDK is disabled -->
<Sentry name="Sentry" debug="false"/>
</appenders>

<loggers>
<root level="INFO">
<appender-ref ref="Console" />
<!-- Note that the Sentry logging threshold is overridden to the WARN level -->
<appender-ref ref="Sentry" level="WARN" />
</root>
</loggers>
</configuration>

0 comments on commit 88fc634

Please sign in to comment.