diff --git a/integration-tests/helpers.js b/integration-tests/helpers.js index 1be229280ad..a7f2b61ca47 100644 --- a/integration-tests/helpers.js +++ b/integration-tests/helpers.js @@ -355,6 +355,14 @@ function telemetryForwarder (expectedTelemetryPoints) { } msgs = msgs.map(msg => { const [telemetryType, data] = msg.split('\t') + let parsed + try { + parsed = JSON.parse(data) + } catch (e) { + console.log(msg) + console.log(data) + throw new SyntaxError(`error parsing data: ${e.message}\n${data}`) + } return [telemetryType, JSON.parse(data)] }) await fs.unlink(process.env.FORWARDER_OUT) diff --git a/integration-tests/init.spec.js b/integration-tests/init.spec.js index f30f7e5f9da..90acb91eaf7 100644 --- a/integration-tests/init.spec.js +++ b/integration-tests/init.spec.js @@ -124,7 +124,7 @@ true }) } -describe('init.js', () => { +describe.only('init.js', () => { useSandbox() testInjectionScenarios('require', 'init.js', false) diff --git a/packages/dd-trace/src/telemetry/init-telemetry.js b/packages/dd-trace/src/telemetry/init-telemetry.js index 452cb565145..f82093d815a 100644 --- a/packages/dd-trace/src/telemetry/init-telemetry.js +++ b/packages/dd-trace/src/telemetry/init-telemetry.js @@ -60,5 +60,6 @@ function sendTelemetry (name, tags = []) { stdio: 'pipe', shell: true }) - proc.stdin.end(JSON.stringify({ metadata, points })) + const bytes = JSON.stringify({ metadata, points }) + proc.stdin.end(bytes) }