-
Notifications
You must be signed in to change notification settings - Fork 913
Description
The OpenTelemetry spec says valid attribute types include signed 64bit integers:
A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer.
However in opentelemetry-js
attribute values are represented as number
which has a max safe value of 2^53 – 1.
There was a previous request for supporting BigInt as an attribute value here though it was marked as not planned. This makes some sense to me since it could represent much larger numbers, but still leaves a gap between 2^53-1 and 2^63-1 IIUC.
If we need to attach a 64 bit integer (say, received from an external system) to an attribute today that exceeds Number.MAX_SAFE_INTEGER
, what is the recommended approach? Serialize it to a string? Or is there maybe some alternative I am missing?