Skip to content

Commit 5bcad51

Browse files
authored
Merge branch 'main' into lcian/ref/urlutils
2 parents 2f0af2a + 1a52aa2 commit 5bcad51

File tree

37 files changed

+804
-101
lines changed

37 files changed

+804
-101
lines changed

.github/ISSUE_TEMPLATE/bug_report_android.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 🐞 Bug Report - Android
22
description: Tell us about something that's not working the way we (probably) intend.
33
labels: ["Platform: Android", "Type: Bug"]
4+
type: Bug
45
body:
56
- type: dropdown
67
id: integration

.github/ISSUE_TEMPLATE/bug_report_java.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 🐞 Bug Report - Java
22
description: Tell us about something that's not working the way we (probably) intend.
33
labels: ["Platform: Java", "Type: Bug"]
4+
type: Bug
45
body:
56
- type: dropdown
67
id: integration

.github/ISSUE_TEMPLATE/feature_android.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 💡 Feature Request - Android
22
description: Tell us about a problem our SDK could solve but doesn't.
33
labels: ["Platform: Android", "Type: Feature Request"]
4+
type: Feature
45
body:
56
- type: textarea
67
id: problem

.github/ISSUE_TEMPLATE/feature_java.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 💡 Feature Request - Java
22
description: Tell us about a problem our SDK could solve but doesn't.
33
labels: ["Platform: Java", "Type: Feature Request"]
4+
type: Feature
45
body:
56
- type: textarea
67
id: problem

CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
# Changelog
22

