Skip to content
Draft
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
14 changes: 4 additions & 10 deletions .cursor/rules/new_module.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,10 @@ the release that first ships it. All of the following have to be merged **before

2. Add the module to the include list in `settings.gradle.kts`

If adding a `sentry-samples` module, also add it to the `ignoredProjects` list in the root `build.gradle.kts`:

```kotlin
ignoredProjects.addAll(
listOf(
// ... existing projects ...
"sentry-samples-{module-name}"
)
)
```
If adding a sample, add it to the include list in `sentry-samples/settings.gradle.kts` instead. The
samples are a separate Gradle build that includes the SDK build, so a sample depends on
`"io.sentry:sentry-{module-name}:$sentryVersion"` (with `val sentryVersion =
libs.versions.sentry.get()`), and Gradle substitutes the SDK's project for it.

3. Add a `SENTRY_{MODULE}_SDK_NAME` constant to the `Config.Sentry` block in
`buildSrc/src/main/java/Config.kt`:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- name: Format with spotlessApply
run: |
./gradlew spotlessApply
./gradlew -p sentry-samples spotlessApply
./gradlew -p sentry-samples/sentry-samples-android spotlessApply
./gradlew -p sentry-android-integration-tests spotlessApply

Expand Down
5 changes: 4 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ resolves the per-module test task, including integration test suites, for you.

# Build the Android sample, a separate Gradle build that includes this one
./gradlew -p sentry-samples/sentry-samples-android assembleDebug

