-
Notifications
You must be signed in to change notification settings - Fork 258
Closed
Description
Describe the bug
When running krr simple with --history-duration set to a value less than 24 hours (e.g., 1), the tool fails with a Prometheus API error and does not generate recommendations. It appears that durations under 24 hours are being rounded to 0 days, leading to an invalid PromQL query.
To Reproduce
Steps to reproduce the behavior:
- Deploy Prometheus and run a workload in a namespace (e.g.,
default) - Run:
krr simple --namespace=default --history-duration=1 --prometheus-url=<your_prom_url>
- Observe the error:
prometheus_api_client.exceptions.PrometheusApiClientException: HTTP Status Code 400
(b'{"status":"error","errorType":"bad_data","error":"invalid parameter \\"query\\": 8:27: parse error: duration must be greater than
0"}')
Expected behavior
krr should correctly interpret history durations shorter than 24 hours (e.g., 1, 6) and form valid Prometheus queries.
Screenshots
N/A
Are you interested in contributing a fix for this?
Maybe
Desktop (please complete the following information):
- Prometheus version: 2.26.0
- prometheus-community/prometheus helm chart version (14.6.0)
- Version:
krr v1.24.0
Smartphone (please complete the following information):
- Device: N/A
- OS: N/A
- Browser: N/A
- Version: N/A
Additional context
- Using
--history-duration=24works fine.
Let me know if more logs or testing are needed.
Metadata
Metadata
Assignees
Labels
No labels