Skip to content

Commit

Permalink
Use literals for creating BigInts when possible (#5093)
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Jan 22, 2025
1 parent e96b0c7 commit 004314b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/dd-trace/src/datastreams/fnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function fnv64 (data) {
data = Buffer.from(data, 'utf-8')
}
const byteArray = new Uint8Array(data)
return fnv(byteArray, FNV1_64_INIT, FNV_64_PRIME, BigInt(2) ** BigInt(64))
return fnv(byteArray, FNV1_64_INIT, FNV_64_PRIME, 2n ** 64n)
}

module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions packages/dd-trace/src/debugger/devtools_client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const expression = `
const threadId = parentThreadId === 0 ? `pid:${process.pid}` : `pid:${process.pid};tid:${parentThreadId}`
const threadName = parentThreadId === 0 ? 'MainThread' : `WorkerThread:${parentThreadId}`

const oneSecondNs = BigInt(1_000_000_000)
let globalSnapshotSamplingRateWindowStart = BigInt(0)
const oneSecondNs = 1_000_000_000n
let globalSnapshotSamplingRateWindowStart = 0n
let snapshotsSampledWithinTheLastSecond = 0

// WARNING: The code above the line `await session.post('Debugger.resume')` is highly optimized. Please edit with care!
Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/test/llmobs/span_processor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('span processor', () => {
it('removes problematic fields from the metadata', () => {
// problematic fields are circular references or bigints
const metadata = {
bigint: BigInt(1),
bigint: 1n,
deep: {
foo: 'bar'
},
Expand Down

0 comments on commit 004314b

Please sign in to comment.