Skip to content

Conversation

@blumamir
Copy link
Member

Which problem is this PR solving?

This one is for a case I'vs seen in one of our users environments.

In otlpTransformer package, hrTimeToNanos function, we feed the components of hrTime into BigInt which will throw if the argument is not an integer:

node Welcome to Node.js v20.19.2. Type ".help" for more information. > BigInt(0.5) Uncaught: RangeError: The number 0.5 cannot be converted to a BigInt because it is not an integer at BigInt (<anonymous>) 

Followed all the places where we populate the hrTime and honestly I am not sure where this non-integer value is coming from, but it doesn't hurt to verify. If a non-int value is somehow find it's way into a span, then the exception will kill the node process which is a big problem and should be avoided.

Short description of the changes

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Added a unit test. Also there is an app which used to crash in one of odigos users environments and after the fix the crashes went away.

@blumamir blumamir requested a review from a team as a code owner September 10, 2025 14:45
@codecov
Copy link

codecov bot commented Sep 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.07%. Comparing base (2197129) to head (1d69ab5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@ ## main #5924 +/- ## ======================================= Coverage 95.07% 95.07% ======================================= Files 308 308 Lines 8037 8037 Branches 1626 1626 ======================================= Hits 7641 7641 Misses 396 396 
Files with missing lines Coverage Δ
...ntal/packages/otlp-transformer/src/common/utils.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@pichlermarc pichlermarc added this pull request to the merge queue Sep 11, 2025
Merged via the queue into open-telemetry:main with commit 580413b Sep 11, 2025
25 checks passed
@otelbot-js otelbot-js bot mentioned this pull request Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants