UNPKG

1.23 kBTypeScriptView Raw
1import type { Client, HandlerDataFetch, Scope, Span, SpanOrigin } from '@sentry/types';
2type PolymorphicRequestHeaders = Record<string, string | undefined> | Array<[string, string]> | {
3 [key: string]: any;
4 append: (key: string, value: string) => void;
5 get: (key: string) => string | null | undefined;
6};
7/**
8 * Create and track fetch request spans for usage in combination with `addFetchInstrumentationHandler`.
9 *
10 * @returns Span if a span was created, otherwise void.
11 */
12export declare function instrumentFetchRequest(handlerData: HandlerDataFetch, shouldCreateSpan: (url: string) => boolean, shouldAttachHeaders: (url: string) => boolean, spans: Record<string, Span>, spanOrigin?: SpanOrigin): Span | undefined;
13/**
14 * Adds sentry-trace and baggage headers to the various forms of fetch headers
15 */
16export declare function addTracingHeadersToFetchRequest(request: string | unknown, // unknown is actually type Request but we can't export DOM types from this package,
17client: Client, scope: Scope, options: {
18 headers?: {
19 [key: string]: string[] | string | undefined;
20 } | PolymorphicRequestHeaders;
21}, span?: Span): PolymorphicRequestHeaders | undefined;
22export {};
23//# sourceMappingURL=fetch.d.ts.map
\No newline at end of file