Skip to content

Commit b7f0570

Browse files
rochdevclaude
andcommitted
refactor(guardrails): extract runtimeInfo to improve patch coverage
Istanbul only emits a single DA entry at the opening line of a multi-line telemetry() call, so the result_reason property string concatenation was never recorded in the lcov. Extracting it into a var statement gives Istanbul a separately-tracked line to instrument. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6ce70e4 commit b7f0570

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • packages/dd-trace/src/guardrails

packages/dd-trace/src/guardrails/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ function guard (fn) {
4747
// should not initialize the tracer.
4848
if (!clobberBailout && (NODE_MAJOR < minMajor || NODE_MAJOR >= nextMajor)) {
4949
initBailout = true
50+
var runtimeInfo = 'Incompatible runtime Node.js ' + version + ', supported runtimes: Node.js ' + supportedRange
5051
telemetry([
5152
{ name: 'abort', tags: ['reason:incompatible_runtime'] },
5253
{ name: 'abort.runtime', tags: [] }
5354
], undefined, {
5455
result: 'abort',
5556
result_class: 'incompatible_runtime',
56-
result_reason: 'Incompatible runtime Node.js ' + version + ', supported runtimes: Node.js ' + supportedRange
57+
result_reason: runtimeInfo
5758
})
5859
log.info('Aborting application instrumentation due to incompatible_runtime.')
5960
log.info('Found incompatible runtime Node.js %s, Supported runtimes: Node.js %s.', version, supportedRange)

0 commit comments

Comments
 (0)