MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / jsonBytes

Function jsonBytes

packages/core/src/tracing/ai/messageTruncation.ts:70–72  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

68 * Calculate the UTF-8 byte length of a value's JSON representation.
69 */
70const jsonBytes = (value: unknown): number => {
71 return utf8Bytes(JSON.stringify(value));
72};
73
74/**
75 * Truncate a string to fit within maxBytes (inclusive) when encoded as UTF-8.

Callers 3

truncateContentMessageFunction · 0.85
truncateArrayMessageFunction · 0.85
truncateMessagesByBytesFunction · 0.85

Calls 1

utf8BytesFunction · 0.85

Tested by

no test coverage detected