Skip to content

fix(samples): Use float literal for session-replay sample rate#5764

Merged
runningcode merged 1 commit into
mainfrom
no/fix-sample-replay-session-sample-rate
Jul 16, 2026
Merged

fix(samples): Use float literal for session-replay sample rate#5764
runningcode merged 1 commit into
mainfrom
no/fix-sample-replay-session-sample-rate

Conversation

@runningcode

@runningcode runningcode commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

📜 Description

The Android sample app set the session replay sample rate as an integer literal:

<meta-data
    android:name="io.sentry.session-replay.session-sample-rate"
    android:value="1" />

aapt stores "1" as an integer. ManifestMetadataReader.readDouble reads the value via Bundle.getFloat(key, -1), which does not coerce an int-typed value — it returns the default and the Android framework logs a warning like:

W/Bundle: Key io.sentry.session-replay.session-sample-rate expected Float but value was a java.lang.Integer.  The default value -1 was returned.

The reader then falls back to getInt, so the resulting value is still correct (1.0), but a framework warning is logged on every startup. Using the float literal "1.0" stores the value as a float, so getFloat succeeds on the first read and no warning is logged. This also matches the other sample-rate entries in the same manifest, which already use 1.0.

📝 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.

🔮 Next steps

#skip-changelog

The Android sample manifest set io.sentry.session-replay.session-sample-rate
to the integer literal "1", which aapt stores as an int. ManifestMetadataReader
reads it via Bundle.getFloat, which does not coerce an int-typed value and logs
a framework warning before falling back to getInt on startup. Using the float
literal "1.0" stores it as a float so getFloat succeeds and no warning is logged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sentry

sentry Bot commented Jul 15, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@runningcode runningcode marked this pull request as ready for review July 15, 2026 11:23
@runningcode runningcode merged commit 955d0fc into main Jul 16, 2026
36 checks passed
@runningcode runningcode deleted the no/fix-sample-replay-session-sample-rate branch July 16, 2026 09:12
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.

2 participants