Documentation ¶
Index ¶
- type AuthenticationMethod
- type BatchPoints
- type BatchPointsConfig
- type Client
- type ClientCreator
- type ClientUpdater
- type Config
- type Credentials
- type Diagnostic
- type FluxCSVEventHandler
- type FluxCSVEventParser
- type FluxQuery
- type FluxTableMetaData
- type FluxWrite
- type HTTPClient
- func (c *HTTPClient) Close() error
- func (c *HTTPClient) Ping(ctx context.Context) (time.Duration, string, error)
- func (c *HTTPClient) Query(q Query) (*Response, error)
- func (c *HTTPClient) QueryFlux(q FluxQuery) (flux.ResultIterator, error)
- func (c *HTTPClient) QueryFluxResponse(q FluxQuery) (*Response, error)
- func (c *HTTPClient) Update(new Config) error
- func (c *HTTPClient) Write(bp BatchPoints) error
- func (c *HTTPClient) WriteV2(w FluxWrite) error
- type Message
- type Point
- type Query
- type Response
- type Result
- type TokenClientCreator
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 TokenAuthentication // like bearer authentication but with the word Token )
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 // WriteV2 takes a FluxWrite object and writes all Points to InfluxDB using the V2 interface. WriteV2(w FluxWrite) 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) // QueryFlux is for querying Influxdb with the Flux language // The response is checked for an error and the is returned // if it exists QueryFlux(q FluxQuery) (flux.ResultIterator, error) // QueryFlux is for querying Influxdb with the Flux language // The response is checked for an error and the is returned // if it exists. Unlike QueryFlux, this returns a *Response // object. QueryFluxResponse(q FluxQuery) (*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 // Which compression should we use for writing to influxdb, defaults to "gzip". Compression string }
HTTPConfig is the config data needed to create an HTTP Client
type Credentials ¶
type Credentials struct { Method AuthenticationMethod // UserAuthentication fields Username string Password string // TokenAuthentication fields Token string HttpSharedSecret bool }
Set of credentials depending on the authentication method
type Diagnostic ¶ added in v1.6.0
type FluxCSVEventHandler ¶ added in v1.6.0
type FluxCSVEventHandler interface { // Error event represents a ',error' table in the flux result, which is special Error(err string) // GroupStart gives the metadata for a new group of tables GroupStart(names []string, types []string, groups []bool) // TableStart marks the start of a table TableStart(meta FluxTableMetaData, firstRow []string) // DataRow is called for each regular data row DataRow(meta FluxTableMetaData, row []string) // TableEnd marks the end of a table TableEnd() }
type FluxCSVEventParser ¶ added in v1.6.0
type FluxCSVEventParser struct {
// contains filtered or unexported fields
}
FluxCSVEventParser is an event-based parser for flux csv it assumes a csv dialect with Annotations: []string{"datatype", "group"}, Delimiter: ",", Header: true,
func NewFluxCSVEventParser ¶ added in v1.6.0
func NewFluxCSVEventParser(r io.Reader, handler FluxCSVEventHandler) *FluxCSVEventParser
func (*FluxCSVEventParser) Parse ¶ added in v1.6.0
func (q *FluxCSVEventParser) Parse() error
type FluxTableMetaData ¶ added in v1.6.0
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) QueryFlux ¶ added in v1.6.0
func (c *HTTPClient) QueryFlux(q FluxQuery) (flux.ResultIterator, error)
func (*HTTPClient) QueryFluxResponse ¶ added in v1.6.0
func (c *HTTPClient) QueryFluxResponse(q FluxQuery) (*Response, error)
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
func (*HTTPClient) WriteV2 ¶ added in v1.6.0
func (c *HTTPClient) WriteV2(w FluxWrite) error
type Point ¶
type Point struct { Name string Tags map[string]string Fields map[string]interface{} Time time.Time }
func (Point) BytesWithLineFeed ¶ added in v1.5.9
type Response ¶
Response represents a list of statement results.
func NewFluxQueryResponse ¶ added in v1.6.0
type TokenClientCreator ¶ added in v1.6.0
type TokenClientCreator struct {
// contains filtered or unexported fields
}
func NewTokenClientCreator ¶ added in v1.6.0
func NewTokenClientCreator(httpSharedSecret []byte, tokenDuration time.Duration, d Diagnostic) *TokenClientCreator
func (*TokenClientCreator) Create ¶ added in v1.6.0
func (cc *TokenClientCreator) Create(config Config) (ClientUpdater, error)