Iii iii-observability
git clone https://github.com/iii-hq/iii
T=$(mktemp -d) && git clone --depth=1 https://github.com/iii-hq/iii "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/iii-observability" ~/.claude/skills/iii-hq-iii-iii-observability && rm -rf "$T"
skills/iii-observability/SKILL.mdObservability
Comparable to: Datadog, Grafana, Honeycomb, Jaeger
Key Concepts
Use the concepts below when they fit the task. Not every worker needs custom spans or metrics.
- Built-in OpenTelemetry support across all SDKs — every function invocation is automatically traced
- The engine exports traces, metrics, and logs via OTLP to any compatible collector
- Workers propagate W3C trace context automatically across function invocations
- Prometheus metrics are exposed on port 9464
withregisterWorker()
config enables telemetry per workerotel- Custom spans via
wrap async work with trace contextwithSpan(name, opts, fn) - Custom metrics via
create counters and histogramsgetMeter()
Architecture
The worker SDK generates spans, metrics, and logs during function execution. These flow to the engine, which exports them via OTLP to a collector (Jaeger, Grafana, Datadog). The engine also exposes a Prometheus endpoint on port 9464 for scraping.
iii Primitives Used
| Primitive | Purpose |
|---|---|
| Connect worker with telemetry config |
| Create a custom trace span |
| Access OpenTelemetry Tracer directly |
| Access OpenTelemetry Meter for custom metrics |
| Get active trace ID for correlation |
| Inject W3C trace context into outbound calls |
| Subscribe to log events |
| Graceful shutdown of telemetry pipeline |
Reference Implementation
See ../references/observability.js for the full working example — a worker with custom spans,
Also available in Python: ../references/observability.py
Also available in Rust: ../references/observability.rs metrics counters, trace propagation, and log subscriptions connected to an OTel collector.
Common Patterns
Code using this pattern commonly includes, when relevant:
— enable telemetryregisterWorker('ws://localhost:49134', { otel: { enabled: true, serviceName: 'my-svc' } })
— custom spanwithSpan('validate-order', {}, async (span) => { span.setAttribute('order.id', id); ... })
— custom counter metricgetMeter().createCounter('orders.processed')
— custom histogram metricgetMeter().createHistogram('request.duration')
— subscribe to warnings and aboveonLog((log) => { ... }, { level: 'warn' })
— get active trace ID for correlation with external systemscurrentTraceId()
— propagate trace context to outbound HTTP callsinjectTraceparent()- Disable telemetry:
orregisterWorker(url, { otel: { enabled: false } })OTEL_ENABLED=false
Adapting This Pattern
Use the adaptations below when they apply to the task.
- Enable
inotel
config to start collecting traces automaticallyregisterWorker() - Add custom spans around expensive operations (DB queries, LLM calls, external APIs)
- Create domain-specific metrics (orders processed, payment failures, queue depth)
- Use
to correlate iii traces with external system logscurrentTraceId() - Configure
in iii-config.yaml for engine-side exporter, sampling ratio, and alertsiii-observability - Point the OTLP endpoint at your collector (Jaeger, Grafana Tempo, Datadog Agent)
Engine Configuration
iii-observability must be enabled in iii-config.yaml for engine-side traces, metrics, and logs. See ../references/iii-config.yaml for the full annotated config reference.
Pattern Boundaries
- For engine-side iii-observability YAML configuration, prefer
.iii-engine-config - For SDK init options and function registration, prefer
.iii-functions-and-triggers - Stay with
when the primary problem is SDK-level telemetry: spans, metrics, logs, and trace propagation.iii-observability
When to Use
- Use this skill when the task is primarily about
in the iii engine.iii-observability - Triggers when the request directly asks for this pattern or an equivalent implementation.
Boundaries
- Never use this skill as a generic fallback for unrelated tasks.
- You must not apply this skill when a more specific iii skill is a better fit.
- Always verify environment and safety constraints before applying examples from this skill.