@grand-board/otel-cloudflare - v6.11.0
    Preparing search index...

    Variable instrumentedFetchConst

    instrumentedFetch: (
        input: RequestInfo<unknown, CfProperties<unknown>> | URL,
        init?: RequestInit<CfProperties<unknown>>,
        options?: TracedFetchOptions,
    ) => Promise<Response> = ...

    Instrumented fetch that can be used as a drop-in replacement

    Uses the global fetch and automatically adds tracing. The third parameter allows passing TracedFetchOptions.

    Type Declaration

      • (
            input: RequestInfo<unknown, CfProperties<unknown>> | URL,
            init?: RequestInit<CfProperties<unknown>>,
            options?: TracedFetchOptions,
        ): Promise<Response>
      • Parameters

        • input: RequestInfo<unknown, CfProperties<unknown>> | URL
        • Optionalinit: RequestInit<CfProperties<unknown>>
        • Optionaloptions: TracedFetchOptions

        Returns Promise<Response>

    import { instrumentedFetch } from '@grand-board/otel-cloudflare';

    // Use like regular fetch
    const response = await instrumentedFetch('https://api.example.com/data');

    // With options
    const response = await instrumentedFetch('https://api.example.com/data', {
    method: 'POST',
    body: JSON.stringify({ foo: 'bar' }),
    });