Skip to content

Commit cff6b3c

Browse files
committed
Include applicationId in snapshot payload and tags
Browser snapshots need to carry the RUM application identity so the web UI can resolve source metadata via the browser-build lookup when git tags are absent.
1 parent c3334a6 commit cff6b3c

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

packages/debugger/src/domain/api.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,34 @@ describe('api', () => {
321321
expect(snapshot.duration).toBeGreaterThanOrEqual(10000000) // Should be in nanoseconds (>= 10ms)
322322
})
323323

324+
it('should include applicationId in snapshot payload and tags', () => {
325+
initDebuggerTransport(
326+
{ service: 'test-service', env: 'test-env', applicationId: 'app-123' } as any,
327+
{ add: mockBatchAdd } as any
328+
)
329+
330+
const probe: Probe = {
331+
id: 'test-probe',
332+
version: 0,
333+
type: 'LOG_PROBE',
334+
where: { typeName: 'TestClass', methodName: 'appIdTest' },
335+
template: 'Test',
336+
captureSnapshot: false,
337+
capture: {},
338+
sampling: { snapshotsPerSecond: 5000 },
339+
evaluateAt: 'ENTRY',
340+
}
341+
addProbe(probe)
342+
343+
const probes = getProbes('TestClass;appIdTest')!
344+
onEntry(probes, {}, {})
345+
onReturn(probes, null, {}, {}, {})
346+
347+
const payload = mockBatchAdd.calls.mostRecent().args[0]
348+
expect(payload.application_id).toBe('app-123')
349+
expect(payload.ddtags).toContain('application_id:app-123')
350+
})
351+
324352
it('should include RUM context in logger', () => {
325353
const probe: Probe = {
326354
id: 'test-probe',

packages/debugger/src/domain/api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,14 @@ function sendDebuggerSnapshot(probe: InitializedProbe, result: ActiveEntry): voi
299299
buildTag('version', debuggerConfig.version),
300300
buildTag('debugger_version', debuggerApi.version),
301301
buildTag('host_name', hostname),
302+
buildTag('application_id', debuggerConfig.applicationId),
302303
]
303304

304305
const payload: Context = {
305306
message: result.message || '',
306307
hostname,
307308
service: debuggerConfig.service,
309+
application_id: debuggerConfig.applicationId,
308310
ddtags: ddtags.join(','),
309311
logger,
310312
dd,

0 commit comments

Comments
 (0)