Skip to content

Commit b73ec21

Browse files
Update packages/rum/src/domain/profiling/transport/buildProfileEventAttributes.ts
Co-authored-by: Aymeric <aymeric.mortemousque@datadoghq.com>
1 parent b5feb14 commit b73ec21

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

packages/rum/src/domain/profiling/transport/buildProfileEventAttributes.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,18 @@ export function buildProfileEventAttributes(
3535

3636
const longTaskIds: string[] = profilerTrace.longTasks.map((longTask) => longTask.id).filter((id) => id !== undefined)
3737

38-
const attributes: ProfileEventAttributes = {
39-
application: {
40-
id: applicationId,
41-
},
42-
...(sessionId && {
43-
session: {
44-
id: sessionId,
45-
},
46-
}),
47-
...(ids.length && {
48-
view: {
49-
id: ids,
50-
name: names,
51-
},
52-
}),
53-
...(longTaskIds.length && {
54-
long_task: { id: longTaskIds },
55-
}),
38+
39+
const attributes: ProfileEventAttributes = { application: { id: applicationId } }
40+
41+
if (sessionId) {
42+
attributes.session = { id: sessionId }
43+
}
44+
if (ids.length) {
45+
attributes.view = { id: ids, name: names }
46+
}
47+
if (longTaskIds.length) {
48+
attributes.long_task = { id: longTaskIds }
49+
}
5650
}
5751
return attributes
5852
}

0 commit comments

Comments
 (0)