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

json: cannot unmarshal number into Go struct field QueryModel.queryType of type string #1342

Closed
alecxvs opened this issue Nov 10, 2021 · 2 comments
Labels
Milestone

Comments

@alecxvs
Copy link
Contributor

alecxvs commented Nov 10, 2021

Describe the bug
We recently upgraded from 4.1.2 to 4.2.4, and one of our users noticed that Zabbix panel alerts were not firing correctly. It's producing an error from the plugin:
request handler response error {could not read query: json: cannot unmarshal number into Go struct field QueryModel.queryType of type string A <nil> [] [] 0xc004b53740}

Expected behavior
No Go error to be thrown from the plugin

Screenshots
If applicable, add screenshots to help explain your problem.

Network data
If it's related to metric data visualization would be great to get the raw query and response for the network request (check this in browser dev tools network tab, there you can see metric requests, please include the request body and request response)

Software versions

Grafana Zabbix Grafana-Zabbix Plugin
8.2.3 4.0.30 4.2.4

It seems like the related difference between these versions is that query types (or modes) used to be numbers, but were converted to strings.

If I check the dashboard json, indeed the panels still have numbers in queryType. The panel json inspector shows a string type, though. If the expectation is that we edit each panel to apply the migration, I suppose there's no issue here. But maybe there's an improvement here if the backend is supposed to handle the change passively, or if it should throw a better error that explains that a migration edit is necessary

@alexanderzobnin
Copy link
Collaborator

Hi! Yes, looks like the panel format is outdated. But I agree, it's might be handled on the backend (by using interface{} type and doing type cast).

@alexanderzobnin alexanderzobnin added this to the 4.2.5 milestone Nov 24, 2021
@gustavo-godoy
Copy link

Any known workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants