@launchdarkly/observability + @launchdarkly/session-replay
    Preparing search index...

    Type Alias OtelOptions

    type OtelOptions = {
        instrumentations?: OtelInstrumentatonOptions;
        onHttpRequestSpan?: (span: Span, request: HttpSpanRequest) => void;
    }
    Index

    Properties

    instrumentations?: OtelInstrumentatonOptions
    onHttpRequestSpan?: (span: Span, request: HttpSpanRequest) => void

    Called for each auto-instrumented fetch and XMLHttpRequest span just before it ends, so the response and error status are already on it. Use it to rename the span or add attributes, for example to give it a route template:

    onHttpRequestSpan: (span, { method, url }) => {
    const route = matchRoute(url) // '/api/users/{userId}'
    if (!route) return
    span.updateName(`${method} ${route}`)
    span.setAttributes({
    'http.route': route,
    'url.template': route,
    'launchdarkly.operation.name': route,
    })
    }

    The span's trace and span ids are fixed when the request starts, so renaming does not affect the traceparent sent to your backend. Errors thrown by the callback are swallowed. Requires networkRecording to be enabled, as the instrumentations are not installed otherwise.