UNPKG

javascript-typescript-langserver

Version:

Implementation of the Language Server Protocol for JavaScript and TypeScript

33 lines (32 loc) 1.55 kB
import { Span } from 'opentracing'; import { Observable } from 'rxjs'; /** * Traces a synchronous function by passing it a new child span. * The span is finished when the function returns. * If the function throws an Error, it is logged and the `error` tag set. * * @param operationName The operation name for the new span * @param childOf The parent span * @param operation The function to call */ export declare function traceSync<T>(operationName: string, childOf: Span, operation: (span: Span) => T): T; /** * Traces a Promise-returning (or async) function by passing it a new child span. * The span is finished when the Promise is resolved. * If the Promise is rejected, the Error is logged and the `error` tag set. * * @param operationName The operation name for the new span * @param childOf The parent span * @param operation The function to call */ export declare function tracePromise<T>(operationName: string, childOf: Span, operation: (span: Span) => Promise<T>): Promise<T>; /** * Traces an Observable-returning function by passing it a new child span. * The span is finished when the Observable completes or is unsubscribed from. * If the Observable errors or the function throws an Error, the Error is logged and the `error` tag set. * * @param operationName The operation name for the new span * @param childOf The parent span * @param operation The function to call */ export declare function traceObservable<T>(operationName: string, childOf: Span, operation: (span: Span) => Observable<T>): Observable<T>;