Tracing Class

Deprecated  in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use @opentelemetry/api directly.

Enables OpenTelemetry tracing in addition to traditional logging.

Methods

Name Description
constructor(): Tracing    
enableOpenTelemetry(tracer: Tracer, api: undefined | { context: Pick<ContextAPI, "active" | "with">, trace: Pick<TraceAPI, "setSpan" | "setSpanContext" | "getSpan"> }): void Static Enable logging to OpenTelemetry.  
setAttributes(attributes: SpanAttributes): void Static Set attributes on currently active openTelemetry span.  
withSpan<T>(name: string, fn: () => Promise<T>, options?: SpanOptions, parentContext?: SpanContext): Promise<T> Static If OpenTelemetry tracing is enabled, creates a new span and runs the provided function in it.  

Defined in

Last Updated: 20 April, 2024