Skip to content

Commit

Permalink
feat: downgrade soft/hard span limit logs to warn level (#1269)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin authored May 29, 2020
1 parent d154ff3 commit 3f55458
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/trace-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export class StackdriverTracer implements Tracer {
// As in the previous case, a root span with a large number of child
// spans suggests a memory leak stemming from context confusion. This
// is likely due to userspace task queues or Promise implementations.
this.logger!.error(
this.logger!.warn(
`TraceApi#createChildSpan: [${
this.pluginNameToLog
}] Creating phantom child span [${
Expand All @@ -331,7 +331,7 @@ export class StackdriverTracer implements Tracer {
this.config!.spansPerTraceHardLimit
} spans. This is likely a memory leak.`
);
this.logger!.error(
this.logger!.warn(
[
'TraceApi#createChildSpan: Please see',
'https://github.com/googleapis/cloud-trace-nodejs/wiki',
Expand All @@ -349,7 +349,7 @@ export class StackdriverTracer implements Tracer {
// RootSpanData instance, this block might be skipped because it only
// checks equality -- this is OK because no automatic tracing plugin
// uses the RootSpanData API directly.
this.logger!.error(
this.logger!.warn(
`TraceApi#createChildSpan: [${
this.pluginNameToLog
}] Adding child span [${
Expand All @@ -360,7 +360,7 @@ export class StackdriverTracer implements Tracer {
this.config!.spansPerTraceSoftLimit
} spans. This is likely a memory leak.`
);
this.logger!.error(
this.logger!.warn(
[
'TraceApi#createChildSpan: Please see',
'https://github.com/googleapis/cloud-trace-nodejs/wiki',
Expand Down
6 changes: 3 additions & 3 deletions test/test-trace-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe('Trace Interface', () => {
});
});

it('should error when the spans per trace soft limit has been exceeded', () => {
it('should warn when the spans per trace soft limit has been exceeded', () => {
const tracer = createTraceAgent({
spansPerTraceSoftLimit: 10,
spansPerTraceHardLimit: 20,
Expand All @@ -185,13 +185,13 @@ describe('Trace Interface', () => {
for (let i = 0; i < 10; i++) {
tracer.createChildSpan({name: `span-${i}`}).endSpan();
}
assert.strictEqual(logger.getNumLogsWith('error', '[span-9]'), 1);
assert.strictEqual(logger.getNumLogsWith('warn', '[span-9]'), 1);
for (let i = 0; i < 9; i++) {
tracer.createChildSpan({name: `span-${i + 10}`}).endSpan();
}
const child = tracer.createChildSpan({name: 'span-19'});
assert.ok(!tracer.isRealSpan(child));
assert.strictEqual(logger.getNumLogsWith('error', '[span-19]'), 1);
assert.strictEqual(logger.getNumLogsWith('warn', '[span-19]'), 1);
rootSpan.endSpan();
});
});
Expand Down

0 comments on commit 3f55458

Please sign in to comment.