Skip to content

Commit

Permalink
Merge branch '8.x.x' into feat/respect-ignored-span-types-in-start-child
Browse files Browse the repository at this point in the history
  • Loading branch information
adinauer authored Sep 23, 2024
2 parents fa1da25 + cc78f7a commit 4791c4f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
- redact/ignore `View`s of a certain type by adding fully-qualified classname to one of the lists `options.experimental.sessionReplay.addRedactViewClass()` or `options.experimental.sessionReplay.addIgnoreViewClass()`. Note, that all of the view subclasses/subtypes will be redacted/ignored as well
- For example, (this is already a default behavior) to redact all `TextView`s and their subclasses (`RadioButton`, `EditText`, etc.): `options.experimental.sessionReplay.addRedactViewClass("android.widget.TextView")`
- If you're using code obfuscation, adjust your proguard-rules accordingly, so your custom view class name is not minified
- Set span origin in `ActivityLifecycleIntegration` on span options instead of after creating the span / transaction ([#3702](https://github.com/getsentry/sentry-java/pull/3702))
- This allows spans to be filtered by span origin on creation

### Dependencies

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import io.sentry.protocol.MeasurementValue;
import io.sentry.protocol.SentryId;
import io.sentry.protocol.TransactionNameSource;
import io.sentry.protocol.User;
import io.sentry.util.LazyEvaluator;
import io.sentry.util.Objects;
import java.lang.ref.WeakReference;
Expand Down Expand Up @@ -210,14 +209,14 @@ public OtelSpanWrapper(
private void updateBaggageValues() {
synchronized (this) {
if (baggage != null && baggage.isMutable()) {
final AtomicReference<User> userAtomicReference = new AtomicReference<>();
final AtomicReference<SentryId> replayIdAtomicReference = new AtomicReference<>();
scopes.configureScope(
scope -> {
userAtomicReference.set(scope.getUser());
replayIdAtomicReference.set(scope.getReplayId());
});
baggage.setValuesFromTransaction(
getSpanContext().getTraceId(),
null,
replayIdAtomicReference.get(),
scopes.getOptions(),
this.getSamplingDecision(),
getTransactionName(),
Expand Down
13 changes: 13 additions & 0 deletions sentry/src/test/java/io/sentry/ScopesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2264,6 +2264,19 @@ class ScopesTest {
scopes.configureScope { assertSame(transaction, it.transaction) }
}

@Test
fun `creating a transaction with origin sets the origin on the transaction context`() {
val scopes = generateScopes()

val transactionContext = TransactionContext("transaction-name", "transaction-op")
val transactionOptions = TransactionOptions().also {
it.origin = "other.span.origin"
}

val transaction = scopes.startTransaction(transactionContext, transactionOptions)
assertEquals("other.span.origin", transaction.spanContext.origin)
}

private val dsnTest = "https://[email protected]/proj"

private fun generateScopes(optionsConfiguration: Sentry.OptionsConfiguration<SentryOptions>? = null): IScopes {
Expand Down

0 comments on commit 4791c4f

Please sign in to comment.