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 ( UserAuthentication AuthenticationMethod 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 Ping(timeout time.Duration) (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. Query(q Query) (*Response, error) // Close releases any resources a Client may be using. Close() error }
Client is a HTTPClient interface for writing & querying the database
type ClientCreator ¶
type ClientCreator struct{}
Simple type to create github.com/influxdata/kapacitor/influxdb clients.
func (ClientCreator) Create ¶
func (ClientCreator) Create(config HTTPConfig) (Client, error)
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 as the fields are all read-only once the HTTPClient is instantiated.
func NewHTTPClient ¶
func NewHTTPClient(conf HTTPConfig) (*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
Close releases the HTTPClient's resources.
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) SetToken ¶
func (c *HTTPClient) SetToken(token string)
func (*HTTPClient) Write ¶
func (c *HTTPClient) Write(bp BatchPoints) error
type HTTPConfig ¶
type HTTPConfig struct { // The URL of the InfluxDB server. URL string // Optional credentials for authenticating with the server. Credentials *Credentials // UserAgent is the http User Agent, defaults to "KapacitorInfluxDBClient" UserAgent string // Timeout for influxdb writes, defaults to no timeout Timeout time.Duration // InsecureSkipVerify gets passed to the http HTTPClient, if true, it will // skip https certificate verification. Defaults to false InsecureSkipVerify bool // TLSConfig allows the user to set their own TLS config for the HTTP // Client. If set, this option overrides InsecureSkipVerify. TLSConfig *tls.Config }
HTTPConfig is the config data needed to create an HTTP Client