diff --git a/.changesets/fix-different-spans-being-shown-with-the-same-body.md b/.changesets/fix-different-spans-being-shown-with-the-same-body.md new file mode 100644 index 00000000..cc978e46 --- /dev/null +++ b/.changesets/fix-different-spans-being-shown-with-the-same-body.md @@ -0,0 +1,6 @@ +--- +bump: patch +type: fix +--- + +Fix different spans of the same category incorrectly being reported with the same body. diff --git a/ext/appsignal_extension.cpp b/ext/appsignal_extension.cpp index cba1b4e3..b21726aa 100644 --- a/ext/appsignal_extension.cpp +++ b/ext/appsignal_extension.cpp @@ -358,23 +358,6 @@ Napi::Value CloseSpan(const Napi::CallbackInfo &info) { return env.Null(); } -Napi::Value CloseSpanWithTimestamp(const Napi::CallbackInfo &info) { - Napi::Env env = info.Env(); - - Napi::External span = - info[0].As>(); - - Napi::Number endTimeSec = info[1].As(); - Napi::Number endTimeNsec = info[2].As(); - - appsignal_close_span_with_timestamp(span.Data(), - endTimeSec.Int64Value(), - endTimeNsec.Int32Value() - ); - - return env.Null(); -} - // Metrics Napi::Value SetGauge(const Napi::CallbackInfo &info) { @@ -511,8 +494,6 @@ Napi::Object CreateSpanObject(Napi::Env env, Napi::Object exports) { span.Set(Napi::String::New(env, "closeSpan"), Napi::Function::New(env, CloseSpan)); - span.Set(Napi::String::New(env, "closeSpanWithTimestamp"), - Napi::Function::New(env, CloseSpanWithTimestamp)); span.Set(Napi::String::New(env, "addSpanError"), Napi::Function::New(env, AddSpanError)); span.Set(Napi::String::New(env, "spanToJSON"), diff --git a/src/span.ts b/src/span.ts index 5bd90888..2924b595 100644 --- a/src/span.ts +++ b/src/span.ts @@ -26,12 +26,8 @@ export class Span { this.#ref = ref } - public close({ timestamp }: { timestamp?: [number, number] } = {}): this { - if (timestamp !== undefined) { - span.closeSpanWithTimestamp(this.#ref, timestamp[0], timestamp[1]) - } else { - span.closeSpan(this.#ref) - } + public close(): this { + span.closeSpan(this.#ref) return this } diff --git a/src/span_processor.ts b/src/span_processor.ts index 765f8a5e..d0c27116 100644 --- a/src/span_processor.ts +++ b/src/span_processor.ts @@ -60,7 +60,7 @@ export class SpanProcessor implements OpenTelemetrySpanProcessor { } }) - opentelemetrySpan.close({ timestamp: [span.endTime[0], span.endTime[1]] }) + opentelemetrySpan.close() } shutdown(): Promise {