mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-12 19:21:49 +08:00

* feat: logsV4 initial refactoring * feat: filter_query builder with tests added * feat: all functions of v4 refactored * fix: tests fixed * feat: logs list API, logic update for better perf * fix: update select for table panel * fix: tests updated with better examples of limit and group by * fix: resource filter support in live tail * feat: cleanup and use flag * feat: restrict new list api to single query * fix: move getTsRanges to utils
39 lines
725 B
Go
39 lines
725 B
Go
package utils
|
|
|
|
const HOUR_NANO = int64(3600000000000)
|
|
|
|
type LogsListTsRange struct {
|
|
Start int64
|
|
End int64
|
|
}
|
|
|
|
func GetLogsListTsRanges(start, end int64) []LogsListTsRange {
|
|
startNano := GetEpochNanoSecs(start)
|
|
endNano := GetEpochNanoSecs(end)
|
|
result := []LogsListTsRange{}
|
|
|
|
if endNano-startNano > HOUR_NANO {
|
|
bucket := HOUR_NANO
|
|
tStartNano := endNano - bucket
|
|
|
|
complete := false
|
|
for {
|
|
result = append(result, LogsListTsRange{Start: tStartNano, End: endNano})
|
|
if complete {
|
|
break
|
|
}
|
|
|
|
bucket = bucket * 2
|
|
endNano = tStartNano
|
|
tStartNano = tStartNano - bucket
|
|
|
|
// break condition
|
|
if tStartNano <= startNano {
|
|
complete = true
|
|
tStartNano = startNano
|
|
}
|
|
}
|
|
}
|
|
return result
|
|
}
|