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

    Class ObserveSDK

    Implements

    Index

    Constructors

    • Parameters

      • options: CommonOptions & {
            consoleMethodsToRecord?: (
                | "error"
                | "assert"
                | "count"
                | "countReset"
                | "debug"
                | "dir"
                | "dirxml"
                | "group"
                | "groupCollapsed"
                | "groupEnd"
                | "info"
                | "log"
                | "table"
                | "time"
                | "timeEnd"
                | "timeLog"
                | "trace"
                | "warn"
            )[];
            disableConsoleRecording?: boolean;
            enablePerformanceRecording?: boolean;
            enablePromisePatch?: boolean;
            environment?: string;
            networkRecording?: boolean
            | NetworkRecordingOptions;
            otel?: OtelOptions & {
                eventNames?: (keyof HTMLElementEventMap)[];
                otlpEndpoint?: string;
            };
            reportConsoleErrors?: boolean;
            tracingOrigins?: boolean
            | (string | RegExp)[];
        } & { projectId: string; sessionSecureId: string }
        • OptionalconsoleMethodsToRecord?: (
              | "error"
              | "assert"
              | "count"
              | "countReset"
              | "debug"
              | "dir"
              | "dirxml"
              | "group"
              | "groupCollapsed"
              | "groupEnd"
              | "info"
              | "log"
              | "table"
              | "time"
              | "timeEnd"
              | "timeLog"
              | "trace"
              | "warn"
          )[]

          Specifies which console methods to record. The value here will be ignored if disabledConsoleRecording is true.

          All console methods.
          
          consoleMethodsToRecord: ['log', 'info', 'error']
          
        • OptionaldisableConsoleRecording?: boolean

          Specifies whether the SDK will record console messages.

          false
          
        • OptionalenablePerformanceRecording?: boolean

          Specifies whether to record performance metrics (e.g. FPS, device memory).

          true
          
        • OptionalenablePromisePatch?: boolean

          Specifies whether window.Promise should be patched to record the stack trace of promise rejections.

          true
          
        • Optionalenvironment?: string

          Specifies the environment your application is running in. This is useful to distinguish whether your session was recorded on localhost or in production.

          'production'
          
        • OptionalnetworkRecording?: boolean | NetworkRecordingOptions

          Specifies how and what the SDK records from network requests and responses.

        • Optionalotel?: OtelOptions & {
              eventNames?: (keyof HTMLElementEventMap)[];
              otlpEndpoint?: string;
          }

          OTLP options for OpenTelemetry tracing. Instrumentations are enabled by default.

        • OptionalreportConsoleErrors?: boolean

          Specifies whether the SDK will report console.error invocations as Errors.

          false
          
        • OptionaltracingOrigins?: boolean | (string | RegExp)[]

          Specifies where the backend of the app lives. If specified, the SDK will attach the traceparent header to outgoing requests whose destination URLs match a substring or regexp from this list, so that backend errors can be linked back to the session. If 'true' is specified, all requests to the current domain will be matched.

          tracingOrigins: ['localhost', /^//, 'backend.myapp.com']
          
        • projectId: string
        • sessionSecureId: string

      Returns ObserveSDK

    Properties

    organizationID: string

    Verbose project ID that is exposed to users. Legacy users may still be using ints.

    Methods

    • Record arbitrary logs from your own integrations or manual. Useful when you don't want to emit a console log to the browser dev tools but still want to report a custom log.

      Parameters

      • message: any
      • level:
            | "error"
            | "assert"
            | "count"
            | "countReset"
            | "debug"
            | "dir"
            | "dirxml"
            | "group"
            | "groupCollapsed"
            | "groupEnd"
            | "info"
            | "log"
            | "table"
            | "time"
            | "timeEnd"
            | "timeLog"
            | "trace"
            | "warn"
      • Optionalmetadata: Attributes

      Returns void

    • Starts a new span for tracing in Highlight. The span will be ended when the end() is called on the span. It returns whatever is returned from the callback function.

      Parameters

      • name: string

        The name of the span.

      • options: SpanOptions | ((span: Span) => any)

        Options for the span.

      • Optionalcontext: Context | ((span: Span) => any)

        The context for the span.

      • Optionalfn: (span: Span) => any

        The function to run in the span.

      Returns any

      H.startManualSpan('span-name', options, (span) => {
      span.addEvent('event-name', { key: 'value' })
      span.setAttribute('key', 'value')
      await someAsyncFunction()
      span.end()
      })
      const span = H.startManualSpan('span-name', (s) => s)
      span.addEvent('event-name', { key: 'value' })
      await someAsyncFunction()
      span.end()
    • Starts a new span for tracing in Highlight. The span will be ended when the callback function returns.

      Parameters

      • name: string

        The name of the span.

      • options: SpanOptions | ((span?: Span) => any)

        Options for the span.

      • Optionalcontext: Context | ((span?: Span) => any)

        The context for the span.

      • Optionalfn: (span?: Span) => any

      Returns any

      H.startSpan('span-name', callbackFn)
      
      H.startSpan('span-name', options, callbackFn)
      
      H.startSpan('span-name', options, context, callbackFn)
      
      H.startSpan('span-name', async (span) => {
      span.setAttribute('key', 'value')
      await someAsyncFunction()
      })