import { type Attributes } from '@opentelemetry/api'; import { type InstrumentationConfig } from '@opentelemetry/instrumentation'; import { AlwaysOffSampler, AlwaysOnSampler, type BufferConfig, ParentBasedSampler, type ReadableSpan, type SpanExporter, type SpanProcessor } from '@opentelemetry/sdk-trace-base'; import type { WebTracerConfig } from '@opentelemetry/sdk-trace-web'; import { type RumOtelWebEventTarget } from './event-target'; import { MXLConsoleInstrumentation } from './instrumentation/mxl-console-instrumentation'; import { type ContextManagerConfig } from './instrumentation/mxl-context-manager'; import type { MXLFetchInstrumentationConfig } from './instrumentation/mxl-fetch-instrumentation'; import { type MXLPostDocLoadResourceInstrumentationConfig } from './instrumentation/mxl-post-doc-load-resource-instrumentation'; import { type SocketIoClientInstrumentationConfig } from './instrumentation/mxl-socketio-client-instrumentation'; import { MXLSpanAttributesProcessor } from './instrumentation/mxl-span-attributes-processor'; import { type SplunkUserInteractionInstrumentationConfig, type UserInteractionEventsConfig } from './instrumentation/mxl-user-interaction-instrumentation'; import { MXLWebTracerProvider } from './instrumentation/mxl-web-tracer-provider'; import type { MXLXMLHttpRequestInstrumentationConfig } from './instrumentation/mxl-xml-http-request-instrumentation'; import { type SessionIdType } from './session'; import { SessionBasedSampler } from './session-based-sampler'; export * from './session-based-sampler'; export * from './instrumentation/mxl-web-tracer-provider'; interface MXLOtelWebOptionsInstrumentations { console?: boolean | MXLConsoleInstrumentation; document?: boolean | InstrumentationConfig; errors?: boolean; fetch?: boolean | MXLFetchInstrumentationConfig; interactions?: boolean | SplunkUserInteractionInstrumentationConfig; longtask?: boolean | InstrumentationConfig; visibility?: boolean | InstrumentationConfig; connectivity?: boolean | InstrumentationConfig; postload?: boolean | MXLPostDocLoadResourceInstrumentationConfig; socketio?: boolean | SocketIoClientInstrumentationConfig; websocket?: boolean | InstrumentationConfig; webvitals?: boolean; xhr?: boolean | MXLXMLHttpRequestInstrumentationConfig; } export interface RumOtelWebExporterOptions { /** * Allows remapping Span's attributes right before they're serialized. * One potential use case of this method is to remove PII from the attributes. */ onAttributesSerializing?: (attributes: Attributes, span: ReadableSpan) => Attributes; } export interface RumOtelWebConfig { /** Allows http beacon urls */ allowInsecureUrl?: boolean; /** Service name */ service?: string; /** Destination for the captured data */ url: string | undefined; /** Options for context manager */ context?: ContextManagerConfig; /** Sets session cookie to this domain */ cookieDomain?: string; /** Turns on/off internal debug logging */ debug?: boolean; /** * Sets a value for the `environment` attribute (persists through calls to `setGlobalAttributes()`) * */ deploymentEnvironment?: string; /** * Sets a value for the 'app.version' attribute */ version?: string; /** Allows configuring how telemetry data is sent to the backend */ exporter?: RumOtelWebExporterOptions; /** Sets attributes added to every Span. */ globalAttributes?: Attributes; /** * Applies for XHR, Fetch and Websocket URLs. URLs that partially match any regex in ignoreUrls will not be traced. * In addition, URLs that are _exact matches_ of strings in ignoreUrls will also not be traced. * */ ignoreUrls?: Array; /** Configuration for instrumentation modules. */ instrumentations?: MXLOtelWebOptionsInstrumentations; /** * Specifies where session data should be stored. * * Available options: * - `'cookie'` (default): Session data will be stored in a browser cookie. * * - `'localStorage'`: Session data will be stored in the browser's localStorage. * * If not specified, `'cookie'` will be used as the default storage method. */ persistence?: 'cookie' | 'localStorage'; /** * Publicly-visible `apiKey` value. Please do not paste any other access token or auth value into here, as this * will be visible to every user of your app * */ apiKey: string | undefined; /** * Config options passed to web tracer */ tracer?: WebTracerConfig; } interface RumOtelWebConfigInternal extends RumOtelWebConfig { bufferSize?: number; bufferTimeout?: number; exporter: RumOtelWebExporterOptions & { factory: (config: { url: string; authHeader?: string; }) => SpanExporter; }; instrumentations: MXLOtelWebOptionsInstrumentations; spanProcessor: { factory: (exporter: SpanExporter, config: T) => SpanProcessor; }; } export declare const INSTRUMENTATIONS_ALL_DISABLED: MXLOtelWebOptionsInstrumentations; export interface RumOtelWebType extends RumOtelWebEventTarget { deinit: () => void; init: (options: RumOtelWebConfig) => void; /** * Allows experimental options to be passed. No versioning guarantees are given for this method. */ _internalInit: (options: Partial) => void; provider?: MXLWebTracerProvider; attributesProcessor?: MXLSpanAttributesProcessor; setGlobalAttributes: (attributes: Attributes) => void; /** * This method provides access to computed, final value of global attributes, which are applied to all created spans. */ getGlobalAttributes: () => Attributes; /** * This method allows user to add custom action event */ addAction: (name: string, attributes?: Attributes) => void; /** * This method returns current session ID */ getSessionId: () => SessionIdType | undefined; DEFAULT_AUTO_INSTRUMENTED_EVENTS: UserInteractionEventsConfig; DEFAULT_AUTO_INSTRUMENTED_EVENT_NAMES: (keyof HTMLElementEventMap)[]; AlwaysOnSampler: typeof AlwaysOnSampler; AlwaysOffSampler: typeof AlwaysOffSampler; ParentBasedSampler: typeof ParentBasedSampler; SessionBasedSampler: typeof SessionBasedSampler; readonly inited: boolean; _processor?: any; } export declare const Rum: RumOtelWebType; export default Rum;