package
0.9.4
Repository: https://github.com/skia-dev/influxdb.git
Documentation: pkg.go.dev

# README

Line Protocol

The line protocol is a text based format for writing points to InfluxDB. Each line defines a single point. Multiple lines must be separated by the newline character \n. The format of the line consists of three parts:

[key] [fields] [timestamp]

Each section is separated by spaces. The minimum required point consists of a measurement name and at least one field. Points without a specified timestamp will be written using the server's local timestamp. Timestamps are assumed to be in nanoseconds unless a precision value is passed in the query string.

Key

The key is the measurement name and any optional tags separated by commas. Measurement names, tag keys, and tag values must escape any spaces or commas using a backslash (\). For example: \ and \,. All tag values are stored as strings and should not be surrounded in quotes.

Tags should be sorted by key before being sent for best performance. The sort should match that from the Go bytes.Compare function (http://golang.org/pkg/bytes/#Compare).

Examples

# measurement only
cpu

# measurment and tags
cpu,host=serverA,region=us-west

# measurment with commas
cpu\,01,host=serverA,region=us-west

# tag value with spaces
cpu,host=server\ A,region=us\ west

Fields

Fields are key-value metrics associated with the measurement. Every line must have at least one field. Multiple fields must be separated with commas and not spaces.

Field keys are always strings and follow the same syntactical rules as described above for tag keys and values. Field values can be one of four types. The first value written for a given field on a given measurement defines the type of that field for all series under that measurement.

  • integer - Numeric values that do not include a decimal and are followed by a trailing i when inserted (e.g. 1i, 345i, 2015i, -10i). Note that all values must have a trailing i. If they do not they will be written as floats.
  • float - Numeric values tha are not followed by a trailing i. (e.g. 1, 1.0, -3.14, 6.0+e5, 10).
  • boolean - A value indicating true or false. Valid boolean strings are (t, T, true, TRUE, f, F, false, and FALSE).
  • string - A text value. All string values must be surrounded in double-quotes ". If the string contains a double-quote or backslashes, it must be escaped with a backslash, e.g. \", \\.
# integer value
cpu value=1i

cpu value=1.1i # will result in a parse error

# float value
cpu_load value=1

cpu_load value=1.0

cpu_load value=1.2

# boolean value
error fatal=true

# string value
event msg="logged out"

# multiple values
cpu load=10,alert=true,reason="value above maximum threshold"

Timestamp

The timestamp section is optional but should be specified if possible. The value is an integer representing nanoseconds since the epoch. If the timestamp is not provided the point will inherit the server's local timestamp.

Some write APIs allow passing a lower precision. If the API supports a lower precision, the timestamp may also be an integer epoch in microseconds, milliseconds, seconds, minutes or hours.

Full Example

A full example is shown below.

cpu,host=server01,region=uswest value=1 1434055562000000000
cpu,host=server02,region=uswest value=3 1434055562000010000

In this example the first line shows a measurement of "cpu", there are two tags "host" and "region, the value is 1.0, and the timestamp is 1434055562000000000. Following this is a second line, also a point in the measurement "cpu" but belonging to a different "host".

cpu,host=server\ 01,region=uswest value=1,msg="all systems nominal"
cpu,host=server\ 01,region=us\,west value_int=1i

In these examples, the "host" is set to server 01. The field value associated with field key msg is double-quoted, as it is a string. The second example shows a region of us,west with the comma properly escaped. In the first example value is written as a floating point number. In the second, value_int is an integer.

Distributed Queries

# Packages

No description provided by the author

# Functions

DedupeEntries returns slices with unique keys (the first 8 bytes).
No description provided by the author
No description provided by the author
IsRetryable returns true if this error is temporary and could be retried.
No description provided by the author
used to convert the tag set to bytes for use as a lookup key.
No description provided by the author
MultiCursor returns a single cursor that combines the results of all cursors in order.
No description provided by the author
No description provided by the author
NewEngine returns an instance of an engine based on its format.
NewEngineOptions returns the default options.
newAuthorizationError returns a new instance of AuthorizationError.
NewFieldCodec returns a FieldCodec for the given Measurement.
NewMeasurement allocates and initializes a new Measurement.
NewPoint returns a new point with the given measurement name, tags, fields and timestamp.
NewPointBatcher returns a new PointBatcher.
NewQueryExecutor returns an initialized QueryExecutor.
NewSelectExecutor returns a new SelectExecutor.
NewSelectMapper returns a mapper for the given shard, which will return data for the SELECT statement.
NewSeries returns an initialized series struct.
NewShard returns a new initialized Shard.
NewShowMeasurementsExecutor returns a new ShowMeasurementsExecutor.
NewShowMeasurementsMapper returns a mapper for the given shard, which will return data for the meta statement.
NewSnapshotWriter returns a new snapshot.Writer that will write metadata and the store's shards to an archive.
No description provided by the author
NopWriteToCloser returns an io.WriterTo that implements io.Closer.
ParsePoints returns a slice of Points from a text representation of a point with each point separated by newlines.
No description provided by the author
No description provided by the author
ProcessAggregateDerivative returns the derivatives of an aggregate result set.
RegisterEngine registers a storage engine initializer by name.

# Constants

DefaultCompactionThreshold flush and compact a partition once this ratio of keys are over the flush size.
DefaultEngine is the default engine used by the shard when initializing.
DefaultFlushColdInterval specifies how long after a partition has been cold for writes that a full flush and compaction are forced.
DefaultMaxSeriesSize specifies the size at which a series will be forced to flush.
100MB.
20MB.
DefaultReadySeriesSize of 32KB specifies when a series is eligible to be flushed.
DefaultWALFlushInterval is the frequency the WAL will get flushed if it doesn't reach its size threshold.
DefaultWALPartitionFlushDelay is the sleep time between WAL partition flushes.
Forward indicates that a cursor will move forward over its values.
IgnoredChunkSize is what gets passed into Mapper.Begin for aggregate queries as they don't chunk points out.
Return an error if the user is trying to select more than this number of points in a group by statement.
Reverse indicates that a cursor will move backwards over its values.
Since time is always selected, the column count when selecting only a single other value will be 2.

# Variables

ErrFieldNotFound is returned when a field cannot be found.
ErrFieldOverflow is returned when too many fields are created on a measurement.
ErrFieldTypeConflict is returned when a new field already exists with a different type.
ErrFieldUnmappedID is returned when the system is presented, during decode, with a field ID there is no mapping for.
ErrFormatNotFound is returned when no format can be determined from a path.
ErrInvalidQuery is returned when executing an unknown query type.
ErrNotExecuted is returned when a statement is not executed in a query.
No description provided by the author

# Structs

No description provided by the author
DatabaseIndex is the in memory index of a collection of measurements, time series, and their tags.
EngineOptions represents the options used to initialize the engine.
ErrAuthorize represents an authorization error.
Field represents a series field.
FieldCodec provides encoding and decoding functionality for the fields of a given Measurement.
struct to hold information for a field to create on a measurement.
No description provided by the author
MapperValue is a complex type, which can encapsulate data from both raw and aggregate mappers.
Measurement represents a collection of time series in a database.
No description provided by the author
PointBatcher accepts Points and will emit a batch of those points when either a) the batch reaches a certain size, or b) a certain time passes.
PointBatcherStats are the statistics each batcher tracks.
QueryExecutor executes every statement in an influxdb Query.
No description provided by the author
No description provided by the author
SelectMapper is for retrieving data for a query, from a given shard.
Series belong to a Measurement and represent unique time series in a database.
struct to hold information for a series to create.
Shard represents a self-contained time series database.
ShowMeasurementsExecutor implements the Executor interface for a SHOW MEASUREMENTS statement.
ShowMeasurementsMapper is a mapper for collecting measurement names from a shard.
StatefulMapper encapsulates a Mapper and some state that the executor needs to track for that mapper.
No description provided by the author
TagFilter represents a tag filter when looking up other tags or measurements.

# Interfaces

Cursor represents an iterator over a series.
Engine represents a swappable storage engine for the shard.
Executor is an interface for a query executor.
Mapper is the interface all Mapper types must implement.
Point defines the values that will be written to the database.
Tx represents a transaction.

# Type aliases

No description provided by the author
Direction represents a cursor navigation direction.
No description provided by the author
No description provided by the author
Measurements represents a list of *Measurement.
NewEngineFunc creates a new engine.
Points represents a sortable list of points by timestamp.
SeriesIDs is a convenience type for sorting, checking equality, and doing union and intersection of collections of series ids.
No description provided by the author