From a389fadfa4f57a15d8ba159e534de936789c22b3 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Thu, 15 Feb 2024 14:04:35 +0100 Subject: [PATCH] fix(otlp-transformer): only use BigInt inside hrTimeToNanos() (#4484) * fix(otlp-transformer): only use BigInt inside hrTimeToNanos() * fix: changelog --- experimental/CHANGELOG.md | 1 + experimental/packages/otlp-transformer/src/common/index.ts | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index ab698812ef..64336d36d5 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -18,6 +18,7 @@ All notable changes to experimental packages in this project will be documented * fix(sdk-node): allow using samplers when the exporter is defined in the environment [#4394](https://github.com/open-telemetry/opentelemetry-js/pull/4394) @JacksonWeber * fix(instrumentation): normalize paths for internal files in scoped packages [#4467](https://github.com/open-telemetry/opentelemetry-js/pull/4467) @pichlermarc * Fixes a bug where, on Windows, internal files on scoped packages would not be instrumented. +* fix(otlp-transformer): only use BigInt inside hrTimeToNanos() [#4484](https://github.com/open-telemetry/opentelemetry-js/pull/4484) @pichlermarc ### :books: (Refine Doc) diff --git a/experimental/packages/otlp-transformer/src/common/index.ts b/experimental/packages/otlp-transformer/src/common/index.ts index 00dcccfb05..96d281bad6 100644 --- a/experimental/packages/otlp-transformer/src/common/index.ts +++ b/experimental/packages/otlp-transformer/src/common/index.ts @@ -18,9 +18,8 @@ import type { OtlpEncodingOptions, Fixed64, LongBits } from './types'; import { HrTime } from '@opentelemetry/api'; import { hexToBinary, hrTimeToNanoseconds } from '@opentelemetry/core'; -const NANOSECONDS = BigInt(1_000_000_000); - export function hrTimeToNanos(hrTime: HrTime): bigint { + const NANOSECONDS = BigInt(1_000_000_000); return BigInt(hrTime[0]) * NANOSECONDS + BigInt(hrTime[1]); }