@itwin/core-backend
Version:
iTwin.js backend components
29 lines • 1.42 kB
TypeScript
/** @packageDocumentation
* @module RpcInterface
*/
import { RpcActivity } from "@itwin/core-common";
/**
* Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
* class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
* of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
* from the RpcActivity.
* @public
*/
export declare class RpcTrace {
private static _storage;
/** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
* RpcActivity in the current call stack.
* */
static get currentActivity(): RpcActivity | undefined;
/** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
* exists in the current call stack.
* */
static get expectCurrentActivity(): RpcActivity;
/** Start the processing of an RpcActivity. */
static run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
/** Start the processing of an RpcActivity inside an OpenTelemetry span */
static runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
}
/** @internal */
export declare function initializeTracing(enableOpenTelemetry?: boolean): void;
//# sourceMappingURL=tracing.d.ts.map