Skip to content

Commit

Permalink
Fix compatibility with node < 14.18 (#3908)
Browse files Browse the repository at this point in the history
Node 14 versions prior to 14.18 do not support require statements with
`node:` prefix.
  • Loading branch information
nsavoire authored and khanayan123 committed Jan 2, 2024
1 parent 18f378b commit d482f2d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions integration-tests/profiler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const childProcess = require('child_process')
const { fork } = childProcess
const path = require('path')
const { assert } = require('chai')
const fs = require('node:fs/promises')
const fsync = require('node:fs')
const net = require('node:net')
const zlib = require('node:zlib')
const fs = require('fs/promises')
const fsync = require('fs')
const net = require('net')
const zlib = require('zlib')
const { Profile } = require('pprof-format')
const semver = require('semver')

Expand Down
3 changes: 1 addition & 2 deletions integration-tests/profiler/nettest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const net = require('node:net')
const process = require('node:process')
const net = require('net')

async function streamToString (stream) {
const chunks = []
Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/src/profiling/profilers/events.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { performance, constants, PerformanceObserver } = require('node:perf_hooks')
const { performance, constants, PerformanceObserver } = require('perf_hooks')
const { END_TIMESTAMP_LABEL } = require('./shared')
const semver = require('semver')
const { Function, Label, Line, Location, Profile, Sample, StringTable, ValueType } = require('pprof-format')
Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/src/profiling/profilers/shared.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { isMainThread, threadId } = require('node:worker_threads')
const { isMainThread, threadId } = require('worker_threads')

const END_TIMESTAMP_LABEL = 'end_timestamp_ns'
const THREAD_NAME_LABEL = 'thread name'
Expand Down

0 comments on commit d482f2d

Please sign in to comment.