Skip to content

Monitoring

Terminal window
curl http://localhost:8080/health

Response: OK with HTTP 200.

Enable in config:

[features]
metrics = true

Scrape endpoint: GET /metrics

Key metrics:

  • rcommerce_http_requests_total — request count by method/path/status
  • rcommerce_http_request_duration_seconds — request latency histogram
  • rcommerce_db_pool_connections — database connection pool stats
  • rcommerce_cache_hits_total / rcommerce_cache_misses_total — cache hit rate

Set log level:

Terminal window
RUST_LOG=info # default
RUST_LOG=debug # verbose
RUST_LOG=rcommerce_api=debug,sqlx=warn # targeted

rCommerce supports OpenTelemetry traces. Configure in your OTLP collector:

[features]
otel_endpoint = "http://otel-collector:4317"
-- Active connections
SELECT count(*) FROM pg_stat_activity WHERE datname = 'rcommerce';
-- Slow queries
SELECT query, mean_exec_time, calls
FROM pg_stat_statements
WHERE mean_exec_time > 100
ORDER BY mean_exec_time DESC
LIMIT 10;
-- Table sizes
SELECT relname, pg_size_pretty(pg_total_relation_size(relid))
FROM pg_catalog.pg_statio_user_tables
ORDER BY pg_total_relation_size(relid) DESC;