Skip to content

Commit

Permalink
Sentry integration
Browse files Browse the repository at this point in the history
  • Loading branch information
akolesen committed Feb 21, 2024
1 parent dd73252 commit 9b87f89
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'de.undercouch.download' version '5.1.2'
id 'java'
id 'jacoco'
id 'io.sentry.jvm.gradle' version '4.3.0'
}

jar {
Expand All @@ -20,6 +21,16 @@ repositories {
mavenCentral()
}

sentry {
org = System.getenv("SENTRY_ORG")
projectName = "disaster-ninja-be"
authToken = System.getenv("SENTRY_AUTH_TOKEN")
// 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 = System.getenv("SENTRY_AUTH_TOKEN") ? true : false
}

dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.24'
compileOnly 'org.projectlombok:lombok:1.18.24'
Expand Down Expand Up @@ -58,6 +69,16 @@ dependencies {
testImplementation 'com.jayway.jsonpath:json-path-assert:2.7.0'
}

tasks.configureEach {
if (name == "generateSentryBundleIdJava") {
mustRunAfter(tasks.generateMainServiceApolloSources)
}
if (name == "sentryCollectSourcesJava") {
mustRunAfter(tasks.generateMainServiceApolloSources)
mustRunAfter(tasks.generateTestServiceApolloSources)
}
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group.startsWith('com.fasterxml.jackson')) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.kontur.disasterninja;

import io.sentry.Sentry;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,9 @@ graphql:
keepAliveDuration: 300
connectionTimeout: 300
readTimeout: 300

sentry:
dsn: https://[email protected]/project-id
# Set traces-sample-rate to 1.0 to capture 100% of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces-sample-rate: 1.0

0 comments on commit 9b87f89

Please sign in to comment.