serialize

package
v0.0.0-...-a552c4f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MongoPointAddFields

func MongoPointAddFields(builder *flatbuffers.Builder, fields flatbuffers.UOffsetT)

func MongoPointAddMeasurementName

func MongoPointAddMeasurementName(builder *flatbuffers.Builder, measurementName flatbuffers.UOffsetT)

func MongoPointAddTags

func MongoPointAddTags(builder *flatbuffers.Builder, tags flatbuffers.UOffsetT)

func MongoPointAddTimestamp

func MongoPointAddTimestamp(builder *flatbuffers.Builder, timestamp int64)

func MongoPointEnd

func MongoPointEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT

func MongoPointStart

func MongoPointStart(builder *flatbuffers.Builder)

func MongoPointStartFieldsVector

func MongoPointStartFieldsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT

func MongoPointStartTagsVector

func MongoPointStartTagsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT

func MongoReadingAddKey

func MongoReadingAddKey(builder *flatbuffers.Builder, key flatbuffers.UOffsetT)

func MongoReadingAddValue

func MongoReadingAddValue(builder *flatbuffers.Builder, value float64)

func MongoReadingEnd

func MongoReadingEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT

func MongoReadingStart

func MongoReadingStart(builder *flatbuffers.Builder)

func MongoTagAddKey

func MongoTagAddKey(builder *flatbuffers.Builder, key flatbuffers.UOffsetT)

func MongoTagAddValue

func MongoTagAddValue(builder *flatbuffers.Builder, value flatbuffers.UOffsetT)

func MongoTagEnd

func MongoTagEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT

func MongoTagStart

func MongoTagStart(builder *flatbuffers.Builder)

Types

type CassandraSerializer

type CassandraSerializer struct{}

CassandraSerializer writes a Point in a serialized form for Cassandra

func (*CassandraSerializer) Serialize

func (s *CassandraSerializer) Serialize(p *Point, w io.Writer) (err error)

Serialize writes Point data to the given writer, conforming to the Cassandra format.

This function writes output that looks like: series_double,cpu,hostname=host_0,region=eu-west-1,datacenter=eu-west-1b,rack=67,os=Ubuntu16.10,arch=x86,team=NYC,service=7,service_version=0,service_environment=production,usage_guest_nice,2016-01-01,1451606400000000000,38.2431182911542820

Which the loader will decode into a statement that looks like this: INSERT INTO series_double(series_id,timestamp_ns,value) VALUES('cpu,hostname=host_0,region=eu-west-1,datacenter=eu-west-1b,rack=67,os=Ubuntu16.10,arch=x86,team=NYC,service=7,service_version=0,service_environment=production#usage_guest_nice#2016-01-01', 1451606400000000000, 38.2431182911542820)

type InfluxSerializer

type InfluxSerializer struct{}

InfluxSerializer writes a Point in a serialized form for MongoDB

func (*InfluxSerializer) Serialize

func (s *InfluxSerializer) Serialize(p *Point, w io.Writer) (err error)

Serialize writes Point data to the given writer, conforming to the InfluxDB wire protocol.

This function writes output that looks like: <measurement>,<tag key>=<tag value> <field name>=<field value> <timestamp>\n

For example: foo,tag0=bar baz=-1.0 100\n

type MongoPoint

type MongoPoint struct {
	// contains filtered or unexported fields
}

func GetRootAsMongoPoint

func GetRootAsMongoPoint(buf []byte, offset flatbuffers.UOffsetT) *MongoPoint

func (*MongoPoint) Fields

func (rcv *MongoPoint) Fields(obj *MongoReading, j int) bool

func (*MongoPoint) FieldsLength

func (rcv *MongoPoint) FieldsLength() int

func (*MongoPoint) Init

func (rcv *MongoPoint) Init(buf []byte, i flatbuffers.UOffsetT)

func (*MongoPoint) MeasurementName

func (rcv *MongoPoint) MeasurementName() []byte

func (*MongoPoint) MutateTimestamp

func (rcv *MongoPoint) MutateTimestamp(n int64) bool

func (*MongoPoint) Table

func (rcv *MongoPoint) Table() flatbuffers.Table

func (*MongoPoint) Tags

func (rcv *MongoPoint) Tags(obj *MongoTag, j int) bool

func (*MongoPoint) TagsLength

func (rcv *MongoPoint) TagsLength() int

func (*MongoPoint) Timestamp

func (rcv *MongoPoint) Timestamp() int64

type MongoReading

type MongoReading struct {
	// contains filtered or unexported fields
}

func GetRootAsMongoReading

func GetRootAsMongoReading(buf []byte, offset flatbuffers.UOffsetT) *MongoReading

func (*MongoReading) Init

func (rcv *MongoReading) Init(buf []byte, i flatbuffers.UOffsetT)

func (*MongoReading) Key

func (rcv *MongoReading) Key() []byte

func (*MongoReading) MutateValue

func (rcv *MongoReading) MutateValue(n float64) bool

func (*MongoReading) Table

func (rcv *MongoReading) Table() flatbuffers.Table

func (*MongoReading) Value

func (rcv *MongoReading) Value() float64

