Observability

What you'll accomplish: Configure logging, Prometheus metrics, and OpenTelemetry tracing for your Hoziron deployment.

Logging

Text format (development)

HOZIRON_LOG=info hoziron start

JSON format (production)

Recommended for container log collectors (Fluentd, Loki, CloudWatch):

HOZIRON_LOG_FORMAT=json HOZIRON_LOG=info,hoziron_core=debug hoziron start

Or via config:

[logging]
format = "json"

Fine-grained filtering

The HOZIRON_LOG variable supports tracing-subscriber directives:

# Debug health monitoring, warn-only for the API layer
HOZIRON_LOG="info,hoziron_core::health=debug,hoziron_api=warn"

Prometheus metrics

Metrics are served at GET /metrics in Prometheus exposition format on the same port as the API (4200). No sidecar or separate metrics port needed.

curl http://localhost:4200/metrics

Scrape config

scrape_configs:
  - job_name: hoziron
    static_configs:
      - targets: ['hoziron:4200']
    metrics_path: /metrics

In Kubernetes, the Helm chart includes a ServiceMonitor template for Prometheus Operator.

Key metrics

The platform exposes metrics for:

  • Request latency and throughput
  • Agent execution duration
  • Provider health and circuit breaker state
  • Memory subsystem status

OpenTelemetry (optional)

OpenTelemetry support is a build-time feature flag (zero overhead when disabled):

cargo build --release --bin hoziron --features telemetry

Configuration

Via config.toml:

[telemetry]
enabled = true
endpoint = "http://otel-collector:4317"
service_name = "hoziron"

Or via environment:

OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317

Docker with telemetry

The default Docker image does not include OpenTelemetry (zero overhead). Build a custom image with the feature enabled:

RUN cargo build --release --bin hoziron --features telemetry

Then at runtime:

docker run \
  -e OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 \
  hoziron:local-telemetry

Environment variables summary

VariablePurposeDefault
HOZIRON_LOGLog filter directivesinfo
HOZIRON_LOG_FORMATLog output format (json or text)text
OTEL_EXPORTER_OTLP_ENDPOINTOTel collector endpoint— (disabled)

Health endpoints

EndpointPurposeAccess
GET /healthStructured health reportAlways accessible (bypasses IP allowlist)
GET /metricsPrometheus exposition formatAlways accessible

Next steps


Related: