edit-icon download-icon

Query the latest data point of a time series

Last Updated: Jul 09, 2018

Request path and method

Path Method Description
/api/query/last POST Obtains the latest data point written into by the time series

Note: This port is fully compatible with OpenTSDB protocol.

Request content

Metric query

Name Type Required Description Default value Example
metric String Yes Metric of the latest data point to be queried None cpu.usage
tags String No Tags of the latest data point to be queried None host_name=host1

TSUID query

Name Type Required Description Default value Example
tsuid String Yes TSUID of the latest data point to be queried None 00005B00005C0000F000005D0000EE00005E0000EF

Note: The TSUID of the timeline can be queried through /api/search/lookup.

Request JSON example

Job: Query the latest data point written into by the time series, of which the metric is “cpu.usage” and the tag is “host_name=host1”. Meanwhile, query the latest data point written into by the two time series, of which TSUIDs are 00005B00005C00002E00005D0000EE00005E0000EF and 00005B00005C0000F000005D0000EE00005E0000EF respectively.

Request: POST/api/query/last

Body:

  1. {
  2. "queries" : [
  3. {
  4. "metric":"cpu.usage",
  5. "tags" : {
  6. "host_name": "host1"
  7. }
  8. },
  9. {
  10. "tsuids": [
  11. "00005B00005C00002E00005D0000EE00005E0000EF",
  12. "00005B00005C0000F000005D0000EE00005E0000EF"
  13. ]
  14. }
  15. ]
  16. }

Response description

The latest data point written by the time series that meet the condition is returned. If no time series meets the condition, an empty set is returned.

Thank you! We've received your feedback.