Skip to content

Commit f8f3432

Browse files
Merge branch 'main' into refactor/apply-plugins-per-module [pr-shepherd]
2 parents 514edd5 + ff8c06c commit f8f3432

10 files changed

Lines changed: 97 additions & 148 deletions

File tree

‎.github/workflows/system-tests-backend.yml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ jobs:
6464
- sample: "sentry-samples-console-otlp"
6565
agent: "false"
6666
agent-auto-init: "true"
67-
- sample: "sentry-samples-logback"
68-
agent: "false"
69-
agent-auto-init: "true"
7067
- sample: "sentry-samples-log4j2"
7168
agent: "false"
7269
agent-auto-init: "true"

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## Unreleased
3+
## 8.61.1
44

55
### Fixes
66

‎devenv/config.ini‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
minimum_version = 1.22.1
33

44
[uv]
5-
darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-apple-darwin.tar.gz
6-
darwin_arm64_sha256 = 954d24634d5f37fa26c7af75eb79893d11623fc81b4de4b82d60d1ade4bfca22
7-
darwin_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-apple-darwin.tar.gz
8-
darwin_x86_64_sha256 = ae755df53c8c2c1f3dfbee6e3d2e00be0dfbc9c9b4bdffdb040b96f43678b7ce
9-
linux_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-unknown-linux-gnu.tar.gz
10-
linux_arm64_sha256 = 27da35ef54e9131c2e305de67dd59a07c19257882c6b1f3cf4d8d5fbb8eaf4ca
11-
linux_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-unknown-linux-gnu.tar.gz
12-
linux_x86_64_sha256 = 6dcb28a541868a455aefb2e8d4a1283dd6bf888605a2db710f0530cec888b0ad
5+
darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.13.4/uv-aarch64-apple-darwin.tar.gz
6+
darwin_arm64_sha256 = e0b1d4743ce64c55d9f0f4a444afa6b81125680070ee04e853fcd0f6c1ebf8f1
7+
darwin_x86_64 = https://github.com/astral-sh/uv/releases/download/0.13.4/uv-x86_64-apple-darwin.tar.gz
8+
darwin_x86_64_sha256 = 7be2dcd316122f4b3e5a0a7889f6248266c14425374e105ff7dc9779184603a6
9+
linux_arm64 = https://github.com/astral-sh/uv/releases/download/0.13.4/uv-aarch64-unknown-linux-gnu.tar.gz
10+
linux_arm64_sha256 = 1ae72b4718729e2ccc4f1ae2c6d1e531ca8467800e0546e9130b3886023a60ab
11+
linux_x86_64 = https://github.com/astral-sh/uv/releases/download/0.13.4/uv-x86_64-unknown-linux-gnu.tar.gz
12+
linux_x86_64_sha256 = 2b428396f12572d4429cf210ca234dd599a33b3af0958a4d5ed569d63e3f344f
1313
# used for autoupdate
1414
# NOTE: if using uv-build as a build backend, you'll have to make sure the versions match
15-
version = 0.8.2
15+
version = 0.13.4
1616

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ android.newDsl=false
1616
android.experimental.lint.version=9.4.0
1717

1818
# Release information
19-
versionName=8.61.0
19+
versionName=8.61.1
2020

