File tree Expand file tree Collapse file tree 5 files changed +51
-5
lines changed
main/java/io/sentry/logger Expand file tree Collapse file tree 5 files changed +51
-5
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ androidxLifecycle = "2.2.0"
44androidxNavigation = " 2.4.2"
55androidxTestCore = " 1.7.0"
66androidxCompose = " 1.6.3"
7+ asyncProfiler = " 4.2"
78composeCompiler = " 1.5.14"
89coroutines = " 1.6.1"
910espresso = " 3.7.0"
@@ -94,6 +95,8 @@ androidx-navigation-compose = { module = "androidx.navigation:navigation-compose
9495androidx-sqlite = { module = " androidx.sqlite:sqlite" , version = " 2.5.2" }
9596androidx-recyclerview = { module = " androidx.recyclerview:recyclerview" , version = " 1.2.1" }
9697androidx-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" }
97100coil-compose = { module = " io.coil-kt:coil-compose" , version = " 2.6.0" }
98101commons-compress = {module = " org.apache.commons:commons-compress" , version = " 1.25.0" }
99102context-propagation = { module = " io.micrometer:context-propagation" , version = " 1.1.0" }
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ kotlin { explicitApi() }
2020dependencies {
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)
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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) =
You can’t perform that action at this time.
0 commit comments