feat(rokt): add diagnostic logging for setter/selectPlacements timing - #1386
Conversation
Logs each attribute/identity setter call (setUserAttribute, removeUserAttribute, onUserIdentified, onLoginComplete, onLogoutComplete, onModifyComplete) and each selectPlacements dispatch independently via LoggingService.logDiagnostic(), so the delta between "attributes set" and "placement requested" can be computed downstream from the logged timestamp-of-receipt and page URL that ReportingTransport already attaches to every log request. Only attribute keys are ever logged, never values, since setter payloads can carry customer PII. logDiagnostic() ships at severity INFO on the wire (same as log()) but through its own ReportingTransport/RateLimiter instance, so a burst of setter/placement diagnostics can't starve the operational INFO budget shared with page-view/quota logging. Relands mparticle-integrations/mparticle-javascript-integration-rokt#130 now that the rokt kit lives in this monorepo under kits/rokt.
PR SummaryLow Risk Overview The Rokt kit now emits INFO-level diagnostic logs on attribute/identity setter paths (
Tests cover log entry shape, PII-safe messages, integration at call sites, and independent rate-limit budgets. Reviewed by Cursor Bugbot for commit 7c7a78f. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 809c6f8. Configure here.
…gnostics logDiagnostic() shared a single rate-limit bucket between setter/identity diagnostics and the selectPlacements dispatch diagnostic. A burst of setter calls (e.g. setUserAttributes looping per key) could exhaust that budget before a placement dispatch, silencing placement diagnostics for the rest of the SPA session. Gives selectPlacements its own ReportingTransport/RateLimiter via a new logPlacementDiagnostic() method, mirroring the existing log()/logDiagnostic() isolation, so a setter burst can no longer starve placement diagnostics. Also addresses SonarQube findings on the reland commit: marks LoggingService fields readonly, and switches fetchCalls.length assertions to toHaveLength().
…omments Both comments just restated what's already explained on the _diagnosticTransport/_placementDiagnosticTransport field declarations a few lines above.
Each comment repeated what the test name and the loop/expect right below it already said.
|
# [3.1.0](v3.0.0...v3.1.0) (2026-09-03) ### Bug Fixes * **braze:** point kit homepage URLs at main ([#1383](#1383)) ([21b2fa8](21b2fa8)) * **ci:** reject wrong-major release tag baseline ([#1389](#1389)) ([9396ba7](9396ba7)) * **kits:** point remaining kit homepage URLs at main ([#1384](#1384)) ([8288cc9](8288cc9)) * **kits:** remove QA path smoke logs ([#1388](#1388)) ([121b00c](121b00c)) ### Features * **rokt:** add diagnostic logging for setter/selectPlacements timing ([#1386](#1386)) ([65bc3d3](65bc3d3))
|
🎉 This PR is included in version 3.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |




Summary
setUserAttribute,removeUserAttribute,onUserIdentified,onLoginComplete,onLogoutComplete,onModifyComplete) viaLoggingService.logDiagnostic()with the affected attribute keys (never values).selectPlacementsdispatch with the full set of placement attribute keys.ReportingTransportalready attaches to every log request.logDiagnostic()ships atseverity: "INFO"on the wire (same aslog()) but through its ownReportingTransport/RateLimiterinstance, so a burst of setter/placement diagnostics can't starve the operational INFO budget shared with page-view/quota logging.Context
Relands mparticle-integrations/mparticle-javascript-integration-rokt#130 against this monorepo now that the rokt kit lives here under
kits/rokt. That PR targeteddevelopmenton the old standalone repo; this one targetsmainhere sincedevelopmentdoesn't carrykits/roktand the kit source of truth has moved.The two commits from #130 didn't cherry-pick cleanly since
kits/rokt/src/Rokt-Kit.tsandtest/src/tests.spec.tshave diverged since the kit moved (newlauncherAttachState.ts, reworkedpageViewStorage.ts, etc.), so the logic was manually reapplied onto the current file versions instead.Example log messages
Test plan
npm run test(kits/rokt) — 340/340 passing, including new unit tests fordiagnosticTiming.tsand integration coverage for every setter/identity call site and theselectPlacementsdispatchnpm run build(kits/rokt) — pre-existingvault.tsgeneric-constraint type errors reproduce identically onmain— unrelated to this change