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 1633004437.459 into Go struct field TimeSeriesData.series.TS of type int64 #1320

Closed
drajv-y opened this issue Sep 30, 2021 · 20 comments

Comments

@drajv-y
Copy link

drajv-y commented Sep 30, 2021

Describe the bug
&from=1633004132575&to=1633006364306 - doesn't work
&from=now-2d&to=now - works
&from=now-2d&to=now-1d - work

Expected behavior
the ability to select graphs with the mouse

Screenshots
изображение

Software versions

Grafana Zabbix Grafana-Zabbix Plugin
8.1.5 5.4.4 4.2.4
@renatoborges78
Copy link

renatoborges78 commented Oct 8, 2021

I came across this same problem I had to downgrade the version to solve it, I went back to Grafana 7.5.10 and plugin 4.1.5.
All other versions are showing this issue you cited or acknowledging the screen disappears.
"json: invalid use of ,string struct tag, trying to unmarshal into float64"

@baugarcia
Copy link

Just wanted to thank you for sharing the solution. Was having the exact same issue and after downgrading both grafana and the zabbix plugin to the versions you specified, everything worked like a charm!

@omega949
Copy link

omega949 commented Oct 13, 2021

I am experiencing the same issue, but cant roll back at least not anytime soon.. Hopefully a fix will come out soon to resolve.

Grafana: 8.1.6
Plugin: 4.2.4
Zabbix: 5.4.3

@ablecable
Copy link

I am experiencing the same issue.
Grafana: 8.2.0
Plugin: 4.2.4
Zabbix: 5.4.5

json: cannot unmarshal number 1627048976.281 into Go struct field TimeSeriesData.series.TS of type int64

@nbriche
Copy link

nbriche commented Nov 5, 2021

Same issue as well:
Grafana 8.2.2 (6232fe07c0)
Plugin 4.2.4
Zabbix 5.4.6

@nbriche
Copy link

nbriche commented Nov 5, 2021

I think it happens with direct DB connection: when disabling that feature, I can select a random time range with no error.

It may be due to mysql.ts:6, where a division of a clock value (in seconds) results in a rounding error and a float value for a timestamp, which can't be cast as an int64 by whatever comes next.

If I modify the corresponding code in production (plugins/alexanderzobnin-zabbix-app/datasource-zabbix/module.js) with a search for "historyQuery:function", then changing var o="clock", I can again select a random range with no error (after a ctrl+F5 to force the browser to fetch the modified file, of course).

Depending on what exactly that division/multiplication was supposed to do, however, the resulting graph may or may not be exactly accurate but I didn't see any obvious error.

@Ghotome
Copy link

Ghotome commented Nov 10, 2021

Same issue occurred after updating:

Grafana CLI version 8.2.3
alexanderzobnin-zabbix-app version: 4.2.4
zabbix_server (Zabbix) 5.4.6

Propose from @nbriche didn't work for me :(

@nbriche
Copy link

nbriche commented Nov 10, 2021

I will revisit it and check whether my solution was a fluke, or I'll give more precise instructions of how I managed it.

Note that since the plugin is signed, any modification to its files will disable it when the Grafana server restarts and you'll have to reinstall the plugin (ask me how I know)

@Ghotome
Copy link

Ghotome commented Nov 11, 2021

Okay, thank you!

Another question - is there hope for update which resolve this problem in future?

@szodan
Copy link

szodan commented Nov 12, 2021

I think it happens with direct DB connection: when disabling that feature, I can select a random time range with no error.

That works for me. Thanks.

@weiserhei
Copy link

then changing var o="clock"

I have replaced var o="clock DIV "+a+" * "+a; with your code and the error is gone. Everything seems to be working fine again, however I cant tell if that is introducing some other bugs.

My dashboards arent too fancy, but Im certain removing DIV a * a has some effects somewhere and is no final fix 😄

Grafana 8.2.3

@nbriche
Copy link

nbriche commented Nov 12, 2021

So I've restarted Grafana and had to reinstall the Zabbix plugin; the bug is present. I will retrace my previous steps for @Ghotome (and anyone else) to ensure I didn't mess up somewhere.

The module.js file I've mentioned is a one-liner minified, at /var/lib/grafana/plugins/alexanderzobnin-zabbix-app/datasource-zabbix/module.js (Ubuntu 20.04). Its size is (currently, v4.2.4) 141425 bytes, SHA256 hash is 5a6b2d6ba40eb76685535ad16556bc236e9edd73de687827094f4dbd59b9c900.

The specific variable I'm modifying is defined at position 73012: var o="clock DIV "+a+" * "+a;

My steps:

  1. I currently have a tab open with a bugged dashboard. I force a no-cache reload (ctrl+F5) just to be sure: yes, still bugged.
  2. I replace that code with var o="clock";
  3. I force a no-cache reload (ctrl+F5): The dashboard loads correctly, no bug.
  4. I restore the module.js file with its previous, unmodified version. I force a no-cache reload: the dashboard is bugged.

I won't for now correct the variable again, since it will break the plugin when the server restarts. I will just disable DirectDB Connection for now.

@Ghotome
Copy link

Ghotome commented Nov 12, 2021

Okay, thank you, it is helped to resolve time range problem, but we faced another after that. Maybe you can help again :)
Here screenshot:
IMG_20211112_164413_178.jpg

This problem both on time series graph and old graph.

@nbriche
Copy link

nbriche commented Nov 12, 2021

I don't know what it's supposed to look like though...
It looks like the data points don't connect? I think I've faced that problem; I think I resolved that either by using "Connect null values" to Always, or (I guess the "proper" way?) by using a groupBy(1m, avg) function to my queries.

@Ghotome
Copy link

Ghotome commented Nov 15, 2021

Sorry for delay, @nbriche.

I've tried your suggestion, here what I've accomplish:

  1. Setting "Connect null values" to "Always" didn't give any result.
  2. To every query set I added a groupBy function with args 1m, avg, that didn't work too.
  3. Both this solutions on same graph didn't work too.
  4. Changing value '1m' in groupBy function didn't give any result, same as changing second value.

Here some screenshots:

  1. That what we have now:
    image

  2. And settings, setted as you suggested:
    image

@nbriche
Copy link

nbriche commented Nov 15, 2021

Does it also happen with Direct DB Connection disabled? If so (and maybe even if not) this problem may not be related to this current issue. Someone with more experience with Grafana than I (I only started Grafana two weeks ago, I'm not all that familiar yet) may have an idea if you open a specific issue about this.

@Ghotome
Copy link

Ghotome commented Nov 16, 2021

This problem occurred just after we disable Direct DB future.
The steps above we've done with Direct DB Connection future disabled.

@nbriche
Copy link

nbriche commented Nov 16, 2021

In that case this is probably not related to this issue. You should check if there's already an issue open for it (or maybe already resolved!), and if not, open one.

@alexanderzobnin
Copy link
Collaborator

@nbriche yes, you're right it's a division bug. Disabling direct db connection is a workaround.

@B3DTech
Copy link

B3DTech commented Jan 6, 2022

I have Direct DB connection disabled in the datasource configuration and I still have the issue.

When running a test with Direct DB disabled, I still appear to get a Direct DB connection though:
Zabbix API version: 4.4.10, DB connector type: MySQL

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

No branches or pull requests