Documentation
¶
Index ¶
- func DeleteSummarizedSamples(c context.Context, loc *time.Location, daysToKeep int) error
- func DoQuery(c context.Context, w io.Writer, qp QueryParams) error
- func EvaluateConds(c context.Context, conds []Condition, now time.Time, sender string, ...) error
- func GenerateSummaries(c context.Context, now time.Time, fullDayDelay time.Duration) error
- func WriteSamples(c context.Context, samples []common.Sample) error
- type Condition
- type QueryGranularity
- type QueryParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteSummarizedSamples ¶
DeleteSummarizedSamples deletes samples from days that have been "fully" summarized (see GenerateSummaries). Samples from partially-summarized days are never deleted. loc is used to determine day boundaries. daysToKeep defines the number of fully-summarized days for which samples should be retained.
func DoQuery ¶
runQuery runs the query described by qp synchronously and writes a Google Chart API DataTable object to w.
func EvaluateConds ¶
func GenerateSummaries ¶
GenerateSummaries reads samples and inserts daily and hourly summary entities. now.Location() is used to define day boundaries; hour boundaries are computed based on UTC. fullDayDelay defines how long we wait after the end of a day before assuming that we have all the data we're going to get from it (and not re-summarizing it in the future).
Types ¶
type Condition ¶
type Condition struct { // Source and name associated with sample. Source string Name string // Operator: one of "eq", "ne", "lt", "gt", "le", "ge", or "ot". // "ot" is "older than"; Value is then in seconds. Op string // Value to compare samples against. Value float32 }
Condition describes a condition responsible for triggering an alert.
type QueryGranularity ¶
type QueryGranularity int
QueryGranularity describes types of points used in query results.
const ( IndividualSample QueryGranularity = iota HourlyAverage DailyAverage )
type QueryParams ¶
type QueryParams struct { // Labels contains human-readable labels for lines. Labels []string // SourceNames contains "source|name" pairs describing lines. It must be the // same length, and be in the same order, as labels. SourceNames []string // Start and End describe the inclusive time range for the query. Start time.Time End time.Time // Granularity describes the type of points to use. Granularity QueryGranularity // Aggregation describes how many sequential points to average together for // each returned point. It has no effect if less than or equal to 1. Aggregation int }
QueryParams describes a query to be performed.
func (*QueryParams) UpdateGranularityAndAggregation ¶
func (qp *QueryParams) UpdateGranularityAndAggregation( sampleInterval time.Duration, sampleStart time.Time)
UpdateGranularityAndAggregation updates the Granularity and Aggregation fields based on Start, End, sampleInterval (the typical interval between samples), and sampleStart (an optional timestamp describing the oldest samples that are available).