Full class name: com.aliyun.hitsdb.client.TSDBClient
java.lang.Object: com.aliyun.hitsdb.client.TSDBClient
Implemented interfaces: TSDB, Closeable, and AutoCloseable
public class TSDBClient extends Objectimplements TSDB
Constructor
Constructor and description
TSDBClient(TSDBConfig config)
Constructor details
TSDBClient
public TSDBClient(TSDBConfig config) throws HttpClientInitException
Exception thrown: HttpClientInitException
Methods
Qualifier and type | Method and description |
---|---|
void |
close() : shuts down a Time Series Database (TSDB) client. For more information, see Shut down a TSDB client.
|
void |
close(boolean force) : shuts down a TSDB client. For more information, see Shut down a TSDB client.
|
void |
delete(Query query) : deletes data. For more information, see Delete data.
Notice This method is unavailable.
|
void |
delete(String metric, long startTime, long endTime) : deletes data of the specified metric in the specified time range. For more information,
see Delete data.
|
void |
deleteMeta(String metric, Map<String,String> tags) : deletes a timeline and all data that is related to the timeline. For more information,
see Delete a timeline.
|
void |
deleteMeta(Timeline timeline) : deletes a timeline and all data that is related to the timeline. For more information,
see Delete a timeline.
|
List<TagResult> |
dumpMeta(String tagkey, String tagValuePrefix, int max) : queries tags. For more information, see Query tags.
|
List<QueryResult> |
last(Query query,int num) : queries data. For more information, see Query data.
|
<QueryResult> |
lastdp(Collection<Timeline> timelines) : queries the last data point in the specified timeline. For more information, see
Query the last data point in the specified timeline.
|
List<LastDPValue> |
lastdp(Timeline… timelines) : queries the last data point in the specified timeline. For more information, see
Query the last data point in the specified timeline.
|
void |
put(Point… points) : asynchronously writes data points to TSDB. For more information, see Asynchronously write data points to TSDB.
|
void |
put(Point point) : asynchronously write a data point to TSDB. For more information, see Asynchronously write data points to TSDB.
|
<T extends Result>T |
putSync(Class<T> resultType, Collection<Point> points) : synchronously writes data points to TSDB. For more information, see Synchronously write data points to TSDB.
|
<T extends Result>T |
putSync(Class<T> resultType, Point… points) : synchronously writes data points to TSDB. For more information, see Synchronously write data points to TSDB.
|
Result |
putSync(Class<T> resultType, Point… points) : synchronously writes data points to TSDB. For more information, see Synchronously write data points to TSDB.
|
<T extends Result>T |
putSync(Collection<Point> points, Class<T> resultType) : synchronously writes data points to TSDB. For more information, see Synchronously write data points to TSDB.
|
Result |
putSync(Point… points) : synchronously writes data points to TSDB. For more information, see Synchronously write data points to TSDB.
|
List<QueryResult> |
query(Query query) : queries data. For more information, see Query data.
|
void |
query(Query query, QueryCallback callback) : queries data. For more information, see Query data.
|
List<String> |
suggest(Suggest type, String prefix, int max) : queries the metrics that meet the specified conditions. For more information, see
Query the metrics that meet the specified conditions.
|
int |
ttl() : retrieves a time-to-live (TTL) value. Unit: seconds. For more information, see Query a TTL value.
|
void |
ttl(int lifetime) : sets a TTL value. Unit: seconds. For more information, see Query a TTL value.
|
void |
ttl(int lifetime,TimeUnit unit) : retrieves a TTL value. Unit: seconds. For more information, see Query a TTL value.
|
Shut down a TSDB client
-
close
public void close() throws IOException
- Exception thrown:
IOException
-
close
Description: shuts down a TSDB client.public void close(boolean force) throws IOException
You can call this method before you exit the program.
- Parameters:
force
- true or false- Exception thrown:
IOException
- exception
Delete data
-
delete
Description: deletes data. This method is unavailable.public void delete(Query query) throws HttpUnknowStatusException
- Parameters:
query
- query- Exception thrown:
HttpUnknowStatusException
- Exception
-
deleteData
Description: deletes data of the specified metric in the specified time range.public void deleteData(String metric, Date startDate, Date endDate)
- Parameters:
metric
- metric name
-
deleteData
public void deleteData(String metric, long startTime, long endTime)
- Parameters:
metric
- metric
Delete a timeline
-
deleteMeta
Description: deletes timeline data.public void deleteMeta(String metric,Map<String,String> tags)
- Parameters:
metric
- the name of the metric
-
deleteMeta
Description: deletes timeline data.public void deleteMeta(Timeline timeline)
- Parameters:
timeline
- the instance of the Timeline class
Query tags
dumpMeta
public List<TagResult> dumpMeta(String tagkey, String tagValuePrefix, int max)
Description: queries tags that meet the specified conditions.
- Parameters:
tagkey
- the key of the tag- Response:
- the List of the TagResult
Query data
last
public List<QueryResult> last(Query query, int num) throws HttpUnknowStatusException
- Parameters:
query
- the instance of the Query class- Response:
- A list of results
- Exception thrown:
HttpUnknowStatusException
- Exception
Query the last data point in the specified timeline
-
lastdp
Description: queries the last data point in the specified timeline.public List<LastDPValue> lastdp(Collection<Timeline> timelines) throws HttpUnknowStatusException
- Parameters:
timelines
- the instance of the Timelines class- Response:
- List
- Exception thrown:
HttpUnknowStatusException
- Exception
-
lastdp
Description: queries the last data point in the specified timeline.public List<LastDPValue> lastdp(Timeline… timelines) throws HttpUnknowStatusException
- Parameters:
timelines
- the instance of the Timelines class- Response:
- List
- Exception thrown:
HttpUnknowStatusException
- Exception
Asynchronously write data points to TSDB
-
put
Description: asynchronously writes data points to TSDB.public void put(Point… points)
- Parameters:
points
- a collection of data points
-
put
Description: asynchronously writes a data point to TSDB.public void put(Point point)
- Parameters:
point
- the data point
Synchronously write data points to TSDB
-
putSync
Description: synchronously writes data points to TSDB.public <T extends Result> T putSync(Collection<Point> points, Class<T> resultType)
- Type parameter:
T
- Result.class, SummaryResult.class, DetailsResult.class- Parameters:
points
- a collection of data points- Response:
- A Result instance
-
putSync
Description: synchronously writes data points to TSDB.public <T extends Result> T putSync(Class<T> resultType, Point… points)
- Type parameter:
T
- Result.class, SummaryResult.class, DetailsResult.class- Parameters:
resultType
- the type of the result- Response:
- Result
-
putSync
Description: synchronously writes data points to TSDB.public Result putSync(Collection<Point> points)
- Parameters:
points
- the number of data points- Response:
- A Result instance. This object is used only to indicate that the method returns a result.
-
putSync
Description: synchronously writes data points to TSDB.public <T extends Result> T putSync(Class<T> resultType, Collection<Point> points)
- Type parameter:
T
- Result.class, SummaryResult.class, DetailsResult.class- Parameters:
resultType
- the type of the result- Response:
- Result
-
putSync
Description: synchronously writes data points to TSDB.public Result putSync(Point… points)
- Parameters:
points
- a collection of data points- Response:
- Result
Query data
-
query
Description: queries data.public List<QueryResult> query(Query query)
- Parameters:
query
- the instance of the Query class- Response:
- An instance of the QueryResult class
-
query
Description: asynchronously queries data. The data is returned in a callback.public void query(Query query, QueryCallback callback)
- Parameters:
query
- the instance of the Query class
Query the metrics that meet the specified conditions
-
suggest
Description: queries metrics.public List<String> suggest(Suggest type, String prefix, int max)
- Parameters:
type
- the data type- Response:
- result
Query a TTL value
-
ttl
Description: queries a TTL value.public int ttl()
Unit: seconds.
- Response:
- The TTL value. Unit: seconds.
-
ttl
Description: sets a TTL value.public void ttl(int lifetime)
- Parameters:
lifetime
- the TTL value. Unit: seconds.
-
ttl
public void ttl(int lifetime, TimeUnit unit)
- Parameters:
lifetime
- the TTL value