Skip to content

Commit

Permalink
fix: swap log levels for two log points (#882)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin authored Oct 12, 2018
1 parent c2b9349 commit e73af2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/trace-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export class StackdriverTracer implements Tracer {
// with continuously growing number of child spans. The second case
// seems to have some value, but isn't representable. The user probably
// needs a custom outer span that encompasses the entirety of work.
this.logger!.error(`TraceApi#createChildSpan: [${
this.logger!.warn(`TraceApi#createChildSpan: [${
this.pluginName}] Creating phantom child span [${
options.name}] because root span [${
rootSpan.span.name}] was already closed.`);
Expand Down Expand Up @@ -270,7 +270,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!.warn(`TraceApi#createChildSpan: [${
this.logger!.error(`TraceApi#createChildSpan: [${
this.pluginName}] Adding child span [${
options.name}] will cause the trace with root span [${
rootSpan.span.name}] to contain more than ${
Expand Down
4 changes: 2 additions & 2 deletions test/test-trace-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ describe('Trace Interface', () => {
});
});

it('should warn when the spans per trace soft limit has been exceeded',
it('should error when the spans per trace soft limit has been exceeded',
() => {
const tracer = createTraceAgent(
null, {spansPerTraceSoftLimit: 10, spansPerTraceHardLimit: 20});
tracer.runInRootSpan({name: 'root'}, (rootSpan) => {
for (let i = 0; i < 10; i++) {
tracer.createChildSpan({name: `span-${i}`}).endSpan();
}
assert.strictEqual(logger.getNumLogsWith('warn', '[span-9]'), 1);
assert.strictEqual(logger.getNumLogsWith('error', '[span-9]'), 1);
for (let i = 0; i < 9; i++) {
tracer.createChildSpan({name: `span-${i + 10}`}).endSpan();
}
Expand Down

0 comments on commit e73af2b

Please sign in to comment.