⚗️[MFE] Source code context event enrichment#3926
Conversation
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage 🔗 Commit SHA: 31e5ac1 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
943c7a2 to
55969dd
Compare
2ced5e0 to
0e9289e
Compare
packages/rum-core/src/domain/contexts/sourceCodeContext.spec.ts
Outdated
Show resolved
Hide resolved
| type DeepReadonly<T> = { | ||
| readonly [K in keyof T]: DeepReadonly<T[K]> | ||
| } | ||
|
|
||
| export interface AssembleHookParams { | ||
| readonly eventType: RumEvent['type'] | ||
| rawRumEvent: DeepReadonly<RawRumEvent> | ||
| domainContext: DeepReadonly<RumEventDomainContext<RawRumEvent['type']>> |
There was a problem hiding this comment.
❓ question: What is the intent with the DeepReadonly?
There was a problem hiding this comment.
oh ok, what about adding a comment with the code to make the intent more explicit?
| import type { BrowserWindow } from './sourceCodeContext' | ||
| import { startSourceCodeContext } from './sourceCodeContext' | ||
|
|
||
| describe('sourceCodeContext', () => { |
There was a problem hiding this comment.
💬 suggestion: It could be interesting to add e2e tests for this feature
There was a problem hiding this comment.
14cfe74 to
4736888
Compare
| }, | ||
| } | ||
|
|
||
| // because the evaluation the script in a different context than the page, resulting in unexpected stack traces |
There was a problem hiding this comment.
💬 suggestion: unclear to me what information we want to convey here and how it relates to create body 😕
There was a problem hiding this comment.
Yeah, it’s a copy-paste from here. It means we use createBody instead of page.evaluate() because page.evaluate() messes up the stack trace and drops the URL. I’ll improve the comments.

Motivation
In the context of micro frontend support, we add the ability to enrich events with source code context (service and version) from window.DD_SOURCE_CODE_CONTEXT.
DD_SOURCE_CODE_CONTEXT is injected at build time by the build plugin.
Changes
sourceCodeContext.ts.rawRumEventanddomainContextto the assemble hook parameters to allow extracting the stack for sourceCodeContext.Test instructions
Checklist