Skip to main content

Interface: ITelemetry

Interface: ITelemetry

Plugin-facing interface for OpenTelemetry instrumentation. Provides a thin abstraction over OpenTelemetry APIs for plugins.

Methods

emit()

emit(logRecord: LogRecord): void;

Emits a log record using the default logger. Respects the logs enabled/disabled config.

Parameters

ParameterTypeDescription
logRecordLogRecordThe log record to emit

Returns

void


getLogger()

getLogger(options?: InstrumentConfig): Logger;

Gets a logger for emitting log records.

Parameters

ParameterTypeDescription
options?InstrumentConfigInstrument customization options.

Returns

Logger


getMeter()

getMeter(options?: InstrumentConfig): Meter;

Gets a meter for recording metrics.

Parameters

ParameterTypeDescription
options?InstrumentConfigInstrument customization options.

Returns

Meter


getTracer()

getTracer(options?: InstrumentConfig): Tracer;

Gets a tracer for creating spans.

Parameters

ParameterTypeDescription
options?InstrumentConfigInstrument customization options.

Returns

Tracer


registerInstrumentations()

registerInstrumentations(instrumentations: Instrumentation<InstrumentationConfig>[]): void;

Register OpenTelemetry instrumentations. Can be called at any time, but recommended to call in plugin constructor.

Parameters

ParameterTypeDescription
instrumentationsInstrumentation<InstrumentationConfig>[]Array of OpenTelemetry instrumentations to register

Returns

void


startActiveSpan()

startActiveSpan<T>(
   name: string, 
   options: SpanOptions, 
   fn: (span: Span) => Promise<T>, 
tracerOptions?: InstrumentConfig): Promise<T>;

Starts an active span and executes a callback function within its context. Respects the traces enabled/disabled config. When traces are disabled, executes the callback with a no-op span.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
namestringThe name of the span
optionsSpanOptionsSpan options including attributes, kind, etc.
fn(span: Span) => Promise<T>Callback function to execute within the span context
tracerOptions?InstrumentConfigOptional tracer configuration (custom name, prefix inclusion)

Returns

Promise<T>

Promise resolving to the callback's return value

Databricks Developer Hub

Ready to ship your next agentic app in minutes?

Read docs