aws-observability / amazon-managed-grafana-migrator

CLI migration utility to migrate Grafana content to Amazon Managed Grafana
Apache License 2.0
25 stars 7 forks source link

[Bug]: migrating from 8.4 Grafana workspace shows confusing error message for alerts #10

Closed lpmi-13 closed 7 months ago

lpmi-13 commented 1 year ago

Did you search for similar issues before submitting?

Release version

0.1.3 (though this was downloaded via the 0.1.4 release tag)

Is it a permission issue?

What is your environment, configuration and the example used?

$ go version
go version go1.19.4 darwin/arm64

and this is at the end of the output from the migrate command

Migrating alerting rules:

Removing temporary API key for g-6b10aaa20e

Removing temporary API key for g-909b33678e
error: alerting API version not supported for src, minimum supported is v8.4

Additional Information

the source workspace is on version 8.4, and the destination is on version 9.4.

I expected it to fail on alerts migration, due to the requirement that the alerts migration is only supported for version 9.4, which is why I was confused by the output stating "minimum supported is v8.4", since if that's true, then I wouldn't expect to see this error message.
bonclay7 commented 1 year ago

Thanks for opening this. Are both source and destination on Amazon Managed Grafana? Reading alerting rules is possible on 8.4 but the destination should be 9.4 for creating alerting rules in the destination.

I'm curious how many alerting rules did you have in your 8.4 environment?

lpmi-13 commented 1 year ago

both the source and destination are on Amazon Managed Grafana.

The other strange part is that after I ran this and received the above error, I checked a bit later and the alerts actually DID show up in the destination. I need to tweak the configuration a bit, since I'm now receiving the following notification in the UI when trying to navigate to alert...

Notifier with invalid identifier is detected
Do you want to delete notifier with invalid identifier: _V9CEa-4z from the dashboard JSON?
After successful deletion, make sure to save the dashboard for storing the update JSON.

but that's not a big blocker.

We have 30 alerts in the current 8.4 environment.

benfriebe commented 1 year ago

I ran into this same issue but have found both the problem and a workaround.

When it's copying the alerting rules it's expecting Grafana Alerting to be set to On for both the 8.4 and 9.4 workspaces. This option is under Workspace configuration options.

I had an 8.4 Workspace and migrated to a new 9.4 workspace and recieved the error: error: alerting API version not supported for src, minimum supported is v8.4

Switching both workspaces to have alerting on allowed it to perform the migration without error. Also tested with a new destination workspace with alerting turned on during creation and it migrated without error as well.

The code currently looks to be doing a catchall on any error and throwing that above error. Would be worth putting in a check to see if alerting is on and/or if there are any rules.

bonclay7 commented 1 year ago

Yeah good catch @benfriebe, we'll add the Grafana Alerting requirements in the docs. Also the error is too generic, we'll issue a fix for that