Prometheus 3 range offset is keyed on the buildinfo version, so Grafana Cloud / Mimir backends lose the first step of every query window
Describe the bug
OpenCost decides whether to compensate for Prometheus 3's left-open range selectors by parsing the version string from /api/v1/status/buildinfo as semver. Grafana Cloud (Mimir) returns a version string that is not semver(based on Mimir's weekly release), so the compensation is disabled.
To Reproduce
Confirmed live against Grafana Cloud, and against Prometheus 3.11.3 for the control:
- Point OpenCost 1.120.0 at a Grafana Cloud hosted Prometheus endpoint.
- Check the version string OpenCost is trying to parse:
curl -u <instance-id>:<token> \
https://<stack>.grafana.net/api/prom/api/v1/status/buildinfo Returns "version":"r409-4d1cd395".
3. Confirm the backend actually uses left-open ranges. At a minute-aligned timestamp:
curl -u <instance-id>:<token> \
'https://<stack>.grafana.net/api/prom/api/v1/query?query=count_over_time(vector(1)[1m:1m])&time=<unix time on a minute boundary>' Returns 1 on Grafana Cloud and on Prometheus 3.11.3; returns 2 on Prometheus 2.x.
4. OpenCost logs Failed to parse prometheus version r409-4d1cd395 at startup and leaves the offset off.
Expected behavior
The resolution offset should be applied whenever the backend evaluates range selectors as left-open, regardless of whether its version string happens to parse as semver.
Which version of OpenCost are you using?
OpenCost 1.120.0, Helm chart 2.5.14
Source: opencost/opencost