@temporalio/interceptors-opentelemetry
Version:
Temporal.io SDK interceptors bundle for tracing with opentelemetry
32 lines (31 loc) • 1.35 kB
TypeScript
import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
import { Resource } from '@opentelemetry/resources';
import { SimplePlugin } from '@temporalio/plugin';
import { ReplayWorkerOptions, WorkerOptions } from '@temporalio/worker';
import { InterceptorOptions } from './client';
/**
* Configuration options for {@link OpenTelemetryPlugin}.
*
* @experimental Plugins is an experimental feature; APIs may change without notice.
*/
export interface OpenTelemetryPluginOptions extends InterceptorOptions {
/** OpenTelemetry resource attributes to attach to exported spans */
readonly resource: Resource;
/** Exporter used to send spans to a tracing backend */
readonly spanProcessor: SpanProcessor;
}
/**
* A plugin that adds OpenTelemetry tracing.
*
* Configures Client, Activity, and Workflow interceptors for trace propagation and injects
* a span exporter sink for Workflow spans.
*
* @experimental Plugins is an experimental feature; APIs may change without notice.
*/
export declare class OpenTelemetryPlugin extends SimplePlugin {
readonly otelOptions: OpenTelemetryPluginOptions;
constructor(otelOptions: OpenTelemetryPluginOptions);
configureWorker(options: WorkerOptions): WorkerOptions;
configureReplayWorker(options: ReplayWorkerOptions): ReplayWorkerOptions;
private injectSinks;
}