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.OTEL_ENABLED=false or pass the option directly:
Configuration
- Node / TypeScript
- Python
- Rust
Traces
Every function invocation creates a span automatically. Cross-worker calls propagate trace context viatraceparent and baggage headers, so a single request that fans out across multiple workers appears as a unified trace.
Custom Spans
UsewithSpan to create custom spans within a function handler:
- Node / TypeScript
- Python
- Rust
Metrics
Worker metrics (CPU, memory, event loop latency) are reported viaWorkerMetricsCollector. Metrics reporting is enabled by default through the enableMetricsReporting: true option.
- Node / TypeScript
- Python
- Rust
| Metric | Type | SDKs | Description |
|---|---|---|---|
iii.worker.cpu.percent | Observable Gauge | Node.js, Python | Worker CPU utilization percentage |
iii.worker.cpu.user_micros | Observable Gauge | Node.js, Python | CPU user time in microseconds |
iii.worker.cpu.system_micros | Observable Gauge | Node.js, Python | CPU system time in microseconds |
iii.worker.memory.rss | Observable Gauge | Node.js, Python | Resident set size in bytes |
iii.worker.memory.vms | Observable Gauge | Python only | Virtual memory size in bytes |
iii.worker.memory.heap_used | Observable Gauge | Node.js, Python | Heap memory used in bytes |
iii.worker.memory.heap_total | Observable Gauge | Node.js, Python | Total heap memory in bytes |
iii.worker.memory.external | Observable Gauge | Node.js, Python | External memory in bytes (always 0 in Python) |
iii.worker.uptime_seconds | Observable Gauge | Node.js, Python | Worker uptime in seconds |
iii.worker.event_loop.lag_ms | Observable Gauge | Node.js only | Event loop lag in milliseconds |
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 usingonLog(). Logs include severity level, body text, and resource attributes.
- Node / TypeScript
- Python
- Rust
Telemetry Utilities
Theiii-sdk/telemetry subpath (Node.js) and iii.telemetry module (Python) export the following utilities:
| Node.js (camelCase) | Python (snake_case) | Description |
|---|---|---|
getTracer() | get_tracer() | Returns the OTel Tracer instance for creating custom spans |
getMeter() | get_meter() | Returns the OTel Meter instance for creating custom metrics |
getLogger() | get_logger() | Returns the OTel Logger instance for structured log emission |
withSpan(name, opts, fn) | await with_span(name, fn) | Wraps an async function in a custom span |
currentTraceId() | current_trace_id() | Returns the active trace ID for log correlation |
currentSpanId() | current_span_id() | Returns the active span ID for log correlation |
initOtel(config) | init_otel(config) | Manually initialize OTel (Python and Rust) |
shutdownOtel() | shutdown_otel() | Flush pending telemetry and shut down the OTel SDK |
Python imports
Cross-SDK Comparison
| Feature | Node.js | Python | Rust |
|---|---|---|---|
| Auto-init | Yes (on registerWorker()) | Yes (on register_worker()) | Manual (init_otel()) |
| Trace propagation | Automatic | Automatic | Automatic |
| Worker metrics | Built-in | Built-in | Built-in |
| Log emission | OTel Logger via getLogger() | OTel Logger via get_logger() | OTel Logger |
Environment Variables
Configure OpenTelemetry without code changes using standard OTel environment variables:| Variable | Default | SDKs | Description |
|---|---|---|---|
OTEL_ENABLED | true | Node.js, Python | Enable or disable OpenTelemetry (Python accepts false, 0, no, off) |
OTEL_SERVICE_NAME | Worker name | Node.js, Python | Override the service name reported to the collector |
III_URL | ws://localhost:49134 | Python | III Engine WebSocket URL for the span/log/metrics exporter |
Programmatic configuration passed to
registerWorker() / register_worker() via OtelConfig takes precedence over environment variables. Environment variables take precedence over defaults.Next Steps
Deployment
Production deployment with observability infrastructure