Skip to content

Commit

Permalink
change serialization for node to avoid reporting objects as the messa…
Browse files Browse the repository at this point in the history
…ge (highlight#7147)

## Summary

Objects were sent as the structured message attributes and serialized.
Avoid serializing them to the message to avoid verbose message bodies.

## How did you test this change?

Local deploy recording a log from @highlight-run/node
<img width="1692" alt="Screenshot 2023-11-13 at 4 13 57 PM"
src="https://github.com/highlight/highlight/assets/1351531/370ab27d-5e70-4b00-80c6-f045e09de85d">


## Are there any deployment considerations?

Changeset

## Does this work require review from our design team?

No
  • Loading branch information
Vadman97 authored Nov 15, 2023
1 parent 9e66c86 commit 66b94f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-geckos-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@highlight-run/node': patch
---

change serialization for node to avoid reporting objects as the message
6 changes: 2 additions & 4 deletions sdk/highlight-node/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,10 @@ export function hookConsole(
date,
level: highlightLevel,
message: data
.map((o) =>
typeof o === 'object' ? safeStringify(o) : o,
)
.filter((d) => typeof d !== 'object')
.map((o) => `${o}`)
.join(' '),
attributes: data
.slice(1)
.filter((d) => typeof d === 'object')
.reduce((a, b) => ({ ...a, ...b }), {}),
stack: o.stack,
Expand Down

0 comments on commit 66b94f3

Please sign in to comment.