Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Commit 3f55458

Browse files
authored
feat: downgrade soft/hard span limit logs to warn level (#1269)
1 parent d154ff3 commit 3f55458

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/trace-api.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export class StackdriverTracer implements Tracer {
320320
// As in the previous case, a root span with a large number of child
321321
// spans suggests a memory leak stemming from context confusion. This
322322
// is likely due to userspace task queues or Promise implementations.
323-
this.logger!.error(
323+
this.logger!.warn(
324324
`TraceApi#createChildSpan: [${
325325
this.pluginNameToLog
326326
}] Creating phantom child span [${
@@ -331,7 +331,7 @@ export class StackdriverTracer implements Tracer {
331331
this.config!.spansPerTraceHardLimit
332332
} spans. This is likely a memory leak.`
333333
);
334-
this.logger!.error(
334+
this.logger!.warn(
335335
[
336336
'TraceApi#createChildSpan: Please see',
337337
'https://github.com/googleapis/cloud-trace-nodejs/wiki',
@@ -349,7 +349,7 @@ export class StackdriverTracer implements Tracer {
349349
// RootSpanData instance, this block might be skipped because it only
350350
// checks equality -- this is OK because no automatic tracing plugin
351351
// uses the RootSpanData API directly.
352-
this.logger!.error(
352+
this.logger!.warn(
353353
`TraceApi#createChildSpan: [${
354354
this.pluginNameToLog
355355
}] Adding child span [${
@@ -360,7 +360,7 @@ export class StackdriverTracer implements Tracer {
360360
this.config!.spansPerTraceSoftLimit
361361
} spans. This is likely a memory leak.`
362362
);
363-
this.logger!.error(
363+
this.logger!.warn(
364364
[
365365
'TraceApi#createChildSpan: Please see',
366366
'https://github.com/googleapis/cloud-trace-nodejs/wiki',

test/test-trace-api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ describe('Trace Interface', () => {
176176
});
177177
});
178178

179-
it('should error when the spans per trace soft limit has been exceeded', () => {
179+
it('should warn when the spans per trace soft limit has been exceeded', () => {
180180
const tracer = createTraceAgent({
181181
spansPerTraceSoftLimit: 10,
182182
spansPerTraceHardLimit: 20,
@@ -185,13 +185,13 @@ describe('Trace Interface', () => {
185185
for (let i = 0; i < 10; i++) {
186186
tracer.createChildSpan({name: `span-${i}`}).endSpan();
187187
}
188-
assert.strictEqual(logger.getNumLogsWith('error', '[span-9]'), 1);
188+
assert.strictEqual(logger.getNumLogsWith('warn', '[span-9]'), 1);
189189
for (let i = 0; i < 9; i++) {
190190
tracer.createChildSpan({name: `span-${i + 10}`}).endSpan();
191191
}
192192
const child = tracer.createChildSpan({name: 'span-19'});
193193
assert.ok(!tracer.isRealSpan(child));
194-
assert.strictEqual(logger.getNumLogsWith('error', '[span-19]'), 1);
194+
assert.strictEqual(logger.getNumLogsWith('warn', '[span-19]'), 1);
195195
rootSpan.endSpan();
196196
});
197197
});

0 commit comments

Comments
 (0)