@ -75,7 +75,7 @@ func (ss *Sqlite) GetLogAggregate(la LogAggregateInput) (LogAggregate, error) {
la . IntervalSeconds = timespanSecs / sampleCount
}
log . Printf ( "%+v - samples: %v - timespan (seconds): %v ", la , sampleCount , timespanSec s)
log . Printf ( "%+v - samples: %v - timespan (seconds): %v - interval: %v ", la , sampleCount , timespanSec s, la . IntervalSecond s)
switch la . Column {
case string ( Domain ) :
@ -105,13 +105,15 @@ func (ss *Sqlite) GetLogAggregate(la LogAggregateInput) (LogAggregate, error) {
for _ , l := range logs . Logs {
k := GetAggregateColumnHeader ( l , LogAggregateColumn ( la . Column ) )
if _ , ok := buckets [ k ] ; ! ok {
buckets [ k ] = make ( [ ] StatsDataPoint , sampleCount + 1 )
buckets [ k ] = make ( [ ] StatsDataPoint , sampleCount )
}
dataset := buckets [ k ]
timeIndex := int ( l . Started . Sub ( la . Start ) / time . Second ) / la . IntervalSeconds
AssertFail ( timeIndex >= len ( dataset ) , "ERROR TIME INDEX OUT OF RANGE %d/%d" , timeIndex , len ( dataset ) )
if AssertIfFail ( timeIndex >= len ( dataset ) , "ERROR TIME INDEX OUT OF RANGE %d/%d with interval %d - time index: %s" , timeIndex , len ( dataset ) , la . IntervalSeconds , l . Started . Sub ( la . Start ) / time . Second ) {
continue
}
ladp := dataset [ timeIndex ]
ladp . Header = k