Documentation ¶
Index ¶
- Constants
- func AppendMeasure(b []byte, t time.Time, m stats.Measure) []byte
- type Client
- func (*Client) AppendMeasures(b []byte, time time.Time, measures ...stats.Measure) []byte
- func (c *Client) Close() error
- func (c *Client) CreateDB(db string) error
- func (c *Client) Flush()
- func (c *Client) HandleMeasures(time time.Time, measures ...stats.Measure)
- func (s *Client) Write(b []byte) (n int, err error)
- type ClientConfig
Constants ¶
View Source
const ( // DefaultAddress is the default address to which the InfluxDB client tries // to connect to. DefaultAddress = "localhost:8086" // DefaultDatabase is the default database used by the InfluxDB client. DefaultDatabase = "stats" // DefaultBufferSize is the default size for batches of metrics sent to // InfluxDB. DefaultBufferSize = 2 * 1024 * 1024 // 2 MB // DefaultTimeout is the default timeout value used when sending requests to // InfluxDB. DefaultTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an InfluxDB client that implements the stats.Handler interface.
func NewClient ¶
NewClient creates and returns a new InfluxDB client publishing metrics to the server running at addr.
func NewClientWith ¶
func NewClientWith(config ClientConfig) *Client
NewClientWith creates and returns a new InfluxDB client configured with the given config.
func (*Client) AppendMeasures ¶
func (*Client) CreateDB ¶
CreateDB creates a database named db in the InfluxDB server that the client was configured to send metrics to.
func (*Client) HandleMeasures ¶
HandleMeasures satisfies the stats.Handler interface.
type ClientConfig ¶
type ClientConfig struct { // Address of the InfluxDB database to send metrics to. Address string // Name of the InfluxDB database to send metrics to. Database string // Maximum size of batch of events sent to InfluxDB. BufferSize int // Maximum amount of time that requests to InfluxDB may take. Timeout time.Duration // Transport configures the HTTP transport used by the client to send // requests to InfluxDB. By default http.DefaultTransport is used. Transport http.RoundTripper }
The ClientConfig type is used to configure InfluxDB clients.
Click to show internal directories.
Click to hide internal directories.