Baidu AI Cloud
中国站

百度智能云

Time-Spatial Database

Data Point Query

Why is the generated chart still empty in the query panel?

Cause 1: Time Range Setting Error.

The horizontal axis of the chart refers to the value of the timestamp field for the storage points in the database instances, but not the imported time. This is most likely due to the inconsistency between the value of the timestamp field and the import time.

Cause 2: Type of the Data Point is string.

As shown in the following example, the raw data is as follows:

{
    "time": 1465376157007,
    "name": "cpu_idle",
    "score": "51",
    "host": "server1",
    "rack": "rack1",
    "other": "something"
}

Forward the data to the TSDB through the rule engine, and the rules of the rule engine are set as follows:

name AS metric, score AS _value, `time` AS _timestamp, host, rack

In this case, the data point written into the TSDB is:

{
    "metric":"cpu_idle",
    "_value":"51",
    "_timestamp":1465376157007,
    "host":"server1",
    "rack":"rack1"
}

Because the raw data is "score": "51", the type of the data in this case is string. The chart cannot be generated in the query panel after the data of string type is written into the TSDB.

You can solve the above problem by converting data types through the rule engine, and the rules are specifically configured as follows:

name AS metric, CAST(score AS DOUBLE) AS _value, `time` AS _timestamp, host, rack

For introduction about CAST function, see Common SQL Functions.

Previous
Database Creation and Setup
Next
Data Point Write