export declare class Agent implements Taggable, StartSpanFn { start(options?: AgentConfigOptions): Agent; isStarted(): boolean; setFramework(options: { name?: string; version?: string; overwrite?: boolean; }): void; addPatch(modules: string | Array, handler: string | PatchHandler): void; removePatch(modules: string | Array, handler: string | PatchHandler): void; clearPatches(modules: string | Array): void; middleware: { connect(): Connect.ErrorHandleFunction; }; lambda(handler: AwsLambda.Handler): AwsLambda.Handler; lambda(type: string, handler: AwsLambda.Handler): AwsLambda.Handler; handleUncaughtExceptions(fn?: (err: Error) => void): void; captureError(err: Error | string | ParameterizedMessageObject, callback?: CaptureErrorCallback): void; captureError(err: Error | string | ParameterizedMessageObject, options?: CaptureErrorOptions, callback?: CaptureErrorCallback): void; currentTraceparent: string | null; startTransaction(name?: string | null, options?: TransactionOptions): Transaction | null; startTransaction(name: string | null, type: string | null, options?: TransactionOptions): Transaction | null; startTransaction(name: string | null, type: string | null, subtype: string | null, options?: TransactionOptions): Transaction | null; startTransaction(name: string | null, type: string | null, subtype: string | null, action: string | null, options?: TransactionOptions): Transaction | null; setTransactionName(name: string): void; endTransaction(result?: string | number, endTime?: number): void; currentTransaction: Transaction | null; startSpan(name?: string | null, options?: SpanOptions): Span | null; startSpan(name: string | null, type: string | null, options?: SpanOptions): Span | null; startSpan(name: string | null, type: string | null, subtype: string | null, options?: SpanOptions): Span | null; startSpan(name: string | null, type: string | null, subtype: string | null, action: string | null, options?: SpanOptions): Span | null; currentSpan: Span | null; setLabel(name: string, value: LabelValue): boolean; addLabels(labels: Labels): boolean; setUserContext(user: UserObject): void; setCustomContext(custom: object): void; addFilter(fn: FilterFn): void; addErrorFilter(fn: FilterFn): void; addSpanFilter(fn: FilterFn): void; addTransactionFilter(fn: FilterFn): void; flush(callback?: Function): void; destroy(): void; logger: Logger; } declare class GenericSpan implements Taggable { type: string | null; subtype: string | null; action: string | null; traceparent: string; setType(type?: string | null, subtype?: string | null, action?: string | null): void; setLabel(name: string, value: LabelValue): boolean; addLabels(labels: Labels): boolean; } declare class Transaction extends GenericSpan implements StartSpanFn { name: string; result: string | number; startSpan(name?: string | null, options?: SpanOptions): Span | null; startSpan(name: string | null, type: string | null, options?: SpanOptions): Span | null; startSpan(name: string | null, type: string | null, subtype: string | null, options?: SpanOptions): Span | null; startSpan(name: string | null, type: string | null, subtype: string | null, action: string | null, options?: SpanOptions): Span | null; ensureParentId(): string; end(result?: string | number | null, endTime?: number): void; } declare class Span extends GenericSpan { transaction: Transaction; name: string; end(endTime?: number): void; } interface AgentConfigOptions { abortedErrorThreshold?: string; active?: boolean; addPatch?: KeyValueConfig; apiRequestSize?: string; apiRequestTime?: string; asyncHooks?: boolean; captureBody?: CaptureBody; captureErrorLogStackTraces?: CaptureErrorLogStackTraces; captureExceptions?: boolean; captureHeaders?: boolean; captureSpanStackTraces?: boolean; containerId?: string; disableInstrumentations?: string | string[]; environment?: string; errorMessageMaxLength?: string; errorOnAbortedRequests?: boolean; filterHttpHeaders?: boolean; frameworkName?: string; frameworkVersion?: string; globalLabels?: KeyValueConfig; hostname?: string; ignoreUrls?: Array; ignoreUserAgents?: Array; instrument?: boolean; instrumentIncomingHTTPRequests?: boolean; kubernetesNamespace?: string; kubernetesNodeName?: string; kubernetesPodName?: string; kubernetesPodUID?: string; logLevel?: LogLevel; logger?: Logger; metricsInterval?: string; payloadLogFile?: string; centralConfig?: boolean; secretToken?: string; serverTimeout?: string; serverUrl?: string; serviceName?: string; serviceVersion?: string; sourceLinesErrorAppFrames?: number; sourceLinesErrorLibraryFrames?: number; sourceLinesSpanAppFrames?: number; sourceLinesSpanLibraryFrames?: number; stackTraceLimit?: number; transactionMaxSpans?: number; transactionSampleRate?: number; usePathAsTransactionName?: boolean; verifyServerCert?: boolean; } interface CaptureErrorOptions { request?: any; response?: any; timestamp?: number; handled?: boolean; user?: UserObject; labels?: Labels; tags?: Labels; custom?: object; message?: string; } interface Labels { [key: string]: LabelValue; } interface UserObject { id?: string | number; username?: string; email?: string; } interface ParameterizedMessageObject { message: string; params: Array; } interface Logger { fatal(msg: string, ...args: any[]): void; fatal(obj: {}, msg?: string, ...args: any[]): void; error(msg: string, ...args: any[]): void; error(obj: {}, msg?: string, ...args: any[]): void; warn(msg: string, ...args: any[]): void; warn(obj: {}, msg?: string, ...args: any[]): void; info(msg: string, ...args: any[]): void; info(obj: {}, msg?: string, ...args: any[]): void; debug(msg: string, ...args: any[]): void; debug(obj: {}, msg?: string, ...args: any[]): void; trace(msg: string, ...args: any[]): void; trace(obj: {}, msg?: string, ...args: any[]): void; [propName: string]: any; } interface TransactionOptions { startTime?: number; childOf?: Transaction | Span | string; } interface SpanOptions { childOf?: Transaction | Span | string; } declare type CaptureBody = "off" | "errors" | "transactions" | "all"; declare type CaptureErrorLogStackTraces = "never" | "messages" | "always"; declare type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal"; declare type CaptureErrorCallback = (err: Error | null, id: string) => void; declare type FilterFn = (payload: Payload) => Payload | boolean | void; declare type LabelValue = string | number | boolean | null | undefined; declare type KeyValueConfig = string | Labels | Array>; declare type Payload = { [propName: string]: any; }; declare type PatchHandler = (exports: any, agent: Agent, options: PatchOptions) => any; interface PatchOptions { version: string | undefined; enabled: boolean; } interface Taggable { setLabel(name: string, value: LabelValue): boolean; addLabels(labels: Labels): boolean; } interface StartSpanFn { startSpan(name?: string | null, options?: SpanOptions): Span | null; startSpan(name: string | null, type: string | null, options?: SpanOptions): Span | null; startSpan(name: string | null, type: string | null, subtype: string | null, options?: SpanOptions): Span | null; startSpan(name: string | null, type: string | null, subtype: string | null, action: string | null, options?: SpanOptions): Span | null; } declare namespace AwsLambda { interface CognitoIdentity { cognitoIdentityId: string; cognitoIdentityPoolId: string; } interface ClientContext { client: ClientContextClient; custom?: any; env: ClientContextEnv; } interface ClientContextClient { installationId: string; appTitle: string; appVersionName: string; appVersionCode: string; appPackageName: string; } interface ClientContextEnv { platformVersion: string; platform: string; make: string; model: string; locale: string; } type Callback = (error?: Error | null | string, result?: TResult) => void; interface Context { callbackWaitsForEmptyEventLoop: boolean; functionName: string; functionVersion: string; invokedFunctionArn: string; memoryLimitInMB: number; awsRequestId: string; logGroupName: string; logStreamName: string; identity?: CognitoIdentity; clientContext?: ClientContext; getRemainingTimeInMillis(): number; done(error?: Error, result?: any): void; fail(error: Error | string): void; succeed(messageOrObject: any): void; succeed(message: string, object: any): void; } type Handler = (event: TEvent, context: Context, callback: Callback) => void | Promise; } declare namespace Connect { type NextFunction = (err?: any) => void; type ErrorHandleFunction = (err: any, req: any, res: any, next: NextFunction) => void; } export {};