type MongoSerializer

type MongoSerializer struct{}

MongoSerializer writes a Point in a serialized form for MongoDB

func (*MongoSerializer) Serialize

func (s *MongoSerializer) Serialize(p *Point, w io.Writer) (err error)

Serialize writes Point data to the given Writer, using basic gob encoding

type MongoTag

type MongoTag struct {
	// contains filtered or unexported fields
}

func GetRootAsMongoTag

func GetRootAsMongoTag(buf []byte, offset flatbuffers.UOffsetT) *MongoTag

func (*MongoTag) Init

func (rcv *MongoTag) Init(buf []byte, i flatbuffers.UOffsetT)

func (*MongoTag) Key

func (rcv *MongoTag) Key() []byte

func (*MongoTag) Table

func (rcv *MongoTag) Table() flatbuffers.Table

func (*MongoTag) Value

func (rcv *MongoTag) Value() []byte

type Point

type Point struct {
	// contains filtered or unexported fields
}

Point wraps a single data point. It stores database-agnostic data representing one point in time of one measurement.

Internally, Point uses byte slices instead of strings to try to minimize overhead.

func NewPoint

func NewPoint() *Point

NewPoint returns a new empty Point

func (*Point) AppendField

func (p *Point) AppendField(key []byte, value interface{})

AppendField adds a field with a given key and value to this data point

func (*Point) AppendTag

func (p *Point) AppendTag(key, value []byte)

AppendTag adds a tag with a given key and value to this data point

func (*Point) FieldKeys

func (p *Point) FieldKeys() [][]byte

FieldKeys returns the Point's field keys

func (*Point) GetFieldValue

func (p *Point) GetFieldValue(key []byte) interface{}

GetFieldValue returns the corresponding value for a given field key or nil if it does not exist. This will panic if the internal state has been altered to not have the same number of field keys as field values.

func (*Point) GetTagValue

func (p *Point) GetTagValue(key []byte) []byte

GetTagValue returns the corresponding value for a given tag key or nil if it does not exist. This will panic if the internal state has been altered to not have the same number of tag keys as tag values.

func (*Point) MeasurementName

func (p *Point) MeasurementName() []byte

MeasurementName returns the name of the Point's measurement

func (*Point) Reset

func (p *Point) Reset()

Reset clears all information from this Point so it can be reused.

func (*Point) SetMeasurementName

func (p *Point) SetMeasurementName(s []byte)

SetMeasurementName sets the name of the measurement for this data point

func (*Point) SetTimestamp

func (p *Point) SetTimestamp(t *time.Time)

SetTimestamp sets the Timestamp for this data point

type PointSerializer

type PointSerializer interface {
	Serialize(p *Point, w io.Writer) error
}

PointSerializer serializes a Point for writing

type RedisTimeSeriesSerializer

type RedisTimeSeriesSerializer struct{}

RedisTimeSeriesSerializer writes a Point in a serialized form for RedisTimeSeries

func (*RedisTimeSeriesSerializer) Serialize

func (s *RedisTimeSeriesSerializer) Serialize(p *Point, w io.Writer) (err error)

Serialize writes Point data to the given writer, in a format that will be easy to create a redis-timeseries command from.

This function writes output that looks like: cpu_usage_user{hostname=host_0|region=eu-central-1...} 1451606400000000000 58 LABELS hostname host_0 region eu-central-1 ... measurement cpu fieldname usage_user

Which the loader will decode into a set of TS.ADD commands for each fieldKey.

type SiriDBSerializer

type SiriDBSerializer struct{}

SiriDBSerializer writes a Point in a serialized form for SiriDB

func (*SiriDBSerializer) Serialize

func (s *SiriDBSerializer) Serialize(p *Point, w io.Writer) error

Serialize writes Point data to the given writer.

The format is is serialized in such a way that a known number of bytes acting as a header indicate the number of bytes of content that will follow.

The first 8 bytes are reserved for the main header that is filled at the end of the script. 4 bytes of this are for number of metrics and 4 bytes for the length of the measuremnt name and tags.

There are also sub headers of 8 bytes reserved for every data point that are filled in later. 4 bytes for the length of the field key and 4 bytes for the length of the packed data (timestamp and value).

The output looks like this: <number of metrics> <length of name and tags> <name and tags> <length of field key_1> <length of timestamp_1 and field value_1> <field key_1> <packed timestamp_1 and value_1> <length of field key_2> <length of timestamp_1 and field value_2> <field key_2> <packed timestamp_1 and value_2>... etc.

type TimescaleDBSerializer

type TimescaleDBSerializer struct{}

TimescaleDBSerializer writes a Point in a serialized form for TimescaleDB

func (*TimescaleDBSerializer) Serialize

func (s *TimescaleDBSerializer) Serialize(p *Point, w io.Writer) error

Serialize writes Point p to the given Writer w, so it can be loaded by the TimescaleDB loader. The format is CSV with two lines per Point, with the first row being the tags and the second row being the field values.

e.g., tags,<tag1>,<tag2>,<tag3>,... <measurement>,<timestamp>,<field1>,<field2>,<field3>,...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL