Documentation ¶
Overview ¶
Package state provides the persistent storage layer for the metrics.
Index ¶
- Constants
- func AvgSince(ctx context.Context, db *sql.DB, tableName string, name string, ...) (float64, error)
- func CreateTable(ctx context.Context, db *sql.DB, tableName string) error
- func EMASince(ctx context.Context, db *sql.DB, tableName string, name string, ...) (float64, error)
- func Insert(ctx context.Context, db *sql.DB, tableName string, metric Metric) error
- func Purge(ctx context.Context, db *sql.DB, tableName string, before time.Time) (int, error)
- type Metric
- type Metrics
Constants ¶
View Source
const ( ColumnUnixSeconds = "unix_seconds" ColumnMetricName = "metric_name" ColumnMetricSecondaryName = "metric_secondary_name" ColumnMetricValue = "metric_value" )
View Source
const DefaultTableName = "components_metrics"
Variables ¶
This section is empty.
Functions ¶
func AvgSince ¶
func AvgSince(ctx context.Context, db *sql.DB, tableName string, name string, secondaryName string, since time.Time) (float64, error)
Computes the average of the last metrics. If the since is zero, all metrics are used. Returns zero if no record is found ("database/sql.ErrNoRows").
Types ¶
Click to show internal directories.
Click to hide internal directories.