tsdb

package
v0.0.0-...-bd03ed3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package tsdb implements OpenTSDB protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(s string) string

Clean inserts underscore in place of any character that is not storable in the database. Must be applied for any externally-provided metric name, tag key, or tag value.

Note that Clean being a surjective function may cause data conflicts.

func Tick

func Tick(d time.Duration) <-chan time.Time

Types

type Chan

type Chan <-chan *Point

Chan represents a Series backed by an ordinary channel.

func (Chan) Next

func (ch Chan) Next() *Point

Next implements the Next method of the Series interface.

type Client

type Client struct {
	Dial func(string) (net.Conn, error)
	// contains filtered or unexported fields
}

Client represents a connection pool to the TSDB server.

func NewClient

func NewClient(hosts string, config *ClientConfig) *Client

NewClient returns a TSDB client. The client supervises internal connection pool. Network errors are handled by re-connecting with exponential backoff.

func (*Client) Put

func (c *Client) Put(point *Point)

Put writes a data point to the server. It never blocks on I/O.

func (*Client) Queue

func (c *Client) Queue() <-chan cmd

Queue returns the client queue. It's exposed as receive-only to enable only metrics gathering (length, capacity).

type ClientConfig

type ClientConfig struct {
	DropRepeats     bool
	MaxConnsPerHost int
	// The slice is valid only for the duration of the Drop call.
	Drop func([]byte)
}

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode() (*Point, error)

Decode decodes the next data point from the input. SyntaxError will be returned if an invalid point is encountered. Decoder is valid for use despite syntax errors: it can resynchronise.

func (*Decoder) DisableOrderCheck

func (d *Decoder) DisableOrderCheck()

DisableOrderCheck disables the expensive time series order check. Useful if the stream can be expected to be already time-ordered.

type Encoder

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

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(p *Point) error

type Point

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

func NewPoint

func NewPoint(time time.Time, value interface{}, metric string, keyval ...string) (*Point, error)

NewPoint accepts any numeric or string value.

func (*Point) Copy

func (p *Point) Copy() *Point

func (*Point) Equal

func (p *Point) Equal(q *Point) bool

func (*Point) Free

func (p *Point) Free()

Free returns Point's memory into an internal free list. Free is safe to call after a final Encode or Put.

func (*Point) Metric

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

func (*Point) SetMetric

func (p *Point) SetMetric(s []byte) error

func (*Point) SetTags

func (p *Point) SetTags(keyval ...[]byte) error

func (*Point) SetValue

func (p *Point) SetValue(value interface{}) error

func (*Point) String

func (p *Point) String() string

func (*Point) Tag

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

Tag returns the value associated with the given tag key. It returns an nil slice if tag was not found.

func (*Point) Tags

func (p *Point) Tags() []string

func (*Point) Time

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

func (*Point) Value

func (p *Point) Value() interface{}

func (*Point) XAppendTags

func (p *Point) XAppendTags(nameval ...string) error

type Series

type Series interface {
	Next() *Point
}

Series represents an infinite sequence of data points.

func Join

func Join(a, b Chan) Series

Join returns a time series that combines data points from the given channels.

type SyntaxError

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

A SyntaxError signals a syntax error in the TSDB input stream.

type Ticker

type Ticker struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

A Ticker holds a channel that delivers `ticks' of a clock at intervals.

func NewTicker

func NewTicker(d time.Duration) *Ticker

NewTicker acts like time.NewTicker except the ticks are specially aligned in time so that the risk of generating overlapping data points is minimised. The ticks' clock resolution is reduced to 1 second, the maximum supported by TSDB.

func (*Ticker) Stop

func (t *Ticker) Stop()

Notes

Bugs

  • Millisecond resolution is accepted by Decode and NewPoint, but lost by Encode and Put.

Directories

Path Synopsis
Package filter implements a message filter that may modify or block points.
Package filter implements a message filter that may modify or block points.

Jump to

Keyboard shortcuts

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