Skip to main content
iii provides comprehensive observability through OpenTelemetry integration, metrics collection, distributed tracing, and structured logging.

Configuration

Configure observability in config.yaml:

OpenTelemetry Traces

Exporters

iii supports multiple trace exporters:

OTLP (Production)

Export traces to OpenTelemetry collectors (Jaeger, Grafana Tempo, etc.).
Collector setup (Docker Compose):

Memory (Development)

Store traces in-memory for API querying.
Query via REST API:

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:
Manual trace injection:

Trace API

List traces:
Filter options:
Get trace tree:

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.
Key metrics:
See src/modules/observability/metrics.rs:244 for full metric definitions.

Metrics API

List metrics:
Query options:

Worker Metrics

Workers automatically report resource metrics:
Query worker metrics:
Response includes 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:
Alert operators:
  • > (greater than)
  • >= (greater than or equal)
  • < (less than)
  • <= (less than or equal)
  • == (equal)
  • != (not equal)
Alert actions:

Advanced Sampling

Configure sampling strategies to reduce trace volume:
See src/modules/observability/config.rs:142 for sampling configuration.

Production Setup

Full Observability Stack

docker-compose.yml:
prometheus.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 traceparent and baggage headers
  • 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

Reduce label combinations or increase limit:

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