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

TSDBClient(TSDBConfig config)

Methods

Qualifier and type Method and description
void close(): shuts down a TSDB client.
void close(boolean force): shuts down a TSDB client.
void delete(Query query): deletes data. This method is unavailable.
void deleteData(String metric, Date startDate, Date endDate): deletes data. You must specify a metric and a time range.
void deleteData(String metric, long startTime, long endTime): deletes data. You must specify a metric and a time range.
void deleteMeta (String metric, Map<String,String> tags): deletes a timeline and all data that is related to the timeline.
void deleteMeta (Timeline timeline): deletes a timeline and all data that is related to the timeline.
List<TagResult> dumpMeta (String tagkey, String tagValuePrefix, int max): queries tags.
List<QueryResult> last (Query query,int num): queries data.
<QueryResult> lastdp (Collection<Timeline> timelines): queries the last value in a timeline.
List<LastDPValue> lastdp (Timeline… timelines): queries the last value in a timeline.
void put (Point… points): asynchronously writes data points to TSDB.
void put (Point point): asynchronously writes data points to TSDB.
<T extends Result>T putSync (Class<T> resultType, Collection<Point> points): synchronously writes data points to TSDB.
<T extends Result>T putSync (Class<T> resultType, Point… points): synchronously writes data points to TSDB.
Result putSync (Collection<Point> points): synchronously writes data points to TSDB.
<T extends Result>T putSync (Collection<Point> points, Class<T> resultType): synchronously writes data points to TSDB.
Result putSync (Point… points): synchronously writes data points to TSDB.
List<QueryResult> query (Query query): queries data.
void query (Query query, QueryCallback callback): queries data.
List<String> suggest (Suggest type, String prefix, int max): queries the metrics that meet specified conditions.
int ttl(): queries a time-to-live (TTL) value. Unit: seconds.
void ttl (int lifetime): sets a TTL value. Unit: seconds.
void ttl(int lifetime,TimeUnit unit)

Methods inherited from the java.lang.Object class

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait

Constructor details

TSDBClient

public TSDBClient(TSDBConfig config) throws HttpClientInitException

Exception: HttpClientInitException

Shut down a TSDB client

  • close

    public void close() throws IOException
    Specifier:
    close specifier: Closeable
    Specifier:
    close specifier: AutoCloseable
    Exception:
    IOException

Shut down a TSDB client

  • close

    public void close(boolean force) throws IOException
    Description: shuts down a TSDB client. You can call this method before you exit the program.
    Specifier:
    close specifier: TSDB
    Parameter:
    force - true or false
    Exception:
    IOException - exception

Delete data

  • delete

    public void delete(Query query) throws HttpUnknowStatusException
    Description: deletes data. This method is unavailable.
    Specifier:
    delete specifier: TSDB
    Parameter:
    query - query
    Exception:
    HttpUnknowStatusException - Exception

Delete data

  • deleteData

    public void deleteData(String metric, Date startDate, Date endDate)
    Description: deletes data. You must specify a metric and a time range.
    Specifier:
    deleteData specifier: TSDB
    Parameters:
    metric - the name of the metric
    startDate - the start date
    endDate - the end date

Delete data

  • deleteData

    public void deleteData(String metric, long startTime, long endTime)
    Specifier:
    deleteData specifier: TSDB
    Parameters:
    metric - the name of the metric
    startTime - the start timestamp
    endTime - the end timestamp

Delete a timeline

  • deleteMeta

    public void deleteMeta(String metric, Map<String, String> tags)
    Description: deletes timeline data.
    Specifier:
    deleteData specifier: TSDB
    Parameters:
    metric- the name of the metric
    tags - the tag key-value pairs in the Map format.

Delete a timeline

  • deleteMeta

    public void deleteMeta(Timeline timeline)
    Description: deletes timeline data.
    Specifier:
    deleteData specifier: TSDB
    Parameter:
    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 specified conditions.
    Specifier:
    dumpMeta specifier: TSDB
    Parameters:
    tagkey - the key of the tag
    tagValuePrefix - the prefix of the tag value
    max - the maximum value
    Response:
    A list of tags

Query data

  • last

    public List<QueryResult> last(Query query, int num) throws HttpUnknowStatusException
    Specifier:
    last specifier: TSDB
    Parameters:
    query- the instance of the Query class
    num - the number of last data points in the timeline
    Response:
    A list of results
    Exception:
    HttpUnknowStatusException - Exception

