You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, we have various implementations and type declarations for attributes, serialization/conversion, etc. Given that spans (v2), metrics and logs all accept the same attributes, we should unify the respective declarations and the logic. This probably saves some bundle size for multi-product users.
Fully unifying attribute typing and serialization is a breaking change because:
logs and metrics currently stringify array values
stringification is not handled perfectly well and we could extract more information from obscure values:
=> All of these cases can be improved but are breaking changes in terms of values
Actually removing duplicated logic between logs, metrics and span attributes is not part of this issue and should be addressed in JS-1145, JS-1147, JS-1146 directly (i.e. before the next major).
Do not fall back to accepting and stringifying unsupported types
For any read/consumption methods (beforeSendLog, Client.on('processSpan') et.al.):
Expose raw attributes as Record<string, unknown>. This is not ideal, but the only way that we can widen the type range of accepted attribute types in write operations, without breaking users when reading. Using unknown forces users to expect and handle all kinds of values going forward.
Allow users to interact with the original values they passed in.
Serialization
Only after the last step in the captureX pipeline, when all user-code callbacks ran, serialize attributes to the expected {value, type, unit?} format
=> This allows us to change the serialization format without any breaking changes for users.
Activity
linear commentedon Nov 11, 2025
JS-1149
Lms24 commentedon Feb 3, 2026
Concrete Plan
scope.setAttribute(s)):beforeSendLog,Client.on('processSpan')et.al.):Record<string, unknown>. This is not ideal, but the only way that we can widen the type range of accepted attribute types in write operations, without breaking users when reading. Usingunknownforces users to expect and handle all kinds of values going forward.captureXpipeline, when all user-code callbacks ran, serialize attributes to the expected{value, type, unit?}format