import type { IncomingMessage } from 'http'; import { PortableBigInt } from './bigint'; import type { GraphNode, V8Profile } from './v8-profiler'; export type RaygunAPM = { makeProfiler(host?: string, port?: number, concurrentProfileLimit?: number): Profiler; }; export type Profiler = { runProfile(f: (done: () => void) => void, label?: string, relatedAsyncIds?: Set): Promise; stop(): Promise; profiles: Map; profilesByTime: ProfileWithTime[]; }; export type ProfileWithTime = { name: string; startTime: PortableBigInt; }; export type TimedContext = { start: PortableBigInt; end: PortableBigInt | null; profilesActive: Set; }; export type CommandOptions = { length: number; type: number; processId: number; threadId: number; timestamp: PortableBigInt; }; export type ProfileEffects = { queries: QueryInformation[]; requests: RequestInformation[]; exceptions: CorrelatedException[]; workerProfiles: WorkerProfile[]; }; type ProfileCommon = { startTime: PortableBigInt; rootFrameLabel: string; asyncId: number; effects: ProfileEffects; incomingGraphQLQuery: string | null; relatedAsyncIds: Set; }; export type CorrelatedException = { threadId: number; occurredAt: PortableBigInt; errorClass: string; correlationId: string; triggerAsyncId: number; }; export type InProgressProfile = ProfileCommon & { activeAsyncIds: Set; exitPoints: ExitPointManager; end: (() => Promise)[]; }; export type CapturedProfile = ProfileCommon & { v8Profile: V8Profile; }; export type QueryInformation = { threadId: number; startTime: PortableBigInt; duration: PortableBigInt; provider: string; host: string; database: string; query: string; triggerAsyncId: number; }; export type RequestDirection = 'incoming' | 'outgoing'; export type RequestInformation = { threadId: number; direction: RequestDirection; url: string; method: string; status: number; startTime: PortableBigInt; duration: PortableBigInt; triggerAsyncId: number; }; export type WorkerProfile = { profile: CapturedProfile; threadId: number; triggerAsyncId: number; }; export type StackSampleEvent = { type: 'sample'; threadId: number; timestamp: PortableBigInt; nodeID: number; } & ({ activeAsyncContext: true; stack: GraphNode[]; } | { activeAsyncContext: false; }); export type QueryEvent = { type: 'query'; threadId: number; timestamp: PortableBigInt; query: QueryInformation; }; export type HTTPEvent = { type: 'http'; threadId: number; direction: RequestDirection; timestamp: PortableBigInt; request: RequestInformation; }; export type ExceptionEvent = { type: 'exception'; threadId: number; timestamp: PortableBigInt; correlationId: string; errorClass: string; }; export type ThreadEndEvent = { type: 'thread_end'; timestamp: PortableBigInt; threadId: number; }; export type AppEvent = StackSampleEvent | QueryEvent | HTTPEvent | ExceptionEvent | ThreadEndEvent; export declare enum MethodSource { UserCode = 0, System = 1, KnownLibrary = 2, WaitForUserInput = 3, WaitForSynchronization = 4, JITCompilation = 5, GarbageCollection = 6 } export type BatchProcessor = { addBatches(batches: Buffer[]): void; isAwake(): boolean; maxBatchSizeBytes: number; maxQuerySizeBytes: number; }; export type ExitPoint = () => void; export type ExitPointManager = { makeExitPoint(label: string, options?: { forceExit: boolean; }): ExitPoint; forceComplete(): void; }; export type Transport = { send(b: Buffer): Promise; stop(): Promise; maxBatchSizeBytes: number; maxQuerySizeBytes: number; connected(): boolean; }; export type Batch = { batch: true; messages: Buffer[]; } | { batch: false; message: Buffer; }; export type IncomingRequest = IncomingMessage & { path: string; }; export type RequestFilter = { include: boolean; regexp: RegExp; }; export {};