Skip to content

Commit 2cd26c1

Browse files
committed
Cleanup code a little
1 parent 5c17cc9 commit 2cd26c1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/tracing.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { traceFn } from './trace';
55
import { SpanBuilder } from './builder';
66
import type {
77
Attributes,
8+
globalThis,
89
SpanContext,
910
SpanCreationOptions,
1011
SpanData,
@@ -190,8 +191,9 @@ export class Trace extends Span {
190191
}
191192
headers.append('content-type', 'application/json');
192193

194+
// Tests
193195
// TODO: Properly pass trace context down and update the tests
194-
if (!headers.has('x-trace-id')) {
196+
if ((globalThis as globalThis).MINIFLARE && !headers.has('x-trace-id')) {
195197
headers.append('x-trace-id', this.getTraceId());
196198
}
197199

src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,7 @@ export type CfWithTrace = IncomingRequestCfProperties & {
144144
}
145145

146146
export type TracedFn<T> = (span: Span) => T;
147+
148+
export interface globalThis {
149+
MINIFLARE?: boolean;
150+
}

0 commit comments

Comments
 (0)