Documentation ¶
Overview ¶
Package write provides the Point struct
Index ¶
- func PointToLineProtocol(p *Point, precision time.Duration) string
- func PointToLineProtocolBuffer(p *Point, sb *strings.Builder, precision time.Duration)
- type Consistency
- type Options
- func (o *Options) AddDefaultTag(key, value string) *Options
- func (o *Options) BatchSize() uint
- func (o *Options) Consistency() Consistency
- func (o *Options) DefaultTags() map[string]string
- func (o *Options) ExponentialBase() uint
- func (o *Options) FlushInterval() uint
- func (o *Options) MaxRetries() uint
- func (o *Options) MaxRetryInterval() uint
- func (o *Options) MaxRetryTime() uint
- func (o *Options) Precision() time.Duration
- func (o *Options) RetryBufferLimit() uint
- func (o *Options) RetryInterval() uint
- func (o *Options) SetBatchSize(batchSize uint) *Options
- func (o *Options) SetConsistency(consistency Consistency) *Options
- func (o *Options) SetExponentialBase(retryExponentialBase uint) *Options
- func (o *Options) SetFlushInterval(flushIntervalMs uint) *Options
- func (o *Options) SetMaxRetries(maxRetries uint) *Options
- func (o *Options) SetMaxRetryInterval(maxRetryIntervalMs uint) *Options
- func (o *Options) SetMaxRetryTime(maxRetryTimeMs uint) *Options
- func (o *Options) SetPrecision(precision time.Duration) *Options
- func (o *Options) SetRetryBufferLimit(retryBufferLimit uint) *Options
- func (o *Options) SetRetryInterval(retryIntervalMs uint) *Options
- func (o *Options) SetUseGZip(useGZip bool) *Options
- func (o *Options) UseGZip() bool
- type Point
- func (m *Point) AddField(k string, v interface{}) *Point
- func (m *Point) AddTag(k, v string) *Point
- func (m *Point) FieldList() []*lp.Field
- func (m *Point) Name() string
- func (m *Point) SetTime(timestamp time.Time) *Point
- func (m *Point) SortFields() *Point
- func (m *Point) SortTags() *Point
- func (m *Point) TagList() []*lp.Tag
- func (m *Point) Time() time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PointToLineProtocol ¶
PointToLineProtocol creates InfluxDB line protocol string from the Point, converting associated timestamp according to precision
Types ¶
type Consistency ¶
type Consistency string
Consistency defines enum for allows consistency values for InfluxDB Enterprise, as explained https://docs.influxdata.com/enterprise_influxdb/v1.9/concepts/clustering/#write-consistency
const ( // ConsistencyOne requires at least one data node acknowledged a write. ConsistencyOne Consistency = "one" // ConsistencyAll requires all data nodes to acknowledge a write. ConsistencyAll Consistency = "all" // ConsistencyQuorum requires a quorum of data nodes to acknowledge a write. ConsistencyQuorum Consistency = "quorum" // ConsistencyAny allows for hinted hand off, potentially no write happened yet. ConsistencyAny Consistency = "any" )
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options holds write configuration properties
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions returns Options object with default values
func (*Options) AddDefaultTag ¶
AddDefaultTag adds a default tag. DefaultTags are added to each written point. If a tag with the same key already exist it is overwritten. If a point already defines such a tag, it is left unchanged.
func (*Options) Consistency ¶
func (o *Options) Consistency() Consistency
Consistency returns consistency for param value
func (*Options) DefaultTags ¶
DefaultTags returns set of default tags
func (*Options) ExponentialBase ¶
ExponentialBase returns the base for the exponential retry delay. Default 2.
func (*Options) FlushInterval ¶
FlushInterval returns flush interval in ms
func (*Options) MaxRetries ¶
MaxRetries returns maximum count of retry attempts of failed writes, default 5.
func (*Options) MaxRetryInterval ¶
MaxRetryInterval returns the maximum delay between each retry attempt in milliseconds, default 125,000.
func (*Options) MaxRetryTime ¶
MaxRetryTime returns the maximum total retry timeout in millisecond, default 180,000.
func (*Options) RetryBufferLimit ¶
RetryBufferLimit returns retry buffer limit.
func (*Options) RetryInterval ¶
RetryInterval returns the default retry interval in ms, if not sent by server. Default 5,000.
func (*Options) SetBatchSize ¶
SetBatchSize sets number of points sent in single request
func (*Options) SetConsistency ¶
func (o *Options) SetConsistency(consistency Consistency) *Options
SetConsistency allows setting InfluxDB Enterprise write consistency, as explained in https://docs.influxdata.com/enterprise_influxdb/v1.9/concepts/clustering/#write-consistency */
func (*Options) SetExponentialBase ¶
SetExponentialBase sets the base for the exponential retry delay.
func (*Options) SetFlushInterval ¶
SetFlushInterval sets flush interval in ms in which is buffer flushed if it has not been already written
func (*Options) SetMaxRetries ¶
SetMaxRetries sets maximum count of retry attempts of failed writes. Setting zero value disables retry strategy.
func (*Options) SetMaxRetryInterval ¶
SetMaxRetryInterval sets the maximum delay between each retry attempt in millisecond
func (*Options) SetMaxRetryTime ¶
SetMaxRetryTime sets the maximum total retry timeout in millisecond.
func (*Options) SetPrecision ¶
SetPrecision sets time precision to use in writes for timestamp. In unit of duration: time.Nanosecond, time.Microsecond, time.Millisecond, time.Second
func (*Options) SetRetryBufferLimit ¶
SetRetryBufferLimit sets maximum number of points to keep for retry. Should be multiple of BatchSize.
func (*Options) SetRetryInterval ¶
SetRetryInterval sets the time to wait before retry unsuccessful write in ms, if not sent by server
func (*Options) SetUseGZip ¶
SetUseGZip specifies whether to use GZip compression in write requests.
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point is represents InfluxDB time series point, holding tags and fields
func NewPoint ¶
func NewPoint( measurement string, tags map[string]string, fields map[string]interface{}, ts time.Time, ) *Point
NewPoint creates a Point from measurement name, tags, fields and a timestamp.
func NewPointWithMeasurement ¶
NewPointWithMeasurement creates a empty Point Use AddTag and AddField to fill point with data
func (*Point) SortFields ¶
SortFields orders the fields of a point alphanumerically by key.
func (*Point) SortTags ¶
SortTags orders the tags of a point alphanumerically by key. This is just here as a helper, to make it easy to keep tags sorted if you are creating a Point manually.