Documentation
¶
Index ¶
- Variables
- func AdvanceTime(t time.Time, g *driver.Granularity) time.Time
- func FillAttemptBuckets(data []driver.AttemptMetricsDataPoint, req driver.MetricsRequest) ([]driver.AttemptMetricsDataPoint, error)
- func FillEventBuckets(data []driver.EventMetricsDataPoint, req driver.MetricsRequest) ([]driver.EventMetricsDataPoint, error)
- func GenerateTimeBuckets(start, end time.Time, g *driver.Granularity) ([]time.Time, error)
- func TruncateTime(t time.Time, g *driver.Granularity) time.Time
- type DimKey
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyBuckets = fmt.Errorf("time range produces more than %d buckets", maxBuckets)
ErrTooManyBuckets is returned when the granularity + time range would produce more than maxBuckets time slots, which could cause OOM.
Functions ¶
func AdvanceTime ¶
AdvanceTime steps forward by one granularity unit from t.
func FillAttemptBuckets ¶
func FillAttemptBuckets(data []driver.AttemptMetricsDataPoint, req driver.MetricsRequest) ([]driver.AttemptMetricsDataPoint, error)
FillAttemptBuckets fills in missing time buckets with zero-valued data points. Returns ErrTooManyBuckets if the time range + granularity produces too many slots.
func FillEventBuckets ¶
func FillEventBuckets(data []driver.EventMetricsDataPoint, req driver.MetricsRequest) ([]driver.EventMetricsDataPoint, error)
FillEventBuckets fills in missing time buckets with zero-valued data points so that the response contains one entry per time slot (per dimension combo). Returns ErrTooManyBuckets if the time range + granularity produces too many slots.
func GenerateTimeBuckets ¶
GenerateTimeBuckets returns a slice of aligned time slots from the truncated start up to (but not including) end, stepping by one granularity unit. Returns ErrTooManyBuckets if the result would exceed maxBuckets.
func TruncateTime ¶
TruncateTime truncates t to the boundary defined by granularity g. This is the shared implementation used by all backends.
For sub-day units (s, m, h), Value controls both step size and alignment. For calendar units (d, w, M), Value > 1 uses epoch-anchored alignment so that multi-day/week/month intervals aggregate data correctly.
Types ¶
type DimKey ¶
type DimKey string
DimKey is an opaque composite key built from dimension values.
func AttemptDimKey ¶
func AttemptDimKey(dp *driver.AttemptMetricsDataPoint, dims []string) DimKey
AttemptDimKey builds a composite key from the dimension fields of an attempt data point.
func EventDimKey ¶
func EventDimKey(dp *driver.EventMetricsDataPoint, dims []string) DimKey
EventDimKey builds a composite key from the dimension fields of an event data point.