2121
# Override the SDK name on native crashes on Android
2222
sentryAndroidSdkName=sentry.native.android
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package io.sentry.logback
2+
3+
import ch.qos.logback.classic.LoggerContext
4+
import ch.qos.logback.classic.joran.JoranConfigurator
5+
import com.google.common.truth.Truth.assertThat
6+
import io.sentry.Sentry
7+
import io.sentry.SentryLevel
8+
import io.sentry.test.MockSentryServer
9+
import io.sentry.test.event
10+
import io.sentry.test.hasFlag
11+
import io.sentry.test.logs
12+
import kotlin.test.AfterTest
13+
import kotlin.test.Test
14+
import org.slf4j.MDC
15+
16+
class SentryAppenderIntegrationTest {
17+
private val server = MockSentryServer()
18+
private val loggerContext = LoggerContext()
19+
20+
@AfterTest
21+
fun teardown() {
22+
loggerContext.stop()
23+
Sentry.close()
24+
server.close()
25+
MDC.clear()
26+
}
27+
28+
@Test
29+
fun `appender configured from XML sends events, breadcrumbs and logs`() {
30+
loggerContext.putProperty("dsn", server.dsn)
31+
JoranConfigurator()
32+
.apply { context = loggerContext }
33+
.doConfigure(javaClass.getResource("/sentry-appender-integration-test.xml"))
34+
val logger = loggerContext.getLogger(SentryAppenderIntegrationTest::class.java)
35+
36+
logger.debug("Hello Sentry!")
37+
MDC.put("userId", "user-1")
38+
Sentry.setAttribute("user.type", "admin")
39+
Sentry.setAttribute("feature.version", 2)
40+
Sentry.setAttribute("debug.enabled", true)
41+
Sentry.addFeatureFlag("my-feature-flag", true)
42+
logger.warn("important warning")
43+
logger.info("User has made a purchase of product: {}", 445)
44+
logger.error("Something went wrong", RuntimeException("Invalid productId=445"))
45+
Sentry.flush(5000)
46+
47+
val warning = server.awaitEnvelope { it.event()?.level == SentryLevel.WARNING }.event()!!
48+
assertThat(warning.message!!.message).isEqualTo("important warning")
49+
assertThat(warning.tags).containsEntry("userId", "user-1")
50+
assertThat(warning.hasFlag("my-feature-flag", true)).isTrue()
51+
52+
val error = server.awaitEnvelope { it.event()?.level == SentryLevel.ERROR }.event()!!
53+
assertThat(error.message!!.formatted).isEqualTo("Something went wrong")
54+
assertThat(error.exceptions!!.map { it.type to it.value })
55+
.contains("RuntimeException" to "Invalid productId=445")
56+
assertThat(error.breadcrumbs!!.map { it.message to it.level })
57+
.containsAtLeast(
58+
"Hello Sentry!" to SentryLevel.DEBUG,
59+
"User has made a purchase of product: 445" to SentryLevel.INFO,
60+
)
61+
62+
val logs = server.awaitEnvelope { it.logs() != null }.logs()!!
63+
assertThat(logs.items.map { it.body }).contains("User has made a purchase of product: 445")
64+
val failureLog = logs.items.single { it.body == "Something went wrong" }
65+
assertThat(failureLog.attributes!!.mapValues { it.value.value })
66+
.containsAtLeast("user.type", "admin", "feature.version", 2, "debug.enabled", true)
67+
}
68+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<configuration>
2+
<appender name="sentry" class="io.sentry.logback.SentryAppender">
3+
<options>
4+
<dsn>${dsn}</dsn>
5+
<contextTag>userId</contextTag>
6+
<logs>
7+
<enabled>true</enabled>
8+
</logs>
9+
</options>
10+
<minimumEventLevel>WARN</minimumEventLevel>
11+
<minimumBreadcrumbLevel>DEBUG</minimumBreadcrumbLevel>
12+
<minimumLevel>INFO</minimumLevel>
13+
</appender>
14+
15+
<root level="debug">
16+
<appender-ref ref="sentry"/>
17+
</root>
18+
</configuration>
Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,17 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2-
31
plugins {
42
java
53
application
6-
alias(libs.plugins.kotlin.jvm)
74
alias(libs.plugins.gradle.versions)
85
alias(libs.plugins.shadow)
9-
id("io.sentry.systemtest")
106
id("io.sentry.spotless")
117
id("io.sentry.jdk-target")
128
}
139

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

16-
tasks.withType<KotlinCompile>().configureEach {
17-
kotlin {
18-
compilerOptions.freeCompilerArgs = listOf("-Xjsr305=strict")
19-
}
20-
}
21-
2212
dependencies {
2313
implementation(projects.sentryLogback)
2414
implementation(libs.logback.classic)
25-
26-
testImplementation(kotlin(Config.kotlinStdLib))
27-
testImplementation(projects.sentry)
28-
testImplementation(projects.sentrySystemTestSupport)
29-
testImplementation(libs.kotlin.test.junit)
30-
testImplementation(libs.slf4j.api)
31-
testImplementation(libs.slf4j.jdk14)
3215
}
3316

3417
// Configure the Shadow JAR (executable JAR with all dependencies)
@@ -46,22 +29,3 @@ tasks.jar {
4629

4730
// Fix the startScripts task dependency
4831
tasks.startScripts { dependsOn(tasks.shadowJar) }
49-
50-
tasks.register<Test>("systemTest").configure {
51-
group = "verification"
52-
description = "Runs the System tests"
53-
54-
val test = project.extensions.getByType<SourceSetContainer>()["test"]
55-
testClassesDirs = test.output.classesDirs
56-
classpath = test.runtimeClasspath
57-
58-
maxParallelForks = 1
59-
60-
filter { includeTestsMatching("io.sentry.systemtest*") }
61-
}
62-
63-
tasks.named("test").configure {
64-
require(this is Test)
65-
66-
filter { excludeTestsMatching("io.sentry.systemtest.*") }
67-
}

‎sentry-samples/sentry-samples-logback/src/test/kotlin/io/sentry/DummyTest.kt‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎sentry-samples/sentry-samples-logback/src/test/kotlin/io/sentry/systemtest/ConsoleApplicationSystemTest.kt‎

Lines changed: 0 additions & 85 deletions
This file was deleted.

‎test/system-test-runner.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,6 @@ def get_available_modules(self) -> List[ModuleConfig]:
874874
ModuleConfig("sentry-samples-console", "false", "true", "false"),
875875
ModuleConfig("sentry-samples-console-otlp", "false", "true", "false"),
876876
ModuleConfig("sentry-samples-console-opentelemetry-noagent", "false", "true", "false"),
877-
ModuleConfig("sentry-samples-logback", "false", "true", "false"),
878877
ModuleConfig("sentry-samples-log4j2", "false", "true", "false"),
879878
ModuleConfig("sentry-samples-jul", "false", "true", "false"),
880879
]

0 commit comments

Comments
 (0)