edit-icon download-icon

Call other interfaces

Last Updated: Mar 28, 2018

TTL

Time to Live (TTL) specifies time before data expiry.

Sample code

Set up ttl, in seconds:

tsdb.ttl(time);

Get ttl, in seconds:

int ttl = tsdb.ttl();

Suggest

Query Metric, TagKey, and TagValue.

Sample code

Query the names of 10 Metrics that start with “hel”:

List<String> metrics = tsdb.suggest(Suggest.Metrics, "hel", 10);
System.out.println("Query results: " + metrics);

DumpMeta

Use TagKey to query TagValue.

Sample code

Query 10 Tag key-value pairs whose names start with "tagk1", whose values start with "tagv1”:

List<TagResult> dumpMeta = tsdb.dumpMeta("tagk1", "tagv1", 10);
System.out.println("Query results: " + dumpMeta);

DeleteData

Delete data within a specified period.

Sample code

Delete all data from between startTime and nowTime whose Metric has the name "hello":

tsdb.deleteData("hello", startTime, nowTime);

DeleteMeta

Delete the specified timeline.

Sample code

Delete a timeline. The Metric of this timeline is "hello". Only one Tag pair exists, with the Tag name "tagk1" and value "tagv1":

// Build the timeline
Timeline timeline = Timeline.metric("hello").tag("tagk1", "tagv1").build();

tsdb.deleteMeta(timeline);
Thank you! We've received your feedback.