Emit rum.session_id as multi-value tags, capped at 10#43
Open
r1viollet wants to merge 1 commit into
Open
Conversation
For each completed session record produced during the profile window, emit a `rum.session_id:<uuid>` tag entry alongside the existing `rum.application_id` tag. Repeated entries with the same key are the standard Datadog convention for multi-value facets, so each session id becomes independently queryable. Cardinality is capped at MAX_RUM_SESSION_ID_TAGS (10) to bound tag indexing cost on pathological session-rotation patterns. When the cap is hit, Log::Warn reports how many ids were skipped; the full id list is still embedded in optional_internal_metadata_json. Tag-list construction is factored into a pure static helper ProfileExporter::BuildRumTags so it's unit-testable -- ddog_Tag is opaque and we can't read entries back out of ddog_Vec_Tag, so the contract has to be pinned upstream of the push. Tests in ProfileExporterTests.cpp cover: * empty input -> empty list * application id only -> 1 entry (regression for the existing tag emit) * 1 session, 3 sessions -> 1 + N entries * empty applicationId -> only session entries * empty session ids in the list are skipped Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
We discussed this. |
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
rum.session_id:<uuid>profile-level tags, one entry per completed session record produced during the profile window. Repeated entries with the same key (the standard Datadog multi-value facet shape — not comma-joined, not a JSON list) so each session id is independently queryable as@rum.session_id:<uuid>.rum.application_idinPrepareAdditionalTags. Reuses the existingAddSingleTagpush helper. Both rum.* tags now live in the same code region (ProfileExporter.cpp:1592-1620).MAX_RUM_SESSION_ID_TAGS = 10to bound tag indexing cost on pathological session-rotation patterns. Overflow logsLog::Warnreporting how many ids were skipped; the full id list still travels inoptional_internal_metadata_json(rum_session_ids), unaffected by the cap.Profiler::CompleteCurrentSessionpushes once per session and clears_currentSessionId), so no dedup is needed in the collection step.Implementation notes
Tag-list construction is factored into a pure static helper
ProfileExporter::BuildRumTags(applicationId, sessionIds) -> vector<pair<string,string>>.ddog_Tagis opaque, so we can't inspect entries back out ofddog_Vec_Tagafter pushing — pinning the contract upstream of the push is the only way to write meaningful unit tests.Export()mirrors the session ids that already feedoptional_internal_metadata_jsoninto a separaterumSessionIdsvector before clearing_sessionRecordsBuffer, then threads that vector down throughExportProfiletoPrepareAdditionalTags.Out of scope
The
customData["view.id"]array (matching the chrome SDK contract for the runtime view-filter endpoint) and theoptional_info_jsonchannel are intentionally not in this PR.Test plan
Unit tests in
ProfileExporterTests.cpp:rum.application_idemit)Manual on Windows (
r1viollet):rum.session_id:<uuid>entries — one auto-gen'd, one99999999-...rum.session_id:<uuid>entries; profiler log containsrum.session_id tag cap reached (10); N session id(s) from this export not emitted as tags🤖 Generated with Claude Code