Skip to content

feat: deterministic sampling rate#4093

Draft
mormubis wants to merge 46 commits intov7from
adlrb/deterministic-session-id
Draft

feat: deterministic sampling rate#4093
mormubis wants to merge 46 commits intov7from
adlrb/deterministic-session-id

Conversation

@mormubis
Copy link
Contributor

adlrb/async-session-manager

@mormubis mormubis changed the base branch from main to adlrb/async-session-manager January 15, 2026 14:35
@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Jan 15, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 168.27 KiB 168.09 KiB -181 B -0.11%
Rum Profiler 4.32 KiB 4.33 KiB +1 B +0.02%
Rum Recorder 24.54 KiB 24.54 KiB +1 B +0.00%
Logs 56.48 KiB 56.72 KiB +243 B +0.42%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 125.16 KiB 125.01 KiB -154 B -0.12%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
RUM - add global context 0.0049 0.0041 -16.33%
RUM - add action 0.0175 0.0132 -24.57%
RUM - add error 0.0146 0.0156 +6.85%
RUM - add timing 0.0031 0.0029 -6.45%
RUM - start view 0.0033 0.003 -9.09%
RUM - start/stop session replay recording 0.0007 0.0006 -14.29%
Logs - log message 0.0172 0.0142 -17.44%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 27.35 KiB 27.81 KiB +466 B
RUM - add action 52.82 KiB 51.25 KiB -1.56 KiB
RUM - add timing 27.25 KiB 26.93 KiB -329 B
RUM - add error 58.87 KiB 57.14 KiB -1.73 KiB
RUM - start/stop session replay recording 27.58 KiB 26.67 KiB -924 B
RUM - start view 426.63 KiB 433.68 KiB +7.05 KiB
Logs - log message 48.34 KiB 47.07 KiB -1.27 KiB

🔗 RealWorld

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 15, 2026

⚠️ Tests

Fix all issues with Cursor

⚠️ Warnings

🧪 30 Tests failed

isSampled deterministic sampling a session id with a high hash value should not be sampled even if the rate is close to 100% from Chrome 63.0.3239.84 (Windows 10) (Datadog) (Fix with Cursor)
ReferenceError: BigInt is not defined
    at isSampled (webpack:///packages/core/src/domain/sampler.ts:19:20 <- /tmp/_karma_webpack_823855/commons.js:53874:22)
    at UserContext.it (webpack:///packages/core/src/domain/sampler.spec.ts:41:23 <- /tmp/_karma_webpack_823855/commons.js:53801:71)
    at <Jasmine>
isSampled deterministic sampling a session id with a low hash value should be sampled with a rate close to 0% from Chrome 63.0.3239.84 (Windows 10) (Datadog) (Fix with Cursor)
ReferenceError: BigInt is not defined
    at isSampled (webpack:///packages/core/src/domain/sampler.ts:19:20 <- /tmp/_karma_webpack_823855/commons.js:53874:22)
    at UserContext.it (webpack:///packages/core/src/domain/sampler.spec.ts:27:23 <- /tmp/_karma_webpack_823855/commons.js:53788:71)
    at <Jasmine>
isSampled without bigint support sampling decision should be cached from Chrome 63.0.3239.84 (Windows 10) (Datadog) (Fix with Cursor)
ReferenceError: BigInt is not defined
    at isSampled (webpack:///packages/core/src/domain/sampler.ts:19:20 <- /tmp/_karma_webpack_823855/commons.js:53874:22)
    at UserContext.it (webpack:///packages/rum-core/src/domain/sampler/sampler.spec.ts:72:23 <- /tmp/_karma_webpack_823855/commons.js:89838:71)
    at <Jasmine>
View all

ℹ️ Info

❄️ No new flaky tests detected

🎯 Code Coverage
Patch Coverage: 76.36%
Overall Coverage: 77.28% (+0.01%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e733c7b | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@mormubis mormubis force-pushed the adlrb/async-session-manager branch from 7b107f7 to 6e0e1f7 Compare January 16, 2026 14:58
BenoitZugmeyer and others added 14 commits January 27, 2026 17:45
Replace polling-based waitFor with the cleaner collectAsyncCalls pattern
which waits for a specific number of spy calls and fails fast on extra calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
If consent is revoked while waiting for the session store lock (e.g., Chromium
cookie locking), the session should be expired instead of proceeding with
initialization. This prevents a race condition where consent revocation during
the lock-wait period would be missed.
Tests in 'buffers API calls before starting RUM' section expected
synchronous doStartRum calls but session manager initialization is
now async. Added proper async/await with collectAsyncCalls to wait
for the async callbacks.

Fixes race conditions on slower browsers (Chrome 63, Edge 80, Firefox 67).
Tests in 'trackViews mode' section expected synchronous or partially
async doStartRum calls but session manager initialization is now fully
async. Added proper async/await with collectAsyncCalls to wait for all
async callbacks to complete.

Fixes race conditions on slower browsers (Edge 80).
@mormubis mormubis changed the base branch from adlrb/async-session-manager to thomas.lebeau/asyc-session-manager-with-telemetry-merge-main February 2, 2026 10:36
@mormubis mormubis force-pushed the adlrb/deterministic-session-id branch from ad6ee18 to 7323150 Compare February 2, 2026 13:55
Base automatically changed from thomas.lebeau/asyc-session-manager-with-telemetry-merge-main to v7 February 10, 2026 10:36
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.

3 participants