Skip to main content
The iii SDK ships with built-in OpenTelemetry (OTel) support across all three SDKs (Node.js, Python, Rust). Every function invocation is automatically traced, worker metrics are collected, and structured logs are forwarded to the engine — all using the standard OTLP protocol.

Data Flow

Auto-Instrumentation

All three SDKs initialize OpenTelemetry automatically when you call registerWorker() / register_worker() with an otel config. A manual init_otel() is also available but is not required for typical usage.
To disable auto-instrumentation in the Node.js SDK, set the environment variable OTEL_ENABLED=false or pass the option directly:

Configuration

Traces

Every function invocation creates a span automatically. Cross-worker calls propagate trace context via traceparent and baggage headers, so a single request that fans out across multiple workers appears as a unified trace.

Custom Spans

Use withSpan to create custom spans within a function handler:

Metrics

Worker metrics (CPU, memory, event loop latency) are reported via WorkerMetricsCollector. Metrics reporting is enabled by default through the enableMetricsReporting: true option.
The following worker metrics are collected automatically via observable gauges:
Invocation metrics (iii.invocations.total, iii.invocation.duration, iii.invocation.errors.total) are collected by the iii Engine, not by the worker SDKs. They are available regardless of which SDK language you use.

Logs

Subscribe to OpenTelemetry log events from the engine using onLog(). Logs include severity level, body text, and resource attributes.

Telemetry Utilities

The iii-sdk/telemetry subpath (Node.js) and iii.telemetry module (Python) export the following utilities:

Python imports

Always call shutdown_otel() / shutdownOtel() (or iii.shutdown()) before your process exits to ensure all buffered spans, metrics, and logs are flushed. The Python SDK also provides shutdown_otel_async() for use within async contexts.

Cross-SDK Comparison

Environment Variables

Configure OpenTelemetry without code changes using standard OTel environment variables:
Programmatic configuration passed to registerWorker() / register_worker() via OtelConfig takes precedence over environment variables. Environment variables take precedence over defaults.
The Python SDK sends telemetry directly to the iii Engine over WebSocket using engine_ws_url (or III_URL), not to a standalone OTLP collector endpoint. The OTEL_EXPORTER_OTLP_ENDPOINT variable has no effect in the Python SDK.

Next Steps

Deployment

Production deployment with observability infrastructure