3-
## Unreleased
3+
### Features
4+
5+
- The SDK now automatically propagates the trace-context to the native layer. This allows to connect errors on different layers of the application. ([#4137](https://github.com/getsentry/sentry-java/pull/4137))
6+
7+
### Dependencies
8+
9+
- Bump Native SDK from v0.7.20 to v0.8.1 ([#4137](https://github.com/getsentry/sentry-java/pull/4137))
10+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0810)
11+
- [diff](https://github.com/getsentry/sentry-native/compare/v0.7.20...0.8.1)
12+
13+
## 8.3.0
414

515
### Features
616

17+
- Add HTTP server request headers from OpenTelemetry span attributes to sentry `request` in payload ([#4102](https://github.com/getsentry/sentry-java/pull/4102))
18+
- You have to explicitly enable each header by adding it to the [OpenTelemetry config](https://opentelemetry.io/docs/zero-code/java/agent/instrumentation/http/#capturing-http-request-and-response-headers)
19+
- Please only enable headers you actually want to send to Sentry. Some may contain sensitive data like PII, cookies, tokens etc.
20+
- We are no longer adding request/response headers to `contexts/otel/attributes` of the event.
721
- The `ignoredErrors` option is now configurable via the manifest property `io.sentry.traces.ignored-errors` ([#4178](https://github.com/getsentry/sentry-java/pull/4178))
822
- A list of active Spring profiles is attached to payloads sent to Sentry (errors, traces, etc.) and displayed in the UI when using our Spring or Spring Boot integrations ([#4147](https://github.com/getsentry/sentry-java/pull/4147))
923
- This consists of an empty list when only the default profile is active
1024
- Added `enableTraceIdGeneration` to the AndroidOptions. This allows Hybrid SDKs to "freeze" and control the trace and connect errors on different layers of the application ([4188](https://github.com/getsentry/sentry-java/pull/4188))
1125
- Move to a single NetworkCallback listener to reduce number of IPC calls on Android ([#4164](https://github.com/getsentry/sentry-java/pull/4164))
1226
- Add GraphQL Apollo Kotlin 4 integration ([#4166](https://github.com/getsentry/sentry-java/pull/4166))
27+
- Add support for async dispatch requests to Spring Boot 2 and 3 ([#3983](https://github.com/getsentry/sentry-java/pull/3983))
28+
- To enable it, please set `sentry.keep-transactions-open-for-async-responses=true` in `application.properties` or `sentry.keepTransactionsOpenForAsyncResponses: true` in `application.yml`
29+
- Add constructor to JUL `SentryHandler` for disabling external config ([#4208](https://github.com/getsentry/sentry-java/pull/4208))
1330

1431
### Fixes
1532

33+
- Filter strings that cannot be parsed as Regex no longer cause an SDK crash ([#4213](https://github.com/getsentry/sentry-java/pull/4213))
34+
- This was the case e.g. for `ignoredErrors`, `ignoredTransactions` and `ignoredCheckIns`
35+
- We now simply don't use such strings for Regex matching and only use them for String comparison
1636
- `SentryOptions.setTracePropagationTargets` is no longer marked internal ([#4170](https://github.com/getsentry/sentry-java/pull/4170))
1737
- Session Replay: Fix crash when a navigation breadcrumb does not have "to" destination ([#4185](https://github.com/getsentry/sentry-java/pull/4185))
1838
- Session Replay: Cap video segment duration to maximum 5 minutes to prevent endless video encoding in background ([#4185](https://github.com/getsentry/sentry-java/pull/4185))

buildSrc/src/main/java/Config.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ object Config {
159159
val apolloKotlin = "com.apollographql.apollo3:apollo-runtime:3.8.2"
160160
val apolloKotlin4 = "com.apollographql.apollo:apollo-runtime:4.1.1"
161161

162-
val sentryNativeNdk = "io.sentry:sentry-native-ndk:0.7.20"
162+
val sentryNativeNdk = "io.sentry:sentry-native-ndk:0.8.1"
163163

164164
object OpenTelemetry {
165165
val otelVersion = "1.44.1"

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ org.gradle.workers.max=2
1414
android.useAndroidX=true
1515

1616
# Release information
17-
versionName=8.2.0
17+
versionName=8.3.0
1818

1919
# Override the SDK name on native crashes on Android
2020
sentryAndroidSdkName=sentry.native.android

sentry-android-core/api/sentry-android-core.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ public final class io/sentry/android/core/InternalSentrySdk {
221221
public static fun getAppStartMeasurement ()Ljava/util/Map;
222222
public static fun getCurrentScope ()Lio/sentry/IScope;
223223
public static fun serializeScope (Landroid/content/Context;Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/IScope;)Ljava/util/Map;
224+
public static fun setTrace (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Double;Ljava/lang/Double;)V
224225
}
225226

226227
public final class io/sentry/android/core/LoadClass : io/sentry/util/LoadClass {

sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.sentry.android.core;
22

3+
import static io.sentry.Sentry.getCurrentScopes;
34
import static io.sentry.SentryLevel.DEBUG;
45
import static io.sentry.SentryLevel.INFO;
56
import static io.sentry.SentryLevel.WARNING;
@@ -13,6 +14,7 @@
1314
import io.sentry.IScopes;
1415
import io.sentry.ISerializer;
1516
import io.sentry.ObjectWriter;
17+
import io.sentry.PropagationContext;
1618
import io.sentry.ScopeType;
1719
import io.sentry.ScopesAdapter;
1820
import io.sentry.SentryEnvelope;
@@ -30,6 +32,7 @@
3032
import io.sentry.protocol.SentryId;
3133
import io.sentry.protocol.User;
3234
import io.sentry.util.MapObjectWriter;
35+
import io.sentry.util.TracingUtils;
3336
import java.io.ByteArrayInputStream;
3437
import java.io.File;
3538
import java.io.InputStream;
@@ -329,4 +332,22 @@ private static Session updateSession(
329332
});
330333
return sessionRef.get();
331334
}
335+
336+
/**
337+
* Allows a Hybrid SDK to set the trace on the native layer
338+
*
339+
* @param traceId the trace ID
340+
* @param spanId the trace origin's span ID
341+
* @param sampleRate the sample rate used by the origin of the trace
342+
* @param sampleRand the random value used to sample with by the origin of the trace
343+
*/
344+
public static void setTrace(
345+
final @NotNull String traceId,
346+
final @NotNull String spanId,
347+
final @Nullable Double sampleRate,
348+
final @Nullable Double sampleRand) {
349+
TracingUtils.setTrace(
350+
getCurrentScopes(),
351+
PropagationContext.fromExistingTrace(traceId, spanId, sampleRate, sampleRand));
352+
}
332353
}

sentry-android-core/src/test/java/io/sentry/android/core/InternalSentrySdkTest.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import io.sentry.SentryExceptionFactory
1919
import io.sentry.SentryItemType
2020
import io.sentry.SentryOptions
2121
import io.sentry.Session
22+
import io.sentry.SpanId
2223
import io.sentry.android.core.performance.ActivityLifecycleTimeSpan
2324
import io.sentry.android.core.performance.AppStartMetrics
2425
import io.sentry.exception.ExceptionMechanismException
@@ -505,4 +506,25 @@ class InternalSentrySdkTest {
505506
assertEquals(20.toLong(), actualProcessSpan["start_timestamp_ms"])
506507
assertEquals(100.toLong(), actualProcessSpan["end_timestamp_ms"])
507508
}
509+
510+
@Test
511+
fun `setTrace sets correct propagation context`() {
512+
val fixture = Fixture()
513+
fixture.init(context)
514+
515+
val traceId = "771a43a4192642f0b136d5159a501700"
516+
val spanId = "771a43a4192642f0"
517+
val sampleRate = 0.5
518+
val sampleRand = 0.3
519+
520+
InternalSentrySdk.setTrace(traceId, spanId, sampleRate, sampleRand)
521+
522+
Sentry.configureScope { scope ->
523+
val propagationContext = scope.propagationContext
524+
assertEquals(SentryId(traceId), propagationContext.traceId)
525+
assertEquals(SpanId(spanId), propagationContext.parentSpanId)
526+
assertEquals(sampleRate, propagationContext.baggage.sampleRateDouble)
527+
assertEquals(sampleRand, propagationContext.baggage.sampleRandDouble)
528+
}
529+
}
508530
}

0 commit comments

Comments
 (0)