Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationMethod ¶
type AuthenticationMethod int
AuthenticationMethod defines the type of authentication used.
const ( NoAuthentication AuthenticationMethod = iota UserAuthentication BearerAuthentication )
Supported authentication methods.
type BatchPoints ¶
type BatchPoints interface { // AddPoint adds the given point to the Batch of points AddPoint(p Point) // AddPoints adds the given points to the Batch of points AddPoints(ps []Point) // Points lists the points in the Batch Points() []Point // Precision returns the currently set precision of this Batch Precision() string // SetPrecision sets the precision of this batch. SetPrecision(s string) error // Database returns the currently set database of this Batch Database() string // SetDatabase sets the database of this Batch SetDatabase(s string) // WriteConsistency returns the currently set write consistency of this Batch WriteConsistency() string // SetWriteConsistency sets the write consistency of this Batch SetWriteConsistency(s string) // RetentionPolicy returns the currently set retention policy of this Batch RetentionPolicy() string // SetRetentionPolicy sets the retention policy of this Batch SetRetentionPolicy(s string) }
BatchPoints is an interface into a batched grouping of points to write into InfluxDB together. BatchPoints is NOT thread-safe, you must create a separate batch for each goroutine.
func NewBatchPoints ¶
func NewBatchPoints(conf BatchPointsConfig) (BatchPoints, error)
NewBatchPoints returns a BatchPoints interface based on the given config.
type BatchPointsConfig ¶
type BatchPointsConfig struct { // Precision is the write precision of the points, defaults to "ns" Precision string // Database is the database to write points to Database string // RetentionPolicy is the retention policy of the points RetentionPolicy string // Write consistency is the number of servers required to confirm write WriteConsistency string }
BatchPointsConfig is the config data needed to create an instance of the BatchPoints struct
type Client ¶
type Client interface { // Ping checks that status of cluster // The provided context can be used to cancel the request. Ping(ctx context.Context) (time.Duration, string, error) // Write takes a BatchPoints object and writes all Points to InfluxDB. Write(bp BatchPoints) error // Query makes an InfluxDB Query on the database. // The response is checked for an error and the is returned // if it exists Query(q Query) (*Response, error) }
Client is an interface for writing to and querying from an InfluxDB instance.
type ClientCreator ¶
type ClientCreator struct{}
Simple type to create github.com/influxdata/kapacitor/influxdb clients.
func (ClientCreator) Create ¶
func (ClientCreator) Create(config Config) (ClientUpdater, error)
type ClientUpdater ¶ added in v1.1.0
type Config ¶ added in v1.1.0
type Config struct { // The URL of the InfluxDB server. URLs []string // Optional credentials for authenticating with the server. Credentials Credentials // UserAgent is the http User Agent, defaults to "KapacitorInfluxDBClient" UserAgent string // Timeout for requests, defaults to no timeout. Timeout time.Duration // Transport is the HTTP transport to use for requests // If nil, a default transport will be used. Transport *http.Transport }
HTTPConfig is the config data needed to create an HTTP Client
type Credentials ¶
type Credentials struct { Method AuthenticationMethod Username string Password string Token string }
Set of credentials depending on the authentication method
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient is safe for concurrent use.
func NewHTTPClient ¶
func NewHTTPClient(conf Config) (*HTTPClient, error)
NewHTTPClient returns a new Client from the provided config. Client is safe for concurrent use by multiple goroutines.
func (*HTTPClient) Close ¶
func (c *HTTPClient) Close() error
func (*HTTPClient) Ping ¶
Ping will check to see if the server is up with an optional timeout on waiting for leader. Ping returns how long the request took, the version of the server it connected to, and an error if one occurred.
func (*HTTPClient) Query ¶
func (c *HTTPClient) Query(q Query) (*Response, error)
Query sends a command to the server and returns the Response
func (*HTTPClient) Update ¶ added in v1.1.0
func (c *HTTPClient) Update(new Config) error
UpdateURLs updates the running list of URLs.
func (*HTTPClient) Write ¶
func (c *HTTPClient) Write(bp BatchPoints) error