Back to Nocobase

Telemetry

docs/docs/en/api/telemetry/telemetry.md

2.1.142.1 KB
Original Source

Telemetry

Overview

Telemetry is the telemetry module of NocoBase, encapsulating OpenTelemetry support for registering metrics and traces within the OpenTelemetry ecosystem.

Class Methods

constructor()

Constructor to create a Telemetry instance.

Signature

  • constructor(options?: TelemetryOptions)

Type

ts
export interface TelemetryOptions {
  serviceName?: string;
  version?: string;
  trace?: TraceOptions;
  metric?: MetricOptions;
}

Details

PropertyTypeDescriptionDefault Value
serviceNamestringOptional. Refer to Semantic Conventionsnocobase
versionstringOptional. Refer to Semantic ConventionsOptional, current NocoBase version
traceTraceOptionsOptional. Refer to Trace-
metricMetricOptionsOptional. Refer to Metric-

init()

Registers instrumentation and initializes Trace and Metric.

Signature

  • init(): void

start()

Starts the processing of Trace and Metric related data, such as exporting to Prometheus.

Signature

  • start(): void

shutdown()

Stops the processing of Trace and Metric related data.

Signature

  • shutdown(): Promise<void>

addInstrumentation()

Adds instrumentation libraries.

Signature

  • addInstrumentation(...instrumentation: InstrumentationOption[])