1// Alchemy modifications are licensed under Apache-2.0.
2// This file includes third-party code; see /THIRD_PARTY_LICENSES.md.
3import type { JaegerTracing, Span } from "./types.ts";
4
5export function mockJaegerBindingSpan(): Span {
6 return {
7 addLogs: () => {},
8 setTags: () => {},
9 end: () => {},
10 isRecording: true,
11 };
12}
13
14export function mockJaegerBinding(): JaegerTracing {
15 return {
16 enterSpan: (_, span, ...args) => {
17 return span(mockJaegerBindingSpan(), ...args);
18 },
19 getSpanContext: () => ({
20 traceId: "test-trace",
21 spanId: "test-span",
22 parentSpanId: "test-parent-span",
23 traceFlags: 0,
24 }),
25 runWithSpanContext: (_, callback, ...args) => {
26 return callback(...args);
27 },
28
29 traceId: "test-trace",
30 spanId: "test-span",
31 parentSpanId: "test-parent-span",
32 cfTraceIdHeader: "test-trace:test-span:0",
33 };
34}