Skip to content

Commit

Permalink
Merge pull request #1077 from appsignal/fix-span-digest-miscalculation
Browse files Browse the repository at this point in the history
Do not pass timestamp on OpenTelemetry span close
  • Loading branch information
unflxw authored Jul 4, 2024
2 parents 55cfc89 + 100e964 commit e6c70f1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: patch
type: fix
---

Fix different spans of the same category incorrectly being reported with the same body.
19 changes: 0 additions & 19 deletions ext/appsignal_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<appsignal_span_t> span =
info[0].As<Napi::External<appsignal_span_t>>();

Napi::Number endTimeSec = info[1].As<Napi::Number>();
Napi::Number endTimeNsec = info[2].As<Napi::Number>();

appsignal_close_span_with_timestamp(span.Data(),
endTimeSec.Int64Value(),
endTimeNsec.Int32Value()
);

return env.Null();
}

// Metrics

Napi::Value SetGauge(const Napi::CallbackInfo &info) {
Expand Down Expand Up @@ -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"),
Expand Down
8 changes: 2 additions & 6 deletions src/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/span_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class SpanProcessor implements OpenTelemetrySpanProcessor {
}
})

opentelemetrySpan.close({ timestamp: [span.endTime[0], span.endTime[1]] })
opentelemetrySpan.close()
}

shutdown(): Promise<void> {
Expand Down

0 comments on commit e6c70f1

Please sign in to comment.