Unified · Split
| @@ -7,9 +7,12 @@ import * as Logger from "effect/Logger"; · 6 unmodified lines | |||
| 7 | import * as Option from "effect/Option"; | 7 | import * as Option from "effect/Option"; |
| 8 | import * as PlatformError from "effect/PlatformError"; | 8 | import * as PlatformError from "effect/PlatformError"; |
| 9 | import * as References from "effect/References"; | 9 | import * as References from "effect/References"; |
| 10 | import * as Schema from "effect/Schema"; | ||
| 10 | 11 | ||
| 11 | import * as TraceDiagnostics from "./TraceDiagnostics.ts"; | 12 | import * as TraceDiagnostics from "./TraceDiagnostics.ts"; |
| 12 | 13 | ||
| 14 | const encodeUnknownJsonString = Schema.encodeUnknownSync(Schema.UnknownFromJsonString); | ||
| 15 | |||
| 13 | function ns(ms: number): string { | 16 | function ns(ms: number): string { |
| 14 | return String(BigInt(ms) * 1_000_000n); | 17 | return String(BigInt(ms) * 1_000_000n); |
| 15 | } | 18 | } |
| @@ -23,7 +26,7 @@ function record(input: { · 7 unmodified lines | |||
| 23 | readonly exit?: { readonly _tag: "Success" | "Failure" | "Interrupted"; readonly cause?: string }; | 26 | readonly exit?: { readonly _tag: "Success" | "Failure" | "Interrupted"; readonly cause?: string }; |
| 24 | readonly events?: ReadonlyArray<unknown>; | 27 | readonly events?: ReadonlyArray<unknown>; |
| 25 | }) { | 28 | }) { |
| 26 | return JSON.stringify({ | 29 | return encodeUnknownJsonString({ |
| 27 | type: "effect-span", | 30 | type: "effect-span", |
| 28 | name: input.name, | 31 | name: input.name, |
| 29 | traceId: input.traceId, | 32 | traceId: input.traceId, |
| @@ -159,7 +162,7 @@ describe("TraceDiagnostics", () => { · 129 unmodified lines | |||
| 159 | files: [ | 162 | files: [ |
| 160 | { | 163 | { |
| 161 | path: "/tmp/server.trace.ndjson", | 164 | path: "/tmp/server.trace.ndjson", |
| 162 | text: JSON.stringify({ | 165 | text: encodeUnknownJsonString({ |
| 163 | name: "server.noStart", | 166 | name: "server.noStart", |
| 164 | traceId: "trace-no-start", | 167 | traceId: "trace-no-start", |
| 165 | spanId: "span-no-start", | 168 | spanId: "span-no-start", |