Query the data point in a timeline

  • lastdp

    public List<LastDPValue> lastdp(Collection<Timeline> timelines) throws HttpUnknowStatusException
    Description: queries the last data point in a timeline.
    Specifier:
    lastdp specifier: TSDB
    Parameter:
    timelines- the instance of the Timelines class
    Response:
    The data point
    Exception:
    HttpUnknowStatusException - Exception

Query the data point in a timeline

  • lastdp

    public List<LastDPValue> lastdp(Timeline… timelines)                        throws HttpUnknowStatusException
    Description: queries the last data point in a timeline.
    Specifier:
    lastdp specifier: TSDB
    Parameter:
    timelines - the instance of the Timelines class
    Response:
    The data point
    Exception:
    HttpUnknowStatusException - Exception

Asynchronously write time points to TSDB

  • put

    public void put(Point… points)
    Description: asynchronously writes time points to TSDB.javascript:void(0);
    Specifier:
    put specifier: TSDB
    Parameter:
    points - a collection of data points

Asynchronously write time points to TSDB

  • put

    public void put(Point point)
    Description: asynchronously writes time points to TSDB.
    Specifier:
    put specifier: TSDB
    Parameter:
    point - the data points

Synchronously write time points to TSDB

  • putSync

    public <T extends Result> T putSync(Collection<Point> points, Class<T> resultType)
    Description: synchronously writes time points to TSDB.
    Specifier:
    putSync specifier: TSDB
    Type parameters:
    T - Result.class, SummaryResult.class, DetailsResult.class
    Parameters:
    points - a collection of data points
    resultType - the type of the result
    Response:
    A Result instance

Synchronously write time points to TSDB

  • putSync

    public <T extends Result> T putSync(Class<T> resultType,                                Point… points)
    Description: synchronously writes time points to TSDB.
    Specifier:
    putSync specifier: TSDB
    Type parameters:
    T - Result.class, SummaryResult.class, DetailsResult.class
    Parameter:
    resultType - the type of the result
    points - a collection of data points
    Response:
    Result

Synchronously write time points to TSDB

  • putSync

    public Result putSync(Collection<Point> points)
    Description: synchronously writes time points to TSDB.
    Specifier:
    putSync specifier: TSDB
    Parameter:
    points - a collection of data points
    Response:
    A Result instance This object is only used to indicate that the method returns a result.

Synchronously write time points to TSDB

  • putSync

    public <T extends Result> T putSync(Class<T> resultType,                                Collection<Point> points)
    Description: synchronously writes time points to TSDB.
    Specifier:
    putSync specifier: TSDB
    Type parameters:
    T - Result.class, SummaryResult.class, DetailsResult.class
    Parameters:
    resultType - the type of the result
    points - a collection of data points
    Response:
    Result

Synchronously write time points to TSDB

  • putSync

    public Result putSync(Point… points)
    Description: synchronously writes time points to TSDB.
    Specifier:
    putSync specifier: TSDB
    Parameter:
    points - a collection of data points
    Response:
    Result

Query data

  • query

    public List<QueryResult> query(Query query)
    Description: queries data.
    Specifier:
    query specifier: TSDB
    Parameter:
    query- the instance of the Query class
    Response:
    An instance of the QueryResult class

Query data

  • query

    public void query(Query query, QueryCallback callback)
    Description: asynchronously queries data. The data is returned in a callback.
    Specifier:
    query specifier: TSDB
    Parameters:
    query- the instance of the Query class
    callback - the instance of the QueryCallback class. The data is asynchronously returned in a callback.

Query the metrics that meet specified conditions

  • suggest

    public List<String> suggest(Suggest type, String prefix, int max)
    Description: queries metrics.
    Specifier:
    suggest specifier: TSDB
    Parameters:
    type - the data type
    prefix - the prefix
    max - the maximum value
    Response:
    result

Query a TTL value

  • ttl

    public int ttl()
    Description: queries a TTL value. Unit: seconds.
    Specifier:
    ttl specifier: TSDB
    Response:
    The TTL value, in seconds

Set a TTL value

  • ttl

    public void ttl(int lifetime)
    Description: sets a TTL value.
    Specifier:
    ttl specifier: TSDB
    Parameter:
    lifetime - the TTL value, in seconds

Set a TTL value

  • ttl

    public void ttl(int lifetime, TimeUnit unit)
    Specifier:
    ttl specifier: TSDB
    Parameters:
    lifetime - the TTL value
    unit - the unit of the TTL value