From 122659117e5b37b74bec730e3edcfef541d95a40 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 5 Apr 2023 09:09:30 -0400 Subject: [PATCH 1/3] Log name and ID on span end misuse --- packages/opentelemetry-sdk-trace-base/src/Span.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opentelemetry-sdk-trace-base/src/Span.ts b/packages/opentelemetry-sdk-trace-base/src/Span.ts index 0f742855d1..226a20a9aa 100644 --- a/packages/opentelemetry-sdk-trace-base/src/Span.ts +++ b/packages/opentelemetry-sdk-trace-base/src/Span.ts @@ -216,7 +216,7 @@ export class Span implements APISpan, ReadableSpan { end(endTime?: TimeInput): void { if (this._isSpanEnded()) { - diag.error('You can only call end() on a span once.'); + diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`); return; } this._ended = true; From cd6b5447be5d814477d8376c28e1d645ec464802 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 5 Apr 2023 09:11:19 -0400 Subject: [PATCH 2/3] Changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9172dab89..e894e1efd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :rocket: (Enhancement) +* feat(tracing): log span name and IDs when span end is called multiple times [#3716](https://github.com/open-telemetry/opentelemetry-js/pull/3716) + ### :bug: (Bug Fix) * fix(instrumentation-http): fixed description for http.server.duration metric [#3710](https://github.com/open-telemetry/opentelemetry-js/pull/3710) From 01f8e79f89019e12792a39144c6b066c46139265 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 5 Apr 2023 11:58:00 -0400 Subject: [PATCH 3/3] lint --- packages/opentelemetry-sdk-trace-base/src/Span.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/opentelemetry-sdk-trace-base/src/Span.ts b/packages/opentelemetry-sdk-trace-base/src/Span.ts index 226a20a9aa..31fb1555ac 100644 --- a/packages/opentelemetry-sdk-trace-base/src/Span.ts +++ b/packages/opentelemetry-sdk-trace-base/src/Span.ts @@ -216,7 +216,9 @@ export class Span implements APISpan, ReadableSpan { end(endTime?: TimeInput): void { if (this._isSpanEnded()) { - diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`); + diag.error( + `${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.` + ); return; } this._ended = true;