Description
Data should not be truncated in the SDK itself, but in Relay.
Reference: https://github.com/getsentry/projects/issues/837
Exceptions:
- 1000 spans per transaction
- max number of breadcrumbs
- request body truncation
Going through the repository, several places were found where truncation happens:
Normalizing objects
|
export function normalize(input: unknown, depth: number = 100, maxProperties: number = +Infinity): any { |
Limiting Values
|
const { environment, release, dist, maxValueLength = 250 } = options; |
Context lines
|
export function snipLine(line: string, colno: number): string { |
Exceptions
- Truncates key length, extra error data
|
export function extractExceptionKeysForMessage(exception: Record<string, unknown>, maxLength: number = 40): string { |
|
extraErrorInfo[key] = isError(value) || typeof value === 'string' ? truncate(`${value}`, maxValueLength) : value; |
Limiting Zod Errors
- Zod integration limits amount of issues attached (configurable)
|
export function applyZodErrorsToEvent( |
Breadcrumbs
- Maximum number of breadcrumbs is 100 (this should probably stay)
|
this._breadcrumbs = this._breadcrumbs.slice(-maxCrumbs); |
Feature Flags
- Maximum flags per span
- Maximum flags stored in the buffer
|
if (numOfAddedFlags < maxFlagsPerSpan) { |
HTTP integration
- Truncates body, configurable with
maxIncomingRequestBodySize
|
const truncatedBody = |
|
bodyByteLength > maxBodySize |
|
? `${Buffer.from(body) |
|
.subarray(0, maxBodySize - 3) |
|
.toString('utf-8')}...` |
|
: body; |
Redis integration
- Truncates span description (not configurable)
|
span.updateName(truncate(spanDescription, 1024)); |
Paths
- Trims path length for directories, LCP URLs
|
const truncated = filename.length > 1024 ? `<truncated>${filename.slice(-1024)}` : filename; |
|
entry.url && (attributes['lcp.url'] = entry.url.trim().slice(0, 200)); |
|
return url.slice(0, 1024); |