Version: v0.0.0-...-403286f Latest Latest

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

Go to latest
Published: Aug 3, 2016 License: Apache-2.0 Imports: 9 Imported by: 0



Package rrd does the thing ZZZ.



This section is empty.


This section is empty.


This section is empty.


type DSSpec

type DSSpec struct {
	Step      time.Duration
	Heartbeat time.Duration
	RRAs      []*RRASpec

type DataPoint

type DataPoint struct {
	DS        *DataSource
	Name      string
	TimeStamp time.Time
	Value     float64
	Hops      int

func (*DataPoint) GobDecode

func (dp *DataPoint) GobDecode(b []byte) error

func (*DataPoint) GobEncode

func (dp *DataPoint) GobEncode() ([]byte, error)

func (*DataPoint) Process

func (dp *DataPoint) Process() error

type DataSource

type DataSource struct {
	Id          int64                // Id
	Name        string               // Series name
	StepMs      int64                // Step Size in Ms
	HeartbeatMs int64                // Heartbeat in Ms (i.e. inactivity period longer than this causes NaN values)
	LastUpdate  time.Time            // Last time we received an update (series time - can be in the past or future)
	LastDs      float64              // Last final value we saw
	Value       float64              // Weighted value (e.g. f we are 2/3 way into a step, Value should be 2/3 of the final step value)
	UnknownMs   int64                // Ms of the data that is "unknown" (e.g. because of exceeded HB)
	RRAs        []*RoundRobinArchive // Array of Round Robin Archives
	LastFlushRT time.Time            // Last time this DS was flushed (actual real time).

func (*DataSource) BestRRA

func (ds *DataSource) BestRRA(start, end time.Time, points int64) *RoundRobinArchive

func (*DataSource) ClearRRAs

func (ds *DataSource) ClearRRAs(clearLU bool)

func (*DataSource) MostlyCopy

func (ds *DataSource) MostlyCopy() *DataSource

func (*DataSource) ShouldBeFlushed

func (ds *DataSource) ShouldBeFlushed(maxCachedPoints int, minCache, maxCache time.Duration) bool

type DataSourceNames

type DataSourceNames struct {
	// contains filtered or unexported fields

for Graphite-like listings

func (*DataSourceNames) DsIdsFromIdent

func (dsns *DataSourceNames) DsIdsFromIdent(ident string) map[string]int64

func (*DataSourceNames) FsFind

func (dsns *DataSourceNames) FsFind(pattern string) []*FsFindNode

func (*DataSourceNames) Reload

func (dsns *DataSourceNames) Reload(serde SerDe) error

type DataSources

type DataSources struct {
	// contains filtered or unexported fields

func (*DataSources) Delete

func (dss *DataSources) Delete(ds *DataSource)

This only deletes it from memory, it is still in the database.

func (*DataSources) GetById

func (dss *DataSources) GetById(id int64) *DataSource

func (*DataSources) GetByName

func (dss *DataSources) GetByName(name string) *DataSource

func (*DataSources) Insert

func (dss *DataSources) Insert(ds *DataSource)

func (*DataSources) List

func (dss *DataSources) List() []*DataSource

func (*DataSources) Reload

func (dss *DataSources) Reload(serde SerDe) error

type FsFindNode

type FsFindNode struct {
	Name string
	Leaf bool
	// contains filtered or unexported fields

type RRASpec

type RRASpec struct {
	Function string
	Step     time.Duration
	Size     time.Duration
	Xff      float64

type RoundRobinArchive

type RoundRobinArchive struct {
	Id          int64
	DsId        int64
	Cf          string
	StepsPerRow int32
	Size        int32
	Xff         float32
	Value       float64
	UnknownMs   int64
	Latest      time.Time
	DPs         map[int64]float64
	Width       int64
	Start       int64
	End         int64

func (*RoundRobinArchive) GetStartGivenEndMs

func (rra *RoundRobinArchive) GetStartGivenEndMs(ds *DataSource, timeMs int64) int64

func (*RoundRobinArchive) SlotRow

func (rra *RoundRobinArchive) SlotRow(slot int64) int64

func (*RoundRobinArchive) SlotTimeStamp

func (rra *RoundRobinArchive) SlotTimeStamp(ds *DataSource, slot int64) time.Time

type SerDe

type SerDe interface {
	// Create a DS with name, and/or return it
	CreateOrReturnDataSource(name string, dsSpec *DSSpec) (*DataSource, error)

	FetchDataSource(id int64) (*DataSource, error)
	FetchDataSources() ([]*DataSource, error)
	FetchDataSourceNames() (map[string]int64, error)
	// Flush a DS
	FlushDataSource(ds *DataSource) error
	// Query
	SeriesQuery(ds *DataSource, from, to time.Time, maxPoints int64) (Series, error)
	// Use the database to infer outside IPs of other connected clients
	ListDbClientIps() ([]string, error)
	MyDbAddr() (*string, error)

type Series

type Series interface {
	Next() bool
	Close() error

	CurrentValue() float64
	CurrentPosBeginsAfter() time.Time
	CurrentPosEndsOn() time.Time

	StepMs() int64
	GroupByMs(...int64) int64
	TimeRange(...time.Time) (time.Time, time.Time)
	LastUpdate() time.Time
	MaxPoints(...int64) int64

	Alias(...string) string

Source Files

Jump to

Keyboard shortcuts

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