Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -23,6 +23,7 @@
import io.sentry.SentryLevel;
import io.sentry.SentryNanotimeDate;
import io.sentry.SentryOptions;
import io.sentry.SpanOptions;
import io.sentry.SpanStatus;
import io.sentry.TracesSamplingDecision;
import io.sentry.TransactionContext;
Expand Down Expand Up @@ -224,6 +225,7 @@ private void startTracing(final @NotNull Activity activity) {
}
transactionOptions.setStartTimestamp(ttidStartTime);
transactionOptions.setAppStartTransaction(appStartSamplingDecision != null);
setSpanOrigin(transactionOptions);

// we can only bind to the scope if there's no running transaction
ITransaction transaction =
Expand All @@ -234,7 +236,9 @@ private void startTracing(final @NotNull Activity activity) {
UI_LOAD_OP,
appStartSamplingDecision),
transactionOptions);
setSpanOrigin(transaction);

final SpanOptions spanOptions = new SpanOptions();
setSpanOrigin(spanOptions);

// in case appStartTime isn't available, we don't create a span for it.
if (!(firstActivityCreated || appStartTime == null || coldStart == null)) {
Expand All @@ -244,24 +248,30 @@ private void startTracing(final @NotNull Activity activity) {
getAppStartOp(coldStart),
getAppStartDesc(coldStart),
appStartTime,
Instrumenter.SENTRY);
setSpanOrigin(appStartSpan);
Instrumenter.SENTRY,
spanOptions);

// in case there's already an end time (e.g. due to deferred SDK init)
// we can finish the app-start span
finishAppStartSpan();
}
final @NotNull ISpan ttidSpan =
transaction.startChild(
TTID_OP, getTtidDesc(activityName), ttidStartTime, Instrumenter.SENTRY);
TTID_OP,
getTtidDesc(activityName),
ttidStartTime,
Instrumenter.SENTRY,
spanOptions);
ttidSpanMap.put(activity, ttidSpan);
setSpanOrigin(ttidSpan);

if (timeToFullDisplaySpanEnabled && fullyDisplayedReporter != null && options != null) {
final @NotNull ISpan ttfdSpan =
transaction.startChild(
TTFD_OP, getTtfdDesc(activityName), ttidStartTime, Instrumenter.SENTRY);
setSpanOrigin(ttfdSpan);
TTFD_OP,
getTtfdDesc(activityName),
ttidStartTime,
Instrumenter.SENTRY,
spanOptions);
try {
ttfdSpanMap.put(activity, ttfdSpan);
ttfdAutoCloseFuture =
Expand Down Expand Up @@ -290,11 +300,8 @@ private void startTracing(final @NotNull Activity activity) {
}
}

private void setSpanOrigin(ISpan span) {
if (span != null) {
// TODO [POTEL] replace with transactionOptions.setOrigin
span.getSpanContext().setOrigin(TRACE_ORIGIN);
}
private void setSpanOrigin(final @NotNull SpanOptions spanOptions) {
spanOptions.setOrigin(TRACE_ORIGIN);
}

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class ActivityLifecycleIntegrationTest {
check<TransactionOptions> { transactionOptions ->
assertEquals(fixture.options.idleTimeout, transactionOptions.idleTimeout)
assertEquals(TransactionOptions.DEFAULT_DEADLINE_TIMEOUT_AUTO_TRANSACTION, transactionOptions.deadlineTimeout)
assertEquals("auto.ui.activity", transactionOptions.origin)
}
)
}
Expand Down
Loading