diff --git a/src/components/prometheus/queries.ts b/src/components/prometheus/queries.ts index 557b2b81..108e7adb 100644 --- a/src/components/prometheus/queries.ts +++ b/src/components/prometheus/queries.ts @@ -1,4 +1,13 @@ -export type TimeRange = '30s' | '2m' | '5m' | '1h' | '1d'; +type TimeUnit = 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'y'; +type UnitDuration = `${bigint}${TimeUnit}`; +/** + * PromQL time duration format. Supports floats in seconds (e.g. '90', '1.5'), + * unit suffixes (e.g. '30s', '5m', '1h'), and combined durations (e.g. '1h30m'). + */ +export type TimeRange = + | `${number}` + | UnitDuration + | `${UnitDuration}${UnitDuration}`; const metricName = 'http_server_duration_milliseconds'; const countPostfix = 'count';