Skip to content

feat(android): Make tombstone merge time threshold configurable - #6154

Draft
markushi wants to merge 3 commits into
mainfrom
feat/configurable-tombstone-merge-threshold
Draft

markushi wants to merge 3 commits into
mainfrom
feat/configurable-tombstone-merge-threshold

Conversation

@markushi

Copy link
Copy Markdown
Member

📜 Description

Makes the time window used to merge a tombstone with a native crash event configurable. NativeEventCollector had a hardcoded TIMESTAMP_TOLERANCE_MS = 5000; it now reads SentryAndroidOptions.getTombstoneMergeTimeThresholdMillis(), which keeps 5000 ms as its default, so behavior does not change unless the option is set.

SentryAndroid.init(this, options -> options.setTombstoneMergeTimeThresholdMillis(10000));
<meta-data android:name="io.sentry.tombstone.merge-time-threshold-millis" android:value="10000" />

The matching code also logs the threshold together with the measured gap, and logs when no native event was inside the window, so a failed merge can be diagnosed from a debug log.

💡 Motivation and Context

A user reported that native crashes still arrive as signalhandler events with a thin native stack instead of TombstoneMerged. The gap between the tombstone timestamp and the native crash envelope was 5.786 s, just above the fixed 5 s window, so the two were never paired. There was no way to raise the window.

💚 How did you test it?

Unit tests in sentry-android-core:

  • NativeEventCollectorTest: a 5.8 s gap (the gap from the report) does not match with the default threshold, matches with the threshold raised to 10000 ms, and a 2 s gap does not match with the threshold lowered to 1000 ms.
  • ManifestMetadataReaderTest: the manifest value is applied, and the default is kept when the tag is absent.
  • SentryAndroidOptionsTest: default of 5000 ms and the setter.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

The option is Android only, like the other tombstone options, so it is not wired into ExternalOptions (sentry.properties) or Spring Boot properties. Documentation for the new option can follow if the team wants it published.

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Sep 23, 2026

Copy link
Copy Markdown

JAVA-737

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 8d61132

@sentry

sentry Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.57.0 (1) release

⚙️ sentry-android Build Distribution Settings

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make tombstone merge timestamp threshold configurable

1 participant