nestjs-otel
Version:
NestJS OpenTelemetry Library
15 lines (14 loc) • 880 B
TypeScript
import { type SpanOptions } from "@opentelemetry/api";
export interface ExtendedSpanOptions extends SpanOptions {
/**
* Callback to run when the method returns successfully.
* Allows setting attributes based on the return value.
*/
onResult?: (result: any) => {
attributes?: SpanOptions["attributes"];
} | undefined;
}
type SpanDecoratorOptions<T extends any[]> = ExtendedSpanOptions | ((...args: T) => ExtendedSpanOptions);
export declare function Span<T extends any[]>(options?: SpanDecoratorOptions<T>): (target: any, propertyKey: PropertyKey, propertyDescriptor: TypedPropertyDescriptor<(...args: T) => any>) => void;
export declare function Span<T extends any[]>(name?: string, options?: SpanDecoratorOptions<T>): (target: any, propertyKey: PropertyKey, propertyDescriptor: TypedPropertyDescriptor<(...args: T) => any>) => void;
export {};