Class HttpClient

    • Constructor Detail

      • HttpClient

        public HttpClient​(org.apache.http.impl.client.HttpClientBuilder builder,
                          String url)
                   throws MalformedURLException
        Creates a client to talk to the host on the specified port. This version of the constructor exposes the HttpClientBuilder that can be used to set various properties on the client.
        Parameters:
        builder - client builder.
        url - url to the KairosDB server
        Throws:
        MalformedURLException - if the url is malformed
    • Method Detail

      • registerCustomDataType

        public void registerCustomDataType​(String groupType,
                                           Class dataPointClass)
        Description copied from interface: Client
        Registers a new custom data type. The assumption is that this data type already exists on the server. The dataPointValueClass is used to serialize and deserialize the custom type. This is simply a POJO.
        Specified by:
        registerCustomDataType in interface Client
        Parameters:
        groupType - type used to deserialize the json on the client
        dataPointClass - class that is the value of a data point
      • getDataPointValueClass

        public Class getDataPointValueClass​(String groupType)
        Description copied from interface: Client
        Returns the data point value class for the given group type or null if one is not registered for the group type
        Specified by:
        getDataPointValueClass in interface Client
        Parameters:
        groupType - group type
        Returns:
        data point class associated with the group type
      • createRollupTask

        public RollupTask createRollupTask​(RollupBuilder builder)
        Description copied from interface: Client
        Create a new roll-up.
        Specified by:
        createRollupTask in interface Client
        Parameters:
        builder - roll-up builder
        Returns:
        newly created roll-up task
      • getRollupTasks

        public List<RollupTask> getRollupTasks()
        Description copied from interface: Client
        Returns a list of all roll-up tasks.
        Specified by:
        getRollupTasks in interface Client
        Returns:
        list of roll-up tasks
      • getRollupTask

        public RollupTask getRollupTask​(String id)
        Description copied from interface: Client
        Returns the roll-up.
        Specified by:
        getRollupTask in interface Client
        Parameters:
        id - roll-up identifier
        Returns:
        roll-up or null if no roll-ups match the specified identifier
      • deleteRollupTask

        public void deleteRollupTask​(String id)
        Description copied from interface: Client
        Delete the roll-up. Throws an exception if the delete fails.
        Specified by:
        deleteRollupTask in interface Client
        Parameters:
        id - identifier of the roll-up
      • getMetricNames

        public List<String> getMetricNames()
        Description copied from interface: Client
        Returns a list of all metric names.
        Specified by:
        getMetricNames in interface Client
        Returns:
        list of all metric names
      • getStatus

        public List<String> getStatus()
        Description copied from interface: Client
        Returns status of Kairos Instance.
        Specified by:
        getStatus in interface Client
        Returns:
        status of Kairos instance
      • getStatusCheck

        public int getStatusCheck()
        Description copied from interface: Client
        Returns a status code fo 204 if all is healthy.
        Specified by:
        getStatusCheck in interface Client
        Returns:
        status of Kairos instance
      • getVersion

        public String getVersion()
        Description copied from interface: Client
        Returns the version string for the KairosDB server.
        Specified by:
        getVersion in interface Client
        Returns:
        KairosDB version
      • query

        public <T> T query​(QueryBuilder builder,
                           JsonResponseHandler<T> handler)
        Description copied from interface: Client
        Queries KairosDB using the query built by the builder.
        Specified by:
        query in interface Client
        Parameters:
        builder - query builder
        handler - response handler
        Returns:
        query response
      • query

        public QueryResponse query​(QueryBuilder builder)
        Description copied from interface: Client
        Queries KairosDB using the query built by the builder.
        Specified by:
        query in interface Client
        Parameters:
        builder - query builder
        Returns:
        query response
      • queryTags

        public QueryTagResponse queryTags​(QueryTagBuilder builder)
        Description copied from interface: Client
        Queries KairosDB tags using the query built by the builder.
        Specified by:
        queryTags in interface Client
        Parameters:
        builder - query tag builder
        Returns:
        query response
      • queryTags

        public <T> T queryTags​(QueryTagBuilder builder,
                               JsonResponseHandler<T> handler)
        Description copied from interface: Client
        Queries KairosDB tags using the query built by the builder.
        Specified by:
        queryTags in interface Client
        Parameters:
        builder - query tag builder
        Returns:
        query response
      • pushMetrics

        public void pushMetrics​(MetricBuilder builder)
        Description copied from interface: Client
        Sends metrics from the builder to the KairosDB server.
        Specified by:
        pushMetrics in interface Client
        Parameters:
        builder - metrics builder
      • deleteMetric

        public void deleteMetric​(String name)
        Description copied from interface: Client
        Deletes a metric. This is the metric and all its data points. An exception is thrown if this operation fails.
        Specified by:
        deleteMetric in interface Client
        Parameters:
        name - the metric to delete
      • delete

        public void delete​(QueryBuilder builder)
        Description copied from interface: Client
        Deletes data in KairosDB using the query built by the builder. An exception is thrown if this operation fails.
        Specified by:
        delete in interface Client
        Parameters:
        builder - query builder