# Grafana Timestream Data Source

**URL:** <https://community.grafana.com/t/grafana-timestream-data-source/132439>\
**Category:** Grafana\
**Tags:** datasource, plugins\
**Created:** [September 18, 2024, 1:29pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439 "2024-09-18T13:29:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![xbox3535889](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/xbox3535889/32/48901_2.png) [@xbox3535889](https://community.grafana.com/u/xbox3535889)\
**Post date:** [September 18, 2024, 1:29pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/1 "2024-09-18T13:29:47Z")

</div>

Hello,

I am using Grafana to display data from AWS Timestream, it seems to be very slow to display the data, I have tried changing some datasource configuration but the situation remains the same, it is really very slow, do you have any ideas to improve performance ?

 ![grafana-dashboard-loading](https://us1.discourse-cdn.com/grafana/original/3X/6/f/6ff33ccefe78c5842fb7d281fb374d488255544b.png)

In the first picture you can see the dashboard loading, it stays loading for several minutes.

In the second pic you’ll find the datasource configuration

 ![grafana-datasource-conf](https://us1.discourse-cdn.com/grafana/original/3X/4/b/4bc9edea20d6a1095554d106efcd6d7b5b18aa88.png)

Opened a Bug in Grafana Timestream Plugin GitHub prj : [Slowness to retrieve data in dashboard ( POST calls fail repeatedly ) · Issue #305 · grafana/timestream-datasource · GitHub](https://github.com/grafana/timestream-datasource/issues/305)

---

<div class="post-metadata">

**Author:** ![solitcon](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@solitcon](https://community.grafana.com/u/solitcon)\
**Post date:** [September 18, 2024, 1:46pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/2 "2024-09-18T13:46:35Z")

</div>

how long does that exact query take outside of grafana ie a timestream query tool

can you share the query?

---

<div class="post-metadata">

**Author:** ![xbox3535889](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/xbox3535889/32/48901_2.png) [@xbox3535889](https://community.grafana.com/u/xbox3535889)\
**Post date:** [September 18, 2024, 2:27pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/3 "2024-09-18T14:27:48Z")

</div>

The query extracted from the panel and run on the timestream query editor takes 2 sec (see image)

Reloading graphana after a few minutes, it started the slow loading again, and opening Chrome’s DevTool you can see how the query calls repeatedly fail until an answer comes after several minutes (as you can see in the second pic)

 ![grafana-qeury-result-time](https://us1.discourse-cdn.com/grafana/original/3X/3/b/3b860c3bd12f5fd3cdf5840a735ce8a804a556a7.png)  
 ![image](https://us1.discourse-cdn.com/grafana/original/3X/8/6/86129e1c1291f873e381c607a1fd06e4cd4454ce.png)

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [September 18, 2024, 2:39pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/4 "2024-09-18T14:39:10Z")

</div>

so this might indicate an issue with that data source. All the errors are `POST`s . why is it trying to `POST` when fetching data?

might want to post this in grafana github

---

<div class="post-metadata">

**Author:** ![xbox3535889](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/xbox3535889/32/48901_2.png) [@xbox3535889](https://community.grafana.com/u/xbox3535889)\
**Post date:** [September 18, 2024, 3:00pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/5 "2024-09-18T15:00:36Z")

</div>

I don’t know why, but it seems to use the POST call with the query used in the payload.

 ![grafana-payload-message](https://us1.discourse-cdn.com/grafana/original/3X/e/c/eca2eb4657b4235959cc32fa691e7c850146fabd.png)

OK I’ll open a Bug in the github repository

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [September 18, 2024, 3:01pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/6 "2024-09-18T15:01:53Z")

</div>

your `try_cast` stuff is worrisome. also do you have index on `time` `measure_name` and `asset_code` columns?

---

<div class="post-metadata">

**Author:** ![xbox3535889](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/xbox3535889/32/48901_2.png) [@xbox3535889](https://community.grafana.com/u/xbox3535889)\
**Post date:** [September 19, 2024, 4:01pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/7 "2024-09-19T16:01:09Z")

</div>

i’ve used try\_cast because not all values are integer inside the Timestream table (and it’s useful to display those type of data in Timeseries visualization) and no, i don’t have indexes for those columns (dimensions). At least with also some simple queries the situation remains the same

Opened a bug into Grafana Timestream Plugin : [Slowness to retrieve data in dashboard ( POST calls fail repeatedly ) · Issue #305 · grafana/timestream-datasource · GitHub](https://github.com/grafana/timestream-datasource/issues/305)

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [September 19, 2024, 4:29pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/8 "2024-09-19T16:29:39Z")

</div>

yeah that was just some side points but worth looking into. can you try that same query without the use of `try_cast`  
you should really not be plotting any values that are not int though right? also it raises a lot of ??s as to why that one column has 2 types of data types. does not pass the sniff test 🐡

---

<div class="post-metadata">

**Author:** ![xbox3535889](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/xbox3535889/32/48901_2.png) [@xbox3535889](https://community.grafana.com/u/xbox3535889)\
**Post date:** [September 20, 2024, 12:54pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/9 "2024-09-20T12:54:52Z")

</div>

Without the use of **try\_cast** the situation remains the same, it seems that the authorization provider via SDK takes a long time before it has a token to be able to query AWS services and every time it expires it takes the same amount of time to request it

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [September 20, 2024, 3:14pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/10 "2024-09-20T15:14:46Z")

</div>

does timestream provide a rest api? wonder if that is faster

---

<div class="post-metadata">

**Author:** ![xbox3535889](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/xbox3535889/32/48901_2.png) [@xbox3535889](https://community.grafana.com/u/xbox3535889)\
**Post date:** [September 25, 2024, 2:51pm UTC](https://community.grafana.com/t/grafana-timestream-data-source/132439/11 "2024-09-25T14:51:52Z")

</div>

From [Slowness to retrieve data in dashboard ( POST calls fail repeatedly ) · Issue #305 · grafana/timestream-datasource · GitHub](https://github.com/grafana/timestream-datasource/issues/305) I opened it seems to be strictly related to the Authentication Provider (SDK Default) because by selecting the method via credentials everything works immediately, even heavier queries are executed quickly
