Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 'pull' and 'get' of AlertRuleGroup with year as duration fails #569

Open
mikaello opened this issue Jan 22, 2025 · 2 comments
Open

Comments

@mikaello
Copy link
Contributor

mikaello commented Jan 22, 2025

Grizzly Version

v0.7.1

Expected Behavior

In Grafana, it is possible (while not documented) to specify 1y (or 5y or any other number) as evaluation interval (for an alert group) and pending period for in Foundation SDK (for a rule). This is accepted by Grafana, and I guess it is also working as expected.

I expect that resources that all resources allowed to create in Grafana GUI is possible to retrieve with grr get and grr pull.

Actual Behavior

When retrieving such resources (AlertRuleGroup with 1y specified as pending period (for in Foundation SDK) ) with grr get or grr pull it fails:

$ grr get AlertRuleGroup.de7o13hjd3abke.delete-this-group
INFO Getting AlertRuleGroup.de7o13hjd3abke.example-group
FATAL unable to parse 1y as duration

This is especially troublesome when using grr pull, because it does not tell which AlertRuleGroup that failed, so in a large instance you just get this even with debug log mode and have to manually go through all alert groups:

$ grr pull -l DEBUG -t AlertRuleGroup test-folder
INFO Pulling resources to test-folder
Datasource skipped
DashboardFolder skipped
AlertNotificationPolicy skipped
SyntheticMonitoringCheck skipped
PrometheusRuleGroup skipped
LibraryElement skipped
Dashboard skipped
DEBUG Listing remote values for handler AlertRuleGroup
AlertRuleGroup failed: failed listing remote values: unable to parse 1y as duration
1 resource failed
DEBUG Silent error: 1 error occurred:
        * unable to parse 1y as duration

Steps to Reproduce

Create and alert rule group with 1y pending period:

Image

@mikaello mikaello added the bug label Jan 22, 2025
@mikaello
Copy link
Contributor Author

mikaello commented Jan 27, 2025

Verified now that this bug is also present in Grizzly v0.7.1.

(and for completeness sake, I have tested Grafana 10 and 11)

@K-Phoen
Copy link
Member

K-Phoen commented Jan 28, 2025

Notes from my initial investigation of this issue:

  • Grizzly relies on grafana-openapi-client-go to fetch the alerts from the API
  • grafana-openapi-client-go uses time.ParseDuration (or a similar function coming from go-openapi/strfmt)
  • in both cases, year isn't supported as a unit

@Duologic Duologic removed the bug label Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants