UNPKG

backtrace-node

Version:
76 lines (75 loc) 2.9 kB
/// <reference types="node" /> import { EventEmitter } from 'events'; import { BacktraceClientOptions, IBacktraceClientOptions } from './model/backtraceClientOptions'; import { BacktraceReport } from './model/backtraceReport'; import { BacktraceResult } from './model/backtraceResult'; /** * Backtrace client */ export declare class BacktraceClient extends EventEmitter { options: BacktraceClientOptions; private _scopedAttributes; private _memorizedAttributes; private _backtraceApi; private _clientRateLimit; private _symbolication; private _symbolicationMap?; private attributes; private readonly _backtraceMetrics; constructor(clientOptions: IBacktraceClientOptions | BacktraceClientOptions); private getClientAttributes; /** * Memorize selected values from application. * Memorized attributes will be available in your next Backtrace report. * Memorized attributes will be only available for one report. * @param key attribute key * @param value attribute value */ memorize(key: string, value: any): void; /** * Set symbolication info */ setSymbolication(): void; /** * Add symbolication map to each report. * @param symbolicationMap */ setSymbolicationMap(symbolicationMap: Array<{ file: string; uuid: string; }>): void; /** * Clear all saved attributes */ clearMemorizedAttributes(): void; /** * Returns all memorized attributes without clearing them. */ checkMemorizedAttributes(): object; createReport(payload: Error | string, reportAttributes?: object | undefined, fileAttachments?: string[]): BacktraceReport; /** * Send report asynchronously to Backtrace * @param payload report payload * @param reportAttributes attributes * @param fileAttachments file attachments paths */ reportAsync(payload: Error | string, reportAttributes?: object | undefined, fileAttachments?: string[]): Promise<BacktraceResult>; /** * Send report synchronosuly to Backtrace * @param payload report payload - error or string * @param reportAttributes attributes * @param fileAttachments file attachments paths */ reportSync(payload: Error | string, reportAttributes?: object | undefined, fileAttachments?: string[]): BacktraceResult; sendReport(report: BacktraceReport, callback?: (err?: Error) => void): BacktraceResult; sendAsync(report: BacktraceReport): Promise<BacktraceResult>; private testClientLimits; private samplingHit; private getSubmitUrl; private combineClientAttributes; private getMemorizedAttributes; private registerHandlers; private registerPromiseHandler; private setupScopedAttributes; private registerGlobalHandler; }