TSDB allows you to query data through HTTP APIs. For specific instructions, see Query data in the Developer Guide.
TSDB also allows you to query data through the console. You can set the query conditions by time range, metric, tag and so on.
On the Instances” page in the TSDB console, click Manage** in the “Actions” column of the instance.
In the menu at the left of the Instance Details page, click Data Query.
On the Data Query page, set the query conditions.
In Time Range field, select the start time and end time of the period during which the data you are going to query is generated.This field is mandatory.
Note: supports querying data by a single timestamp. When querying, set StartTime same as EndTime.
In the drop-down list of Metric field, select a metric. This field is mandatory.
In the Space Aggregator field, select the space aggregation method for the metrics.This field is mandatory.
When multiple time series are generated for one metric (due to multiple index collecting devices), in order to display the data of multiple space dimensions in one time series, you need to perform space aggregation. The aggregation methods include “avg”, “count”, “sum”, “max” and “min”.
In the Tag field, click Add to add a tag and its value. To add another tag, click **Add again. TSDB supports data filtering by multiple tags.
- For the same tag, the relationship between it values is “OR”, for example, “city” = “Beijing” or “Shanghai”.
- The relationship between different tags is “AND”, for example, “city” = “Beijing” and “region” = “Haidian”.
In the drop-down list of the “Groups” field, select a group, and click Add.
The group function is used to compare data of multiple groups. Data can be grouped by Tag or TagValue. This field is optional.
- Multiple groups can be generated for multiple TagValues of a single Tag.
- Multiple Cartesian groups can be generated for multiple TagValues of multiple Tags.
In the Downsampling field, move the slider to enable or disable the downsampling function.
TSDB’s default time granularity for data collecting is second (s). The downsampling function is also off by default, and the data is displayed in the time granularity of the data collection.
If the current time granularity is unnecessarily too small for you, and you need to view the data in a more macro perspective, that is, in a larger granularity (for example, 30 minutes, 12 hours), you can enable the downsampling function.
After the downsampling function is enabled, select values for the Downsampling Aggregator and Sampling Time Interval fields.
- After the query conditions are specified, click Query.
The query result is displayed in a coordinate graph. The X-axis is the time, and the Y-axis is the metric value.