File size: 1,029 Bytes
96c8713
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Opt-in OpenTelemetry runtime for `tracePropagation`.
 *
 * Importing this module registers the OpenTelemetry trace context extractor
 * used by every Supabase client in the process. It has no exports — the
 * import itself is the opt-in:
 *
 * ```ts
 * import '@supabase/supabase-js/tracing'
 * import { createClient } from '@supabase/supabase-js'
 *
 * const supabase = createClient(url, key, { tracePropagation: true })
 * ```
 *
 * Requires `@opentelemetry/api` to be installed — this module imports it
 * directly, so bundlers include it and resolution fails loudly when it is
 * missing. Without this import, enabling `tracePropagation` logs a one-time
 * warning and requests are sent without trace headers.
 *
 * @module tracing
 */
import { propagation, context } from '@opentelemetry/api'
import { createTraceContextExtractor } from '@supabase/tracing'
import { registerTraceContextExtractor } from './lib/tracingRegistry'

registerTraceContextExtractor(createTraceContextExtractor({ propagation, context }))