com.axibase.tsd.client
Class DataService

java.lang.Object
  extended by com.axibase.tsd.client.DataService

public class DataService
extends Object

Provides high-level API to retrieve and update ATSD Data Objects (time-series, alerts, properties).

Author:
Nikolay Malevanny.

Field Summary
static SeriesCommandPreparer LAST_PREPARER
           
 
Constructor Summary
DataService()
           
DataService(HttpClientManager httpClientManager)
           
 
Method Summary
 boolean addSeries(AddSeriesCommand... addSeriesCommands)
           
 boolean addSeriesCsv(String entityName, String data, String... tagNamesAndValues)
           
 boolean batchUpdateAlerts(BatchAlertCommand... commands)
           
 boolean batchUpdateProperties(BatchPropertyCommand... batchPropertyCommands)
           
 boolean canSendPlainCommand()
           
 boolean insertProperties(Property... properties)
           
 InputStream querySeriesPack(Format format, String entityName, String metricName, Map<String,String> tags, long startTime, long endTime, String period, AggregateType aggregateType, Integer limit, Boolean last, String columns)
           
 List<String> removeSavedPlainCommands()
           
 List<AlertHistory> retrieveAlertHistory(GetAlertHistoryQuery getAlertHistoryQuery, GetAlertHistoryQuery... getAlertHistoryQueries)
           
 List<Alert> retrieveAlerts(GetAlertQuery alertQuery, GetAlertQuery... alertQueries)
           
 List<Alert> retrieveAlerts(List<String> metricNames, List<String> entityNames, List<String> ruleNames, List<Integer> severityIds, Integer minSeverityId)
           
 List<GetSeriesResult> retrieveLastSeries(GetSeriesQuery... seriesQueries)
           
 List<Property> retrieveProperties(GetPropertiesQuery getPropertiesQuery, GetPropertiesQuery... getPropertiesQueries)
           
 List<Property> retrieveProperties(String entityName, String typeName)
           
 List<GetSeriesResult> retrieveSeries(GetSeriesQuery... seriesQueries)
           
 List<GetSeriesResult> retrieveSeries(SeriesCommandPreparer preparer, GetSeriesQuery... seriesQueries)
           
 void sendPlainCommand(PlainCommand plainCommand)
           
 void setHttpClientManager(HttpClientManager httpClientManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAST_PREPARER

public static final SeriesCommandPreparer LAST_PREPARER
Constructor Detail

DataService

public DataService()

DataService

public DataService(HttpClientManager httpClientManager)
Method Detail

setHttpClientManager

public void setHttpClientManager(HttpClientManager httpClientManager)

retrieveSeries

public List<GetSeriesResult> retrieveSeries(GetSeriesQuery... seriesQueries)
Parameters:
seriesQueries - queries with details, each query property overrides common one in the request parameters
Returns:
list of GetSeriesResult

retrieveSeries

public List<GetSeriesResult> retrieveSeries(SeriesCommandPreparer preparer,
                                            GetSeriesQuery... seriesQueries)

addSeries

public boolean addSeries(AddSeriesCommand... addSeriesCommands)
Parameters:
addSeriesCommands - commands that contains time-series which are added
Returns:
true if success

addSeriesCsv

public boolean addSeriesCsv(String entityName,
                            String data,
                            String... tagNamesAndValues)
Parameters:
entityName - entity name
data - CSV as String
tagNamesAndValues - entity tags
Returns:
true if success

retrieveLastSeries

public List<GetSeriesResult> retrieveLastSeries(GetSeriesQuery... seriesQueries)
Parameters:
seriesQueries - queries with details
Returns:
list of GetSeriesResult

querySeriesPack

public InputStream querySeriesPack(Format format,
                                   String entityName,
                                   String metricName,
                                   Map<String,String> tags,
                                   long startTime,
                                   long endTime,
                                   String period,
                                   AggregateType aggregateType,
                                   Integer limit,
                                   Boolean last,
                                   String columns)
Parameters:
format - CSV or JSON.
entityName - Filter entities by entity name. Support wildcards and expressions.
metricName - Metric name.
tags - entity tags
startTime - start of the selection interval. Specified in UNIX milliseconds.
endTime - end of the selection interval. Specified in UNIX milliseconds.
period - Duration of regular time period for grouping raw values. Specified as count timeunit, for example, 1 hour.
aggregateType - Statistical function to compute aggregated values for values in each period
limit - maximum number of data samples returned. Default value: 0
last - Performs GET instead of scan. Retrieves only 1 most recent value. Boolean. Default value: false
columns - Specify which columns must be included. Possible values: time, date (time in ISO), entity, metric, t:{name}, value. Default: time, entity, metric, requested tag names, value
Returns:
Series in specified format as InputStream.

retrieveProperties

public List<Property> retrieveProperties(GetPropertiesQuery getPropertiesQuery,
                                         GetPropertiesQuery... getPropertiesQueries)
Parameters:
getPropertiesQuery - command with property filter parameters
Returns:
list of Property

retrieveProperties

public List<Property> retrieveProperties(String entityName,
                                         String typeName)
Parameters:
entityName - entity name
typeName - property type name
Returns:
properties for entity and type

insertProperties

public boolean insertProperties(Property... properties)
Parameters:
properties - list of Property to add.
Returns:
true if success

batchUpdateProperties

public boolean batchUpdateProperties(BatchPropertyCommand... batchPropertyCommands)
Parameters:
batchPropertyCommands - list of batch commands to mass update properties
Returns:
true if success

retrieveAlerts

public List<Alert> retrieveAlerts(List<String> metricNames,
                                  List<String> entityNames,
                                  List<String> ruleNames,
                                  List<Integer> severityIds,
                                  Integer minSeverityId)
Parameters:
metricNames - metric filter, multiple values allowed
entityNames - entity filter, multiple values allowed
ruleNames - rule filter, multiple values allowed
severityIds - severity filter, multiple values allowed
minSeverityId - minimal severity filter
Returns:
list of Alert

retrieveAlerts

public List<Alert> retrieveAlerts(GetAlertQuery alertQuery,
                                  GetAlertQuery... alertQueries)

retrieveAlertHistory

public List<AlertHistory> retrieveAlertHistory(GetAlertHistoryQuery getAlertHistoryQuery,
                                               GetAlertHistoryQuery... getAlertHistoryQueries)
Parameters:
getAlertHistoryQuery - command with alert history selection details
Returns:
list of AlertHistory

batchUpdateAlerts

public boolean batchUpdateAlerts(BatchAlertCommand... commands)

sendPlainCommand

public void sendPlainCommand(PlainCommand plainCommand)
                      throws AtsdClientException,
                             AtsdServerException
Throws:
AtsdClientException
AtsdServerException

canSendPlainCommand

public boolean canSendPlainCommand()

removeSavedPlainCommands

public List<String> removeSavedPlainCommands()


Copyright © 2015. All rights reserved.