Configuration
Configure observability inconfig.yaml:
OpenTelemetry Traces
Exporters
iii supports multiple trace exporters:OTLP (Production)
Export traces to OpenTelemetry collectors (Jaeger, Grafana Tempo, etc.).Memory (Development)
Store traces in-memory for API querying.Both (Hybrid)
Export to OTLP and store in memory (enables trace-based triggers).Distributed Tracing
iii automatically propagates W3C trace context across function invocations. Trace context format:Trace API
List traces:Metrics
Metrics Exporters
Memory (Default)
Store metrics in-memory for API querying.OTLP (Production)
Export metrics to OpenTelemetry collectors.Prometheus Metrics
iii exposes Prometheus-compatible metrics on port 9464.src/modules/observability/metrics.rs:244 for full metric definitions.
Metrics API
List metrics:Worker Metrics
Workers automatically report resource metrics:latest_metrics for each worker.
Structured Logging
Log Levels
Configure via environment or YAML:Log Exporters
Memory
Store logs in-memory for querying.OTLP
Export logs to OpenTelemetry collectors.Logs API
List logs:Alerting
Configure metric-based alerts:>(greater than)>=(greater than or equal)<(less than)<=(less than or equal)==(equal)!=(not equal)
Advanced Sampling
Configure sampling strategies to reduce trace volume:src/modules/observability/config.rs:142 for sampling configuration.
Production Setup
Full Observability Stack
docker-compose.yml:Environment Variables
Override configuration via environment:Best Practices
Sampling Strategy
- Use lower sampling for high-traffic endpoints (health checks, static assets)
- Use 100% sampling for critical operations (auth, payments)
- Implement rate limiting to prevent trace storms
- Monitor sampling effectiveness in production
Metric Cardinality
- Limit unique label combinations to avoid cardinality explosion
- Use metric aggregation for high-cardinality data
- Set appropriate retention periods
- Monitor memory usage for in-memory storage
Trace Context Propagation
- Always propagate
traceparentandbaggageheaders - Use baggage for cross-cutting concerns (user_id, request_id)
- Avoid large baggage payloads (max ~8KB)
Performance
- Use OTLP exporter for production (lower overhead than memory)
- Batch metrics exports (default: 60s interval)
- Configure appropriate buffer sizes
- Monitor exporter queue depth
Security
- Use TLS for OTLP endpoints in production
- Sanitize sensitive data from traces/logs
- Implement access controls for observability APIs
- Rotate service credentials regularly
Troubleshooting
High Memory Usage
Missing Traces
- Check sampling ratio (may be too low)
- Verify OTLP endpoint connectivity
- Check for trace export errors in logs
Prometheus Scrape Failures
High Cardinality
References
- OpenTelemetry implementation:
src/modules/observability/otel.rs - Metrics implementation:
src/modules/observability/metrics.rs - Sampling strategies:
src/modules/observability/sampler.rs - Configuration:
src/modules/observability/config.rs