Yes, see
quantile_over_time().
Here are some example recording rules, to calculate this continuously:
groups:
- name: bandwidth_percentiles_daily
interval: 5m
rules:
- record: interface:in_octets:rate5m_95th_24h
expr: quantile_over_time(0.95, rate(ifHCInOctets{instance="XXXX",ifName="YYYY"}[10m])[24h:5m])
- record: interface:out_octets:rate5m_95th_24h
expr: quantile_over_time(0.95, rate(ifHCOutOctets{instance="XXXX",ifName="YYYY"}[10m])[24h:5m])
- name: bandwidth_percentiles_monthly
interval: 1h
rules:
- record: interface:in_octets:rate5m_95th_30d
expr: quantile_over_time(0.95, rate(ifHCInOctets{instance="XXXX",ifName="YYYY"}[10m])[30d:5m])
- record: interface:out_octets:rate5m_95th_30d
expr: quantile_over_time(0.95, rate(ifHCOutOctets{instance="XXXX",ifName="YYYY"}[10m])[30d:5m])
Each metric gives the 95th-percentile of the rate taken at 5 minute intervals, over the preceding 24 hours or 30 days respectively.
You can of course use these expressions directly in the PromQL browser for ad-hoc queries. You should be able to use the new modifier "
@time" to perform the query at a given instant in time, so will calculate over the 24 hours or 30 days before that time.