metrics

package
v0.0.0-...-53b4af0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Daily stores a single data point per day
	Daily = func(t time.Time) time.Time { return now.New(t).BeginningOfDay() }

	// Hourly stores a single data point per hour
	Hourly = func(t time.Time) time.Time { return now.New(t).BeginningOfHour() }
)

Functions

This section is empty.

Types

type Datastore

type Datastore interface {
	// Load queries the measurements since the given date and returns the
	// measurements as chronologically ordered.
	Load(source string, since time.Time) ([]Measurement, error)

	// Save persists the given measurement, or updates existing one with a new value.
	Save(m Measurement) error
}

Datastore stores measurements.

type Frequency

type Frequency func(time.Time) time.Time

Frequency bucketizes given time into another time.

type Measurement

type Measurement struct {
	Source string
	Date   time.Time
	Value  float64
}

type Metric

type Metric struct {
	Name string
	Kind Frequency
}

func (Metric) NewMeasurement

func (m Metric) NewMeasurement(date time.Time, value float64) Measurement

NewMeasurement creates a measurement with given date and reduces it to a desired date bucket and converts its timezone to UTC.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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