grafana / timestream-datasource

Amazon Timestream in Grafana
https://grafana.com/grafana/plugins/grafana-timestream-datasource
Apache License 2.0
24 stars 19 forks source link

Grafana does not fetch all data which are in AWS Timestream prepered to visualize at Grafana #74

Closed stefandroid1 closed 3 years ago

stefandroid1 commented 3 years ago

I run the following query in Grafana.

select time, measure_value::bigint as GreasepressureMit from $database.$table where measure_name = 'PGMit' order by time ;

This query was taking a long time to execute >1min , which is due to the large number of rows. (> 1000000 rows) However when the query completed only 7-8k records were returned. Hence the values on the graph were less and I could not view previous data.

Further on I went to troubleshoot the issue to determine the maximum number of rows returned by the query in Grafana. For this I tried to use the LIMIT clause. Example: select time, measure_value::bigint as GreasepressureMit from $database.$table where measure_name = 'PGMit' order by time LIMIT 15000;

I tried limits of 10000, 15000, 17000 and these worked well. But when the query was crossing a result of 20000 rows, this query returned only a few rows. This behavior seems like there is some batch threshold after which all the older records are not returned and only latest result in the batch are returned.

I tried multiple variations of the query but I could find only a few datapoints being processed. The issue seems similar to : https://github.com/grafana/timestream-datasource/issues/14

ericarnoldy commented 3 years ago

I'm having the same issue with AWS Timestream. I've got Lambda sending data to both Influx and Timestream. The Influx queries work great over say 30 days, 4 series of data. AWS Timestream returns only a partial set of one series for the same.

I thought there was a limit on datapoints, so tried putting into bins using bin(time, 1h) and adding a group by bin(time, 1h), which did put them into bin's but didn't see to help with the amount of queries. Good find on 20,000 row limit @stefandroid1 I was thinking may be Apache was in the way, so tried going direct with the same results.

In the logs, whenever I see the message: grafana-server[985403]: t=2021-03-25T18:35:31+0000 lvl=info msg="running continue query" logger=plugins.backend pluginId=grafana-timestream-datasource

The query won't complete.

I think Pagination is the root cause - from AWS Timestream:

query is a paginated operation. Multiple API calls may be issued in order to retrieve the entire data set of results. You can disable pagination by providing the --no-paginate argument. When using --output text and the --query argument on a paginated response, the --query argument must extract data from the results of the following query expressions: Rows

How can we get the timestream-datasource to either be compatible with pagination, or use the SDK equivalent of no-paginate

ryantxu commented 3 years ago

Can you check with the latest release 1.3.0 from https://grafana.com/grafana/plugins/grafana-timestream-datasource/

This includes changes that have likely fixed your issue -- please let me know

ericarnoldy commented 3 years ago

@ryantxu this is much improved; however one small issue exists.

It appears that only the first series loads correctly. I’ve got four series, loading in four queries. Query A works great, but Query B and beyond simply don’t load, over the same long period. Maybe pagination is only working now on the first query.

Thanks for your response!

stefandroid1 commented 3 years ago

Version 1.3.0 works fine for Query A. But Query B and beyond simply don’t load, over the same long period

If that bug would be fixed Grafana would become my favorite tool 😉

Mit freundlichen Grüßen / With kind regards

Stefan Gebauer Test Lab Engineer SKF Lubrication Management

Tel: +49 6227 33-672 E-mail: @.**@.>

SKF Lubrication Systems Germany GmbH Heinrich-Hertz-Str. 2-8 - 69190 Walldorf - Germany www.skf.comhttp://www.skf.com/, Facebookhttps://www.facebook.com/SKFGroup, Youtubehttps://www.youtube.com/user/SKFOfficial, Linkedinhttps://www.linkedin.com/company/skf, Twitterhttps://twitter.com/skfgroup

SKF – The Power of Knowledge Engineering SKF Lubrication Systems Germany GmbH · Sitz der Gesellschaft: Schweinfurt; Registergericht Schweinfurt, HRB 6841 · Ust.-IdNr.: DE 814 727 059 · Vorsitzender des Aufsichtsrats: Martin Johannsmann · Geschäftsführer: Volker Pieschel

Von: Ryan McKinley @.> Gesendet: Freitag, 26. März 2021 09:38 An: grafana/timestream-datasource @.> Cc: Stefan Gebauer @.>; Mention @.> Betreff: Re: [grafana/timestream-datasource] Grafana does not fetch all data which are in AWS Timestream prepered to visualize at Grafana (#74)

Can you check with the latest release 1.3.0 from https://grafana.com/grafana/plugins/grafana-timestream-datasource/

This includes changes that have likely fixed your issue -- please let me know

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/grafana/timestream-datasource/issues/74#issuecomment-808039626, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQRANF5ER5U2YBPQWFWHSVTTFRBW5ANCNFSM4ZW4GZQA.

ryantxu commented 3 years ago

I'm glad it is better, we will tackle https://github.com/grafana/timestream-datasource/issues/78 soon

ryantxu commented 3 years ago

@stefandroid1 can you check again with v1.3.1? this is now executing all queries in parallel

ericarnoldy commented 3 years ago

@ryantxu Thank you! Its working perfectly with 1.3.1 ... I was able to load 4x series of 30 second data over 90 days ... wonderful!

stefandroid1 commented 3 years ago

Hello Ryan, sorry for my late response. I just installed v1.3.1 and use it with Grafana Version 7.5.0 and it seems to work fine. The issues from the past seem to be fixed. Thank you for your support.

Mit freundlichen Grüßen / With kind regards

Stefan Gebauer Test Lab Engineer SKF Lubrication Management

Tel: +49 6227 33-672 E-mail: @.**@.>

SKF Lubrication Systems Germany GmbH Heinrich-Hertz-Str. 2-8 - 69190 Walldorf - Germany www.skf.comhttp://www.skf.com/, Facebookhttps://www.facebook.com/SKFGroup, Youtubehttps://www.youtube.com/user/SKFOfficial, Linkedinhttps://www.linkedin.com/company/skf, Twitterhttps://twitter.com/skfgroup

SKF – The Power of Knowledge Engineering SKF Lubrication Systems Germany GmbH · Sitz der Gesellschaft: Schweinfurt; Registergericht Schweinfurt, HRB 6841 · Ust.-IdNr.: DE 814 727 059 · Vorsitzender des Aufsichtsrats: Martin Johannsmann · Geschäftsführer: Volker Pieschel

Von: Ryan McKinley @.> Gesendet: Mittwoch, 31. März 2021 17:52 An: grafana/timestream-datasource @.> Cc: Stefan Gebauer @.>; Mention @.> Betreff: Re: [grafana/timestream-datasource] Grafana does not fetch all data which are in AWS Timestream prepered to visualize at Grafana (#74)

@stefandroid1https://github.com/stefandroid1 can you check again with v1.3.1? this is now executing all queries in parallel

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/grafana/timestream-datasource/issues/74#issuecomment-811174198, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQRANF7NVYFFM2XFMGVHANDTGNAJXANCNFSM4ZW4GZQA.