tsdb

package
v0.0.0-...-fe13f99 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: Apache-2.0 Imports: 3 Imported by: 27

Documentation

Overview

package tsdb contains the data structures for emulating the TSDB API. The tsdb package must not depend on any other scotty packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator interface {
	// Add adds a time series
	Add(values TimeSeries)
	// Aggregate returns the aggregated time series.
	Aggregate() TimeSeries
}

Aggregator aggregates time series together.

type AggregatorGenerator

type AggregatorGenerator func(start, end float64) (Aggregator, error)

AggregatorGenerator produces Aggregator values. start is the start time for the aggregator inclusive; end is the end time for the aggregator exclusive. start and end are seconds since Jan 1, 1970.

type TagFilter

type TagFilter interface {
	Filter(s string) bool
}

TagFilter represents an arbitrary filter on a tag value. Filter returns true if a given tag value should be included or false otherwise.

type TagSet

type TagSet struct {
	HostName  string
	AppName   string
	Region    string
	IpAddress string
}

TagSet represents a set of tsdb tags for time series in scotty.

type TaggedTimeSeries

type TaggedTimeSeries struct {
	Tags   TagSet
	Values TimeSeries
}

TaggedTimeSeries represents a single tagged timeSeries.

type TaggedTimeSeriesSet

type TaggedTimeSeriesSet struct {
	// The metric name
	MetricName string
	// the data
	Data []TaggedTimeSeries
	// If true, Data is grouped by the "HostName" tag
	GroupedByHostName bool
	// If true, Data is grouped by the "appname" tag
	GroupedByAppName bool
	// If true, Data is grouped by the "region" tag
	GroupedByRegion bool
	// If true, data is grouped by the "ipaddress" tag
	GroupedByIpAddress bool
}

TaggedTimeSeriesSet represets a set of tagged time series

type TimeSeries

type TimeSeries []TsValue

TimeSeries represents a time series. TimeSeries are time stamped values sorted by time stamp in ascending order. TimeSeries contain values for all known time stamps even if the value hasn't changed. TimeSeries instances must be treated as immutable.

func (TimeSeries) EarlyTruncate

func (t TimeSeries) EarlyTruncate(earliest float64) TimeSeries

EarlyTruncate returns a time series like this one but without any times before earliest.

func (TimeSeries) MarshalJSON

func (t TimeSeries) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the encoding/json.Marshaler interface and allows correct JSON encoding of TimeSeries values. In particular, time series must be encoded as {"secondsSinceEpoch1":value1, "secondsSinceEpoch2":value2, ...} in ascending order by time.

type TsValue

type TsValue struct {
	// In seconds since Jan 1, 1970
	Ts float64
	// The value
	Value float64
}

TsValue represents a single timestamped value

Directories

Path Synopsis
Package aggregators contains aggregator factory methods.
Package aggregators contains aggregator factory methods.

Jump to

Keyboard shortcuts

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