SIGN IN SIGN UP

fix(logs): encode OTLP attributes in the canonical spec shapes (#4583)

* fix(logs): encode OTLP attributes in the canonical spec shapes

Integers ride as a stringified int64 and out-of-int64 values as an exact decimal
stringValue the server can parse — an out-of-range intValue 400s the whole log
batch and silently drops the metric, as do the empty values a function, a symbol
or a sparse array used to produce, and an unpaired surrogate anywhere in a string
or key. Objects ride as kvlistValue, with the depth, node, own-property, toJSON
and throwing-getter guards JSON.stringify was providing.

* fix(logs): guard the body coercion and share the encoder budgets

String(body) throws on a value whose toString does, or on a null-prototype
object, and buildOtlpLogRecord is called straight from captureLog. Budgets and
markers now come from json-utils rather than a second copy.

* chore(core): keep the shared encoder budgets out of the public API

utils/index.ts re-exports toJsonSafeValue by name instead of the whole module,
so the budgets, markers and sanitizeString stay importable inside core without
being published.
A
Anna Garcia committed
6322f09922270e9d1562bacf0e602e76d238d395
Parent: 7734de2
Committed by GitHub <noreply@github.com> on 8/21/2026, 9:46:10 AM