docs(rum): add sampling mechanism and best practices guide - #239
Merged
Conversation
Explain how session sampling works (session-level draw, sticky decision, probabilistic rate, init-time freeze), how to choose a sampling rate, and two best practices: dynamically adjustable rates via a customer config service with stopSession(), and business-defined custom sampling with deterministic hash bucketing. Bilingual (zh source + en translation), registered in docs.json navigation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e to sampling guide Wrap both best-practice examples in Web/Android/iOS tabs, add an advanced section for applying a new sampling rate immediately on mobile via stopInstance() + re-initialize at a quiet lifecycle moment (foreground transition), with warnings on timing, buffered-data flush, rebuild burden, and scope of use. Clarify that stopSession() alone cannot apply a new rate on mobile, and update the platform support matrix accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fiona2016
marked this pull request as ready for review
August 3, 2026 06:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new RUM best-practices article on sampling, distilled from a customer request: they start with a 20% sampling rate and later need to raise it to 100%, or toggle collection on/off, without shipping a new release.
The article covers:
sessionSampleRatesemantics, second-stagesessionReplaySampleRate, and the fact that unsampled sessions report nothing (including errors).stopSession()on change so the new rate applies without waiting up to 4 h.Changes
zh/rum/best-practices/sampling.mdx(source)en/rum/best-practices/sampling.mdx(translation)docs.json— registered under RUM → 最佳实践 / Best practices in both languagesVerification
mint broken-links: no broken links founddocs.jsonvalidated withjq🤖 Generated with Claude Code