Precision loss on time_unix_nano #2643
Labels
bug
Something isn't working
never-stale
priority:p2
Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
What version of OpenTelemetry are you using?
v1.0.1
What version of Node are you using?
v14.18.1
Please provide the code you used to set up the OpenTelemetry SDK
core.hrTimeToNanoseconds
is used in otlp exporters heavily, yet it is losing precisions on converting the value to nanoseconds. In otlp proto,time_unix_nano
is defined to befixed64
(i.e. integer with 64-bit size), and it is not representable in JavaScript numbers since it can only keep integer precision up to2^54 -1
.What did you expect to see?
Provides a precision lossless conversion.
BigInt is a quite new language feature, we'd like to support as many browsers as possible. So it might be needed to represent int64 with third-party libraries. Also, the protobuf used in otlp exporters is bound to long.js, not sure if we should adopt it too.
The text was updated successfully, but these errors were encountered: