grafana/k6 · error
aggregation wait period is not allowed to have sub-second…
Error message
aggregation wait period is not allowed to have sub-second precision
What it means
Configuration guard in newCollector: the wait period has sub-second precision (waitPeriod != waitPeriod.Truncate(time.Second)), which the whole-second bucket expiry logic cannot handle.
Solutions
- Round the wait period to whole seconds, e.g. '5s' instead of '5.5s'
- Set K6_CLOUD_API_METRIC_PUSH_INTERVAL_WAIT to a whole-second value
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at output/cloud/expv2/collect.go:79 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/e32d478d0c916062.
Report an issue: GitHub.
Appendix: source
Thrown at output/cloud/expv2/collect.go:79
// don't fit in the chosen ring buffer size, we could just send them along to the buffer unaggregated
timeBuckets map[int64]map[metrics.TimeSeries]metricValue
}
func newCollector(aggrPeriod, waitPeriod time.Duration) (*collector, error) {
if aggrPeriod == 0 {
return nil, errors.New("aggregation period is not allowed to be zero")
}
if aggrPeriod != aggrPeriod.Truncate(time.Second) {
return nil, errors.New("aggregation period is not allowed to have sub-second precision")
}
if waitPeriod == 0 {
// TODO: we could simplify the expiring logic
// just having an internal static logic.
// Like skip only not closed buckets bucketEnd > now.
return nil, errors.New("aggregation wait period is not allowed to be zero")
}
if waitPeriod != waitPeriod.Truncate(time.Second) {
return nil, errors.New("aggregation wait period is not allowed to have sub-second precision")
}
return &collector{
bq: bucketQ{},
nowFunc: time.Now,
timeBuckets: make(map[int64]map[metrics.TimeSeries]metricValue),
aggregationPeriod: aggrPeriod,
waitPeriod: waitPeriod,
}, nil
}
// CollectSamples drain the buffer and collect all the samples.
func (c *collector) CollectSamples(containers []metrics.SampleContainer) {
// Distribute all newly buffered samples into related buckets
for _, sampleContainer := range containers {
samples := sampleContainer.GetSamples()
for i := range samples {
c.collectSample(samples[i])View on GitHub (pinned to 01ffac6f24)