انتقل إلى المحتوى الرئيسي

Function: startTelemetry()

startTelemetry(options): Promise<TelemetryHandle>

Defined in: packages/telemetry/src/start.ts:62

Starts OpenTelemetry for this process, or does nothing.

Off by default: with no OKTOID_TELEMETRY_ENDPOINT (and no injected exporter) this loads no SDK, registers nothing, and the API stays the no-op it is, so a service starts the same with no collector. A configured collector that is down costs dropped spans, never a failed request: export is asynchronous and its errors are swallowed by the SDK.

Call it before anything that is instrumented is imported: the apps do so from a telemetry.ts that main.ts imports first, because http, pg and fastify are patched when they are first loaded.

What is on a span is decided by AllowlistSpanProcessor, which runs before the exporter. Only W3C traceparent and tracestate propagate; baggage is not propagated, so nothing rides along between services.

Parameters​

options​

TelemetryOptions

Returns​

Promise<TelemetryHandle>

The handle.

Throws​

A setting is present and invalid.