@ogcio/o11y-sdk-node
Version:
Opentelemetry standard instrumentation SDK for NodeJS based project
12 lines (11 loc) • 586 B
TypeScript
import { type Span } from "@opentelemetry/api";
/**
* Generates a function wrapping a given Callable `fn` into an error handling block.
* Setting Span status and recording any caught exception before bubbling it up.
*
* Marks the span as ended once the provided callable has ended or an error has been caught.
*
* @returns {Promise<T>} where T is the type returned by the Callable.
* @throws any error thrown by the original Callable `fn` provided.
*/
export declare function selfContainedSpanHandlerGenerator<T>(fn: (span: Span) => T | Promise<T>): (span: Span) => Promise<T>;