Search code examples
grafanaamazon-timestream

How to setup a Time Series chart in Grafana from a AWS Timestream - getting (Data is missing a number field)


I have the following set of data in a AWS Timestream database: enter image description here

Inside Grafana I can get the data and display as a table like following: enter image description here

If I select display data as time series I get the following error: Data is missing a number field enter image description here

Even in the suggestion panel there is no time series option enter image description here

Does someone know what could be the issue and how to fix it? The desired output is a line chat (time series) of w_flow field.


Solution

  • Two issues here:

    1. You are using VARCHAR to store the measures, not doubles. While you could do a CAST(measure_value::varchar AS DOUBLE) is always better to store it as a double from the start.

    2. In Timestream to transform your data into a time series you need to use the following command:

    CREATE_TIME_SERIES(time, measure_value::<data_type>) as specified in our documentation here:

    https://docs.aws.amazon.com/timestream/latest/developerguide/timeseries-specific-constructs.views.html.

    In your specific case the query will look something like this: Select w_flow, CREATE_TIME_SERIES(time, CAST(measure_value::varchar as DOUBLE)) as w_flow_value from w_flow_db.w_flow Group by w_flow

    To use any of the other time series specific function you will need to call the same function to pass the time series as the required parameter as seen here :

    https://docs.aws.amazon.com/timestream/latest/developerguide/timeseries-specific-constructs.functions.interpolation.html

    That would probably end up looking like this: Select w_flow, INTERPOLATE_LINEAR(CREATE_TIME_SERIES(time, CAST(measure_value::varchar as DOUBLE)), )…

    Hope this helps