stats

package
v0.0.0-...-f4dfc87 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const INFLUXDB_DATABASE = "close"
View Source
const INFLUXDB_PORT = "8086"
View Source
const INFLUXDB_USER_AGENT = "close-stats"

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID struct {
	Type     string
	Hostname string
	Instance string
}

StatsWriter identifier; this uniquely identifies an InfluxDB measurement series, which may include multiple fields

type InfluxURL

type InfluxURL url.URL

func (InfluxURL) BatchPointsConfig

func (self InfluxURL) BatchPointsConfig() influxdb.BatchPointsConfig

func (InfluxURL) Connect

func (self InfluxURL) Connect() (influxdb.Client, error)

func (InfluxURL) Database

func (self InfluxURL) Database() string

func (InfluxURL) Empty

func (self InfluxURL) Empty() bool

func (*InfluxURL) MarshalFlag

func (self *InfluxURL) MarshalFlag() (string, error)

func (InfluxURL) Query

func (self InfluxURL) Query(command string) influxdb.Query

func (InfluxURL) String

func (self InfluxURL) String() string

func (*InfluxURL) UnmarshalFlag

func (self *InfluxURL) UnmarshalFlag(value string) error

type Reader

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

func NewReader

func NewReader(options ReaderOptions) (*Reader, error)

func (*Reader) GetSeries

func (self *Reader) GetSeries(series SeriesKey, fields []string, duration time.Duration) (dataList []SeriesData, err error)

Get full time-series data for given series's fields over given duration

func (*Reader) GetStats

func (self *Reader) GetStats(series SeriesKey, field string, duration time.Duration) (statsList []SeriesStats, err error)

func (*Reader) ListSeries

func (self *Reader) ListSeries(filter SeriesKey) (seriesList []SeriesKey, err error)

func (*Reader) ListTypes

func (self *Reader) ListTypes() (metas []SeriesMeta, err error)

func (*Reader) String

func (self *Reader) String() string

type ReaderOptions

type ReaderOptions struct {
	InfluxURL InfluxURL `long:"influxdb-url" value-name:"http://[USER:[PASSWORD]@]HOST[:PORT]/DATABASE" env:"INFLUXDB_URL"`
}

func (ReaderOptions) Empty

func (self ReaderOptions) Empty() bool

type SeriesData

type SeriesData struct {
	SeriesKey
	Field string `json:"field"`

	Points []SeriesPoint `json:"points"`
}

func (SeriesData) String

func (self SeriesData) String() string

type SeriesKey

type SeriesKey struct {
	Type     string `json:"type"`
	Hostname string `json:"hostname,omitempty"`
	Instance string `json:"instance,omitempty"`
}

Dynamic list of InfluxDB measurement-series. Each of these series may have multiple fields

type SeriesMeta

type SeriesMeta struct {
	Type   string   `json:"type"`
	Fields []string `json:"fields"`
}

Static list of InfluxDB measurements, and their fields

type SeriesPoint

type SeriesPoint struct {
	Time  time.Time `json:"time"`
	Value float64   `json:"value"`
}

Temporal InfluxDB measurement-series-data

type SeriesStats

type SeriesStats struct {
	SeriesKey
	Field string `json:"field"`

	SeriesTab
}

func (SeriesStats) String

func (self SeriesStats) String() string

type SeriesTab

type SeriesTab struct {
	Time time.Time `json:"time"`

	Mean float64 `json:"mean"`
	Min  float64 `json:"min"`
	Max  float64 `json:"max"`
	Last float64 `json:"last"`
}

Summarized InfluxDB measurement-series-data for table

type Stats

type Stats interface {
	StatsID() ID
	StatsTime() time.Time
	StatsFields() map[string]interface{}
	String() string
}

type Writer

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

Wrap a statsd client to uniquely identify the measurements

func NewWriter

func NewWriter(options WriterOptions) (*Writer, error)

func (*Writer) Interval

func (self *Writer) Interval() time.Duration

func (*Writer) IntervalStatsWriter

func (self *Writer) IntervalStatsWriter() chan Stats

Return a channel which normally blocks on writes, but accepts a write every tick-interval XXX: this does not guarantee any minimum interval for the initial stats cycle, and is thus mostly broken..

func (*Writer) IntervalTick

func (self *Writer) IntervalTick() <-chan time.Time

func (*Writer) StatsWriter

func (self *Writer) StatsWriter() chan Stats

Return a channel which continously accepts stats writes

func (*Writer) String

func (self *Writer) String() string

type WriterOptions

type WriterOptions struct {
	InfluxURL InfluxURL `long:"influxdb-url" value-name:"http://[USER:[PASSWORD]@]HOST[:PORT]/DATABASE" env:"INFLUXDB_URL"`

	Hostname string `long:"stats-hostname" env:"HOSTNAME"`

	Instance string `long:"stats-instance" env:"CLOSE_INSTANCE"`

	// Collection interval
	Interval time.Duration `long:"stats-interval" value-name:"SECONDS" default:"1s"`

	// Show stats on stdout
	Print bool `long:"stats-print"`
}

func (WriterOptions) Empty

func (self WriterOptions) Empty() bool

Jump to

Keyboard shortcuts

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