/** * * Copyright 2020-2026 Splunk Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation'; import { SessionManager } from '../managers'; import { SplunkOtelWebConfig } from '../types'; import { SpanContext } from '../utils/attributes'; export declare const STACK_TRACE_URL_PATTER: RegExp; export type InternalErrorLike = string | Event | Error | ErrorEvent | Array; export declare const ERROR_INSTRUMENTATION_NAME = "errors"; export declare const ERROR_INSTRUMENTATION_VERSION = "1"; type BackwardsCompatErrorLike = InternalErrorLike | any[]; type ErrorWithContext = { context: SpanContext; error: BackwardsCompatErrorLike; }; type ErrorTransformer = (arg: InternalErrorLike, context: SpanContext) => ErrorWithContext | null; export type SplunkErrorInstrumentationConfig = InstrumentationConfig & { onError?: ErrorTransformer; }; export declare class SplunkErrorInstrumentation extends InstrumentationBase { protected _splunkConfig: SplunkErrorInstrumentationConfig; protected otelConfig: SplunkOtelWebConfig; sessionManager?: SessionManager | undefined; private clearingIntervalId?; private throttleMap; constructor(_splunkConfig: SplunkErrorInstrumentationConfig, otelConfig: SplunkOtelWebConfig, sessionManager?: SessionManager | undefined); disable(): void; enable(): void; init(): void; isValidContext: (ctx: SpanContext) => boolean; isValidErrorArg: (errorArg: unknown) => errorArg is BackwardsCompatErrorLike; report(source: string, arg: InternalErrorLike, spanContext: SpanContext): Promise; protected reportError(source: string, err: Error, spanContext: SpanContext): Promise; protected reportErrorEvent(source: string, ev: ErrorEvent, spanContext: SpanContext): Promise; protected reportEvent(source: string, ev: Event, spanContext: SpanContext): Promise; protected reportString(source: string, message: string, firstError: Error | undefined, spanContext: SpanContext): Promise; protected transform(error: InternalErrorLike, spanContext: SpanContext): ErrorWithContext | null; private attachClearingInterval; private attachSpanContext; private clearExpiredItemsInThrottleMap; private consoleErrorHandler; private documentErrorListener; private endSpanWithThrottle; private errorListener; private unhandledRejectionListener; } export {};