http
Reference for the `http` collector.
http· collector · runnanook doc httpfor the same content in your terminal.
Performs an HTTP request and reports status, response code, and latency.
Options
| Option | Type | Default | Description |
|---|---|---|---|
url | string | required 🔒 | target URL |
timeout | string | 5s | request timeout (e.g. 5s, 30s) |
success | expr | http.code between [200, 299] | nanook-expr predicate over http.code and http.latency [nanook-expr] |
Metrics
| Metric | Kind | Unit | Description |
|---|---|---|---|
http.status | bool | — | true if the request succeeded. Labels: url. |
http.code | numeric | — | HTTP response code. Labels: url. |
http.latency | numeric | seconds | request latency in seconds. Labels: url. |
Examples
Health probe
[[]]
= "api"
= "http"
= 30
[]
= "https://api.example.com/health"
= 3000
Custom success predicate
[[]]
= "homepage"
= "http"
= 60
[]
= "https://example.com"
= "http.code between [200, 399]"
Slow endpoint
[[]]
= "api::http.latency > 1s"
= 3
= "ops"
Endpoint down
[[]]
= 'api::http.status is "false"'
= 2
= "ops"
= { = 300, = "oncall" }