Repository navigation
feat(rokt): add diagnostic logging for setter/selectPlacements timing #1386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alexs-mparticle
merged 4 commits into
main
from
feat/diagnostic-setter-placement-timing
Aug 31, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
809c6f8
feat(rokt): add diagnostic logging for setter/selectPlacements timing
alexs-mparticle 9f393d0
fix(rokt): isolate selectPlacements diagnostic budget from setter dia…
alexs-mparticle c739c37
refactor(rokt): drop redundant logDiagnostic/logPlacementDiagnostic c…
alexs-mparticle 7c7a78f
test(rokt): drop filler comments that just restate the assertions
alexs-mparticle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // Builds diagnostic log entries for attribute/identity setter calls and | ||
| // selectPlacements dispatches. Each fires independently at the moment it | ||
| // happens; correlating the two (timing delta, which setters preceded a given | ||
| // placement call) is done downstream from the logged timestamps and page URL | ||
| // that ReportingTransport already attaches to every log request. Attribute | ||
| // names only — never values — since this ships over the network logging | ||
| // pipeline and setter payloads can carry customer PII. | ||
|
|
||
| export interface DiagnosticLogEntry { | ||
| message: string; | ||
| code: string; | ||
| } | ||
|
|
||
| export function buildSetterDiagnosticLogEntry(source: string, attributeKeys: string[]): DiagnosticLogEntry { | ||
| return { | ||
| message: `Rokt Kit: ${source} called [attributeKeys=${attributeKeys.join(',')}]`, | ||
| code: 'ATTRIBUTE_SETTER_CALLED', | ||
| }; | ||
| } | ||
|
|
||
| export function buildSelectPlacementsDiagnosticLogEntry(placementAttributeKeys: string[]): DiagnosticLogEntry { | ||
| return { | ||
| message: `Rokt Kit: selectPlacements dispatched [placementAttributeKeys=${placementAttributeKeys.join(',')}]`, | ||
| code: 'SELECT_PLACEMENTS_DISPATCHED', | ||
| }; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { describe, it, expect } from 'vitest'; | ||
| import { buildSetterDiagnosticLogEntry, buildSelectPlacementsDiagnosticLogEntry } from '../../src/diagnosticTiming'; | ||
|
|
||
| describe('diagnosticTiming', () => { | ||
| describe('buildSetterDiagnosticLogEntry', () => { | ||
| it('reports the source and attribute keys', () => { | ||
| const entry = buildSetterDiagnosticLogEntry('setUserAttribute', ['favoriteColor']); | ||
|
|
||
| expect(entry.code).toBe('ATTRIBUTE_SETTER_CALLED'); | ||
| expect(entry.message).toBe('Rokt Kit: setUserAttribute called [attributeKeys=favoriteColor]'); | ||
| }); | ||
|
|
||
| it('joins multiple attribute keys', () => { | ||
| const entry = buildSetterDiagnosticLogEntry('onUserIdentified', ['email', 'firstName']); | ||
|
|
||
| expect(entry.message).toContain('[attributeKeys=email,firstName]'); | ||
| }); | ||
|
|
||
| it('never includes attribute values, only keys', () => { | ||
| const entry = buildSetterDiagnosticLogEntry('setUserAttribute', ['email']); | ||
|
|
||
| expect(entry.message).not.toContain('test@example.com'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('buildSelectPlacementsDiagnosticLogEntry', () => { | ||
| it('reports the full set of placement attribute keys', () => { | ||
| const entry = buildSelectPlacementsDiagnosticLogEntry(['favoriteColor', 'mpid']); | ||
|
|
||
| expect(entry.code).toBe('SELECT_PLACEMENTS_DISPATCHED'); | ||
| expect(entry.message).toBe('Rokt Kit: selectPlacements dispatched [placementAttributeKeys=favoriteColor,mpid]'); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.