UNPKG

@biorate/axios-prometheus

Version:

Axios-prometheus HTTP interface

30 lines (29 loc) 1.7 kB
import { IConfig } from '@biorate/config'; import { Axios, AxiosError, AxiosResponse, IAxiosFetchOptions } from '@biorate/axios'; import { Counter, Histogram } from '@biorate/prometheus'; import { Span } from '@biorate/opentelemetry'; export * from '@biorate/axios'; export declare abstract class AxiosPrometheus extends Axios { #private; protected static mockFields: string[]; protected static mockFileName(name: string): string; protected static checkMockDir(directory: string): string | null; protected static mockFilePath(filename?: string): string; protected static getMockData(instance: Axios, filename: string): any; protected static getMock<T = any, D = any>(instance: Axios, options?: IAxiosFetchOptions): undefined | AxiosResponse<T, D>; protected static setMock<T = any, D = any>(instance: Axios, result: AxiosResponse<T, D>, options?: IAxiosFetchOptions): void; protected get histogram(): Histogram<string>; protected get config(): IConfig; protected counter: Counter; abstract baseURL: string; abstract url: string; abstract method: string; protected getStartTime(): [number, number]; protected log(statusCode: number, startTime: [number, number]): void; protected stringify(data: unknown): string; protected needTrace(url: string, span?: Span): boolean; protected fullUrl(params?: IAxiosFetchOptions): string; protected before(params?: IAxiosFetchOptions): Promise<void>; protected after(result: AxiosResponse, startTime: [number, number], params: IAxiosFetchOptions): Promise<void>; protected catch(e: Error | AxiosError, startTime: [number, number], params: IAxiosFetchOptions): Promise<void>; }