Observability
Duration Converter
Convert between Go, Prometheus, ISO 8601 and plain seconds, and see which dialects will reject a value.
Input
Whole numbers only, units descending, ms through y.
1 hour and 30 minutes
Where this dialect is used
PromQL range selectors, scrape_interval, an alert's for clause, retention
Accepted by
- Prometheus: accepted
- Go: accepted
- ISO 8601: rejected
Not an ISO 8601 duration. It must start with P, as in "PT5M" or "P1DT2H".
- Seconds: rejected
Expected a plain number of seconds.
Examples
- PromQL rate() window
- Prometheus scrape_interval
- Alert rule `for` clause
- Retention, or a long range selector
- A mixed-unit Prometheus range
- A Go HTTP client timeout
- Fractional — valid Go, rejected by Prometheus
- time.Duration.String output
- A Java or .NET configuration value
- ISO 8601 with a date and time part
- A JSON API expiry in seconds
Converted
- Prometheus
1h30m- Go
1h30m0s- ISO 8601
PT1H30M- Seconds
5400- Milliseconds
5400000
As model.Duration prints it
As time.Duration.String prints it
- InfoThis value is valid in 2 of the four dialects: prometheus, go.