Skip to content

Commit 33023d2

Browse files
authored
Merge branch 'main' into feat/openfeature-integration
2 parents 509c675 + a5ab36f commit 33023d2

File tree

5 files changed

+51
-5
lines changed

5 files changed

+51
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- Implement OpenFeature Integration that tracks Feature Flag evaluations ([#4910](https://github.com/getsentry/sentry-java/pull/4910))
88
- To make use of it, add the `sentry-openfeature` dependency and register the the hook using: `openFeatureApiInstance.addHooks(new SentryOpenFeatureHook());`
99

10+
### Improvements
11+
12+
- Do not send manual log origin ([#4897](https://github.com/getsentry/sentry-java/pull/4897))
13+
1014
## 8.26.0
1115

1216
### Features

gradle/libs.versions.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ androidxLifecycle = "2.2.0"
44
androidxNavigation = "2.4.2"
55
androidxTestCore = "1.7.0"
66
androidxCompose = "1.6.3"
7+
asyncProfiler = "4.2"
78
composeCompiler = "1.5.14"
89
coroutines = "1.6.1"
910
espresso = "3.7.0"
@@ -94,6 +95,8 @@ androidx-navigation-compose = { module = "androidx.navigation:navigation-compose
9495
androidx-sqlite = { module = "androidx.sqlite:sqlite", version = "2.5.2" }
9596
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.2.1" }
9697
androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" }
98+
async-profiler = { module = "tools.profiler:async-profiler", version.ref = "asyncProfiler" }
99+
async-profiler-jfr-converter = { module = "tools.profiler:jfr-converter", version.ref = "asyncProfiler" }
97100
coil-compose = { module = "io.coil-kt:coil-compose", version = "2.6.0" }
98101
commons-compress = {module = "org.apache.commons:commons-compress", version = "1.25.0"}
99102
context-propagation = { module = "io.micrometer:context-propagation", version = "1.1.0" }

sentry-async-profiler/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ kotlin { explicitApi() }
2020
dependencies {
2121
api(projects.sentry)
2222

23-
implementation("tools.profiler:async-profiler:4.2")
24-
implementation("tools.profiler:jfr-converter:4.2")
23+
implementation(libs.async.profiler)
24+
implementation(libs.async.profiler.jfr.converter)
2525

2626
compileOnly(libs.jetbrains.annotations)
2727
compileOnly(libs.nopen.annotations)

sentry/src/main/java/io/sentry/logger/LoggerApi.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,11 @@ private void captureLog(
163163
final @NotNull SpanId spanId,
164164
final @Nullable Object... args) {
165165
final @NotNull HashMap<String, SentryLogEventAttributeValue> attributes = new HashMap<>();
166-
attributes.put(
167-
"sentry.origin",
168-
new SentryLogEventAttributeValue(SentryAttributeType.STRING, params.getOrigin()));
166+
final @NotNull String origin = params.getOrigin();
167+
if (!"manual".equalsIgnoreCase(origin)) {
168+
attributes.put(
169+
"sentry.origin", new SentryLogEventAttributeValue(SentryAttributeType.STRING, origin));
170+
}
169171

170172
final @Nullable SentryAttributes incomingAttributes = params.getAttributes();
171173

sentry/src/test/java/io/sentry/ScopesTest.kt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,6 +2585,43 @@ class ScopesTest {
25852585
)
25862586
}
25872587

2588+
@Test
2589+
fun `log with manual origin does not have origin attribute`() {
2590+
val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true }
2591+
2592+
sut.logger().log(SentryLogLevel.WARN, "log message")
2593+
2594+
verify(mockClient)
2595+
.captureLog(
2596+
check {
2597+
assertEquals("log message", it.body)
2598+
assertNull(it.attributes!!.get("sentry.origin"))
2599+
},
2600+
anyOrNull(),
2601+
)
2602+
}
2603+
2604+
@Test
2605+
fun `log with non manual origin does have origin attribute`() {
2606+
val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true }
2607+
2608+
sut
2609+
.logger()
2610+
.log(SentryLogLevel.WARN, SentryLogParameters().also { it.origin = "other" }, "log message")
2611+
2612+
verify(mockClient)
2613+
.captureLog(
2614+
check {
2615+
assertEquals("log message", it.body)
2616+
assertEquals(
2617+
"other",
2618+
(it.attributes!!.get("sentry.origin") as? SentryLogEventAttributeValue)?.value,
2619+
)
2620+
},
2621+
anyOrNull(),
2622+
)
2623+
}
2624+
25882625
@Test
25892626
fun `creating log with format string works`() {
25902627
val (sut, mockClient) =

0 commit comments

Comments
 (0)