Skip to main content
hitspec exposes a Prometheus-compatible metrics endpoint during stress tests, allowing you to scrape metrics into Prometheus and visualize them in Grafana.

Setup

hitspec run api.http --stress -d 5m -r 100 \
  --metrics prometheus \
  --metrics-port 9090
Metrics are available at http://localhost:9090/metrics while the stress test runs.

Prometheus Configuration

Add hitspec as a scrape target in your prometheus.yml:
scrape_configs:
  - job_name: 'hitspec'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']

Available Metrics

MetricTypeDescription
hitspec_requests_totalCounterTotal number of requests
hitspec_requests_successCounterSuccessful requests
hitspec_requests_failedCounterFailed requests
hitspec_request_duration_msHistogramRequest duration in milliseconds
hitspec_request_duration_p50Gauge50th percentile latency
hitspec_request_duration_p95Gauge95th percentile latency
hitspec_request_duration_p99Gauge99th percentile latency

Custom Port

hitspec run api.http --stress -d 5m -r 100 \
  --metrics prometheus \
  --metrics-port 9100
Environment variable: HITSPEC_METRICS_PORT