Unverified Commit 31edf2a9 authored by Hong Minhee's avatar Hong Minhee
Browse files

Use event.time for accurate timestamps in TraceActivityRecord

Use the OpenTelemetry event's actual timestamp instead of the export
time for more accurate trace data.

https://github.com/fedify-dev/fedify/pull/502#discussion_r2642987993
https://github.com/fedify-dev/fedify/pull/502#discussion_r2642987998
parent 7964cb3f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -353,7 +353,9 @@ export class FedifySpanExporter implements SpanExporter {
      activityJson,
      verified: typeof verified === "boolean" ? verified : undefined,
      signatureDetails,
      timestamp: new Date().toISOString(),
      timestamp: new Date(
        event.time[0] * 1000 + event.time[1] / 1e6,
      ).toISOString(),
    };
  }

@@ -404,7 +406,9 @@ export class FedifySpanExporter implements SpanExporter {
          : undefined),
      actorId,
      activityJson,
      timestamp: new Date().toISOString(),
      timestamp: new Date(
        event.time[0] * 1000 + event.time[1] / 1e6,
      ).toISOString(),
      inboxUrl: typeof inboxUrl === "string" ? inboxUrl : undefined,
    };
  }