# Build the JVM samples, another separate Gradle build that includes this one
./gradlew -p sentry-samples assemble
```

## Development Workflow Rules
Expand Down Expand Up @@ -113,7 +116,7 @@ The repository is organized into multiple modules:

### Utility Modules
- **`sentry-test-support`** - Shared test utilities, including `MockSentryServer` and envelope matchers
- **`sentry-samples`** - Example applications. `sentry-samples-android` is a separate Gradle build that includes this one, so root tasks such as `check` and `spotlessApply` don't reach it
- **`sentry-samples`** - Example applications, in two separate Gradle builds that include this one: `sentry-samples` (JVM) and `sentry-samples/sentry-samples-android`. Root tasks such as `check` and `spotlessApply` don't reach them, and `sentry-android-integration-tests` is a separate build too
- **`sentry-bom`** - Bill of Materials for dependency management

### Key Architectural Patterns
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check checkSampleAndroid checkIntegrationTests preMerge publish
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check checkSamples checkSampleAndroid checkIntegrationTests preMerge publish

all: stop clean javadocs compile
assembleUiTests: assembleUiTestRelease
preMerge: check checkSampleAndroid checkIntegrationTests
preMerge: check checkSamples checkSampleAndroid checkIntegrationTests
publish: clean dryRelease

# deep clean
Expand All @@ -29,6 +29,7 @@ update:
# Spotless check's code
checkFormat:
./gradlew spotlessJavaCheck spotlessKotlinCheck
./gradlew -p sentry-samples spotlessJavaCheck spotlessKotlinCheck
./gradlew -p sentry-samples/sentry-samples-android spotlessJavaCheck spotlessKotlinCheck
./gradlew -p sentry-android-integration-tests spotlessJavaCheck spotlessKotlinCheck

Expand All @@ -52,6 +53,10 @@ runUiTestCritical:
check:
./gradlew check

# The samples are separate builds, so the root `check` doesn't reach them
checkSamples:
./gradlew -p sentry-samples check

# The Android sample is a separate build, so the root `check` doesn't reach it
checkSampleAndroid:
./gradlew -p sentry-samples/sentry-samples-android check
Expand Down
34 changes: 2 additions & 32 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,6 @@ apiValidation {
)
ignoredProjects.addAll(
listOf(
"sentry-samples-console",
"sentry-samples-console-opentelemetry-noagent",
"sentry-samples-jul",
"sentry-samples-log4j2",
"sentry-samples-logback",
"sentry-samples-openfeign",
"sentry-samples-servlet",
"sentry-samples-spring",
"sentry-samples-spring-jakarta",
"sentry-samples-spring-7",
"sentry-samples-spring-boot",
"sentry-samples-spring-boot-opentelemetry",
"sentry-samples-spring-boot-opentelemetry-noagent",
"sentry-samples-spring-boot-jakarta",
"sentry-samples-spring-boot-jakarta-log4j2",
"sentry-samples-spring-boot-jakarta-opentelemetry",
"sentry-samples-spring-boot-jakarta-opentelemetry-noagent",
"sentry-samples-spring-boot-webflux",
"sentry-samples-spring-boot-webflux-jakarta",
"sentry-samples-spring-boot-4",
"sentry-samples-spring-boot-4-log4j2",
"sentry-samples-spring-boot-4-opentelemetry",
"sentry-samples-spring-boot-4-opentelemetry-noagent",
"sentry-samples-spring-boot-4-otlp",
"sentry-samples-spring-boot-4-webflux",
"sentry-samples-ktor-client",
"sentry-samples-netflix-dgs",
"sentry-samples-console-otlp",
"sentry-test-support"
)
)
Expand Down Expand Up @@ -113,7 +85,7 @@ subprojects {
}
}

if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-test-support") {
if (this.name != "sentry-test-support") {
apply<DistributionPlugin>()
apply<com.vanniktech.maven.publish.MavenPublishPlugin>()

Expand Down Expand Up @@ -187,9 +159,7 @@ subprojects {
tasks.register("buildForCodeQL") {
subprojects
.filter {
!it.displayName.contains("sample") &&
!it.displayName.contains("integration-tests") &&
!it.displayName.contains("bom") &&
!it.displayName.contains("bom") &&
it.name != "sentry-opentelemetry"
}
.forEach { proj ->
Expand Down
15 changes: 15 additions & 0 deletions sentry-samples/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Loads the shared plugins once for every sample, so they all share one classpath. The Spring Boot
// plugin is applied in each sample instead, because the samples use different versions of it.
plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.spring) apply false
alias(libs.plugins.spring.dependency.management) apply false
alias(libs.plugins.gradle.versions) apply false
id("io.sentry.spotless") apply false
id("io.sentry.jdk-target") apply false
}

subprojects {
apply(plugin = "io.sentry.spotless")
apply(plugin = "io.sentry.jdk-target")
}
13 changes: 13 additions & 0 deletions sentry-samples/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Gradle properties are per build, so this repeats what the samples need from the SDK build's
# gradle.properties. settings.gradle.kts reads the SDK version from that file.

org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=2g -XX:+CrashOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true

kotlin.stdlib.default.dependency=false

systemProp.org.gradle.internal.http.socketTimeout=120000
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ plugins {
alias(libs.plugins.shadow)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.console.Main") }

dependencies {
implementation(projects.sentryOpentelemetry.sentryOpentelemetryAgentless)
implementation(projects.sentryAsyncProfiler)
implementation("io.sentry:sentry-opentelemetry-agentless:$sentryVersion")
implementation("io.sentry:sentry-async-profiler:$sentryVersion")
}

// Configure the Shadow JAR (executable JAR with all dependencies)
Expand Down
6 changes: 4 additions & 2 deletions sentry-samples/sentry-samples-console-otlp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ plugins {
alias(libs.plugins.shadow)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.console.Main") }

dependencies {
implementation(projects.sentryOpentelemetry.sentryOpentelemetryOtlp)
implementation(projects.sentryAsyncProfiler)
implementation("io.sentry:sentry-opentelemetry-otlp:$sentryVersion")
implementation("io.sentry:sentry-async-profiler:$sentryVersion")
implementation(libs.otel.semconv)
implementation(libs.otel.semconv.incubating)
implementation(libs.otel.exporter.logging)
Expand Down
10 changes: 6 additions & 4 deletions sentry-samples/sentry-samples-console/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ plugins {
alias(libs.plugins.shadow)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.console.Main") }

dependencies {
implementation(projects.sentry)
implementation(projects.sentryAsyncProfiler)
implementation(projects.sentryJcache)
implementation(projects.sentryKafka)
implementation("io.sentry:sentry:$sentryVersion")
implementation("io.sentry:sentry-async-profiler:$sentryVersion")
implementation("io.sentry:sentry-jcache:$sentryVersion")
implementation("io.sentry:sentry-kafka:$sentryVersion")
implementation(libs.jcache)
implementation(libs.caffeine.jcache)
implementation(libs.kafka.clients)
Expand Down
4 changes: 3 additions & 1 deletion sentry-samples/sentry-samples-jul/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ plugins {
alias(libs.plugins.shadow)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.jul.Main") }

dependencies {
implementation(projects.sentryJul)
implementation("io.sentry:sentry-jul:$sentryVersion")
implementation(libs.slf4j.jdk14)
}

Expand Down
6 changes: 4 additions & 2 deletions sentry-samples/sentry-samples-ktor-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {
alias(libs.plugins.gradle.versions)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.ktorClient.Main") }

configure<JavaPluginExtension> {
Expand All @@ -19,8 +21,8 @@ dependencies {
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.java)
implementation(libs.kotlinx.coroutines)
implementation(projects.sentry)
implementation(projects.sentryKtorClient)
implementation("io.sentry:sentry:$sentryVersion")
implementation("io.sentry:sentry-ktor-client:$sentryVersion")
}

tasks.test { useJUnitPlatform() }
4 changes: 3 additions & 1 deletion sentry-samples/sentry-samples-log4j2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ plugins {
alias(libs.plugins.shadow)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.log4j2.Main") }

dependencies {
implementation(projects.sentryLog4j2)
implementation("io.sentry:sentry-log4j2:$sentryVersion")
implementation(libs.log4j.api)
implementation(libs.log4j.core)
}
Expand Down
4 changes: 3 additions & 1 deletion sentry-samples/sentry-samples-logback/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ plugins {
alias(libs.plugins.shadow)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.logback.Main") }

dependencies {
implementation(projects.sentryLogback)
implementation("io.sentry:sentry-logback:$sentryVersion")
implementation(libs.logback.classic)
}

Expand Down
6 changes: 4 additions & 2 deletions sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ plugins {
alias(libs.plugins.kotlin.spring)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.netflix.dgs.NetlixDgsApplication") }

group = "io.sentry.sample.spring-boot"
Expand All @@ -25,8 +27,8 @@ dependencies {
implementation(libs.springboot.starter.web)
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation(kotlin("stdlib-jdk8", getKotlinPluginVersion()))
implementation(projects.sentrySpringBootStarter)
implementation(projects.sentryGraphql)
implementation("io.sentry:sentry-spring-boot-starter:$sentryVersion")
implementation("io.sentry:sentry-graphql:$sentryVersion")
implementation(platform("com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:4.9.2"))
implementation("com.netflix.graphql.dgs:graphql-dgs-subscriptions-websockets-autoconfigure:4.9.2")
implementation("com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter")
Expand Down
6 changes: 4 additions & 2 deletions sentry-samples/sentry-samples-openfeign/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {
alias(libs.plugins.gradle.versions)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.openfeign.Main") }

configure<JavaPluginExtension> {
Expand All @@ -12,8 +14,8 @@ configure<JavaPluginExtension> {
}

dependencies {
implementation(projects.sentry)
implementation(projects.sentryOpenfeign)
implementation("io.sentry:sentry:$sentryVersion")
implementation("io.sentry:sentry-openfeign:$sentryVersion")
implementation(libs.feign.core)
implementation(libs.feign.gson)
}
4 changes: 3 additions & 1 deletion sentry-samples/sentry-samples-servlet/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8

dependencies {
implementation(projects.sentryServlet)
implementation("io.sentry:sentry-servlet:$sentryVersion")
implementation("javax.servlet:javax.servlet-api:4.0.1")
}

val sentryVersion = libs.versions.sentry.get()

tasks.withType<Test>().configureEach { useJUnitPlatform() }
8 changes: 5 additions & 3 deletions sentry-samples/sentry-samples-spring-7/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ plugins {
alias(libs.plugins.gretty)
}

val sentryVersion = libs.versions.sentry.get()

application { mainClass.set("io.sentry.samples.spring7.Main") }

// Ensure WAR is up to date before run task
Expand All @@ -36,9 +38,9 @@ dependencies {
implementation("org.springframework.security:spring-security-config")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation(kotlin("stdlib-jdk8", getKotlinPluginVersion()))
implementation(projects.sentrySpring7)
implementation(projects.sentryLogback)
implementation(projects.sentryAsyncProfiler)
implementation("io.sentry:sentry-spring-7:$sentryVersion")
implementation("io.sentry:sentry-logback:$sentryVersion")
implementation("io.sentry:sentry-async-profiler:$sentryVersion")
implementation(libs.jackson.databind)
implementation(libs.logback.classic)
implementation(libs.servlet.jakarta.api)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ plugins {
alias(libs.plugins.kotlin.spring)
}

val sentryVersion = libs.versions.sentry.get()

group = "io.sentry.sample.spring-boot-4-log4j2"

version = "0.0.1-SNAPSHOT"
Expand Down Expand Up @@ -39,12 +41,12 @@ dependencies {
implementation("org.aspectj:aspectjweaver")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation(kotlin("stdlib-jdk8", getKotlinPluginVersion()))
implementation(projects.sentrySpringBoot4Starter)
implementation(projects.sentryGraphql22)
implementation(projects.sentryQuartz)
implementation(projects.sentryAsyncProfiler)
implementation("io.sentry:sentry-spring-boot-4-starter:$sentryVersion")
implementation("io.sentry:sentry-graphql-22:$sentryVersion")
implementation("io.sentry:sentry-quartz:$sentryVersion")
implementation("io.sentry:sentry-async-profiler:$sentryVersion")

implementation(projects.sentryLog4j2)
implementation("io.sentry:sentry-log4j2:$sentryVersion")
implementation("org.springframework.boot:spring-boot-starter-log4j2")
modules {
module("org.springframework.boot:spring-boot-starter-logging") {
Expand All @@ -61,9 +63,9 @@ dependencies {

// kafka
implementation(libs.springboot4.starter.kafka)
implementation(projects.sentryKafka)
implementation("io.sentry:sentry-kafka:$sentryVersion")

// database query tracing
implementation(projects.sentryJdbc)
implementation("io.sentry:sentry-jdbc:$sentryVersion")
runtimeOnly(libs.hsqldb)
}
Loading
Loading