import { Context, Span, SpanOptions } from "@opentelemetry/api"; import { InstrumentationBase, InstrumentationNodeModuleFile } from "@opentelemetry/instrumentation"; export type SpanNameHook = (thisValue: any, args: IArguments) => string; export type Done = (this: any, error?: any) => void; export type BeforeExecutionHook = (span: Span, thisValue: any, args: IArguments) => void; export type ExecutionHook = (span: Span, thisValue: any, original: any, args: IArguments) => any; export type ModuleTransform = (moduleExport: any) => any; export interface Hooks { /** * hook which invocated before the original function is invoked */ beforeExecutionHook?: BeforeExecutionHook; /** * hook used for execute original function */ executionHook?: ExecutionHook; } export declare abstract class CDSBaseServiceInstrumentation extends InstrumentationBase { private getCurrentSpan; /** * create a new context from current span, if no current span, use root context * * @returns */ protected createNewContext(): Context; /** * create sub span base current context * * @param newSpanName * @param options * @returns */ protected createSubSpan(newSpanName: string, options?: SpanOptions): Span; /** * create a simple measure module function * * @param moduleExport * @param moduleName * @param functionName */ protected _simpleMeasure(moduleExport: any, moduleName: string, functionName: string, hooks?: Hooks): void; protected _createSimplePatchFile(moduleName: string, functions: Array, moduleTransform?: ModuleTransform): InstrumentationNodeModuleFile; protected _createWrapForNormalFunction(spanName: string, original: (...args: Array) => void, options?: SpanOptions, hooks?: Hooks): (this: any) => any; protected _createWrapForCbFunction(spanName: string, original: (...args: Array) => void, options?: SpanOptions, hooks?: Hooks): (this: any) => any; }