Trace

Class Methods

constructor()

Constructor to create a Trace instance.

Signature

  • constructor(options?: TraceOptions)

Type

export type TraceOptions = {
  tracerName?: string;
  version?: string;
  processorName?: string | string[];
};

Details

PropertyTypeDescriptionDefault Value
tracerNamestringTrace identifiernocobase-trace
versionstringCurrent version of NocoBase
processorNamestring | string[]Identifier(s) of registered SpanProcessor to use-

init()

Initializes NodeTracerProvider.

Signature

  • init(): void

registerProcessor()

Registers a SpanProcessor.

Signature

  • registerProcessor(name: string, processor: GetSpanProcessor)

Type

import { SpanProcessor } from '@opentelemetry/sdk-trace-base';

type GetSpanProcessor = () => SpanProcessor;

Details

ParameterTypeDescription
namestringUnique identifier for SpanProcessor
processor() => SpanProcessorFunction to get SpanProcessor

getTracer()

Gets the Tracer.

Signature

  • getTracer(name?: string, version?: string)

Details

ParameterTypeDescriptionDefault Value
namestringTrace identifiernocobase-trace
versionstringCurrent version of NocoBase

start()

Starts the SpanProcessor.

Signature

  • start(): void

shutdown()

Stops the SpanProcessor.

Signature

  • shutdown(): Promise<void>