mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
console: add "previous period" mode
This displays a line for the previous period on stacked graphs. Previous period depends on the current period. It could be hour, day, week, month, or year.
This commit is contained in:
@@ -167,6 +167,36 @@ func TestFinalizeQuery(t *testing.T) {
|
||||
Points: 720, // 2-minute resolution,
|
||||
},
|
||||
Expected: "SELECT 1 FROM flows WHERE TimeReceived BETWEEN toDateTime('2022-04-10 15:45:10', 'UTC') AND toDateTime('2022-04-11 15:45:10', 'UTC')",
|
||||
}, {
|
||||
Description: "use flows table for resolution (control for next case)",
|
||||
Tables: []flowsTable{
|
||||
{"flows", 0, time.Date(2022, 04, 10, 10, 45, 10, 0, time.UTC)},
|
||||
{"flows_1m0s", time.Minute, time.Date(2022, 03, 10, 10, 45, 10, 0, time.UTC)},
|
||||
},
|
||||
Query: "SELECT 1 FROM {{ .Table }} WHERE {{ .Timefilter }} // {{ .Interval }}",
|
||||
Context: inputContext{
|
||||
Start: time.Date(2022, 04, 10, 15, 45, 10, 0, time.UTC),
|
||||
End: time.Date(2022, 04, 11, 15, 45, 10, 0, time.UTC),
|
||||
Points: 2880, // 30-second resolution
|
||||
},
|
||||
Expected: "SELECT 1 FROM flows WHERE TimeReceived BETWEEN toDateTime('2022-04-10 15:45:10', 'UTC') AND toDateTime('2022-04-11 15:45:10', 'UTC') // 30",
|
||||
}, {
|
||||
Description: "use flows table for resolution (but flows_1m0s for data)",
|
||||
Tables: []flowsTable{
|
||||
{"flows", 0, time.Date(2022, 04, 10, 10, 45, 10, 0, time.UTC)},
|
||||
{"flows_1m0s", time.Minute, time.Date(2022, 03, 10, 10, 45, 10, 0, time.UTC)},
|
||||
},
|
||||
Query: "SELECT 1 FROM {{ .Table }} WHERE {{ .Timefilter }} // {{ .Interval }}",
|
||||
Context: inputContext{
|
||||
Start: time.Date(2022, 03, 10, 15, 45, 10, 0, time.UTC),
|
||||
End: time.Date(2022, 03, 11, 15, 45, 10, 0, time.UTC),
|
||||
StartForInterval: func() *time.Time {
|
||||
t := time.Date(2022, 04, 10, 15, 45, 10, 0, time.UTC)
|
||||
return &t
|
||||
}(),
|
||||
Points: 2880, // 30-second resolution
|
||||
},
|
||||
Expected: "SELECT 1 FROM flows_1m0s WHERE TimeReceived BETWEEN toDateTime('2022-03-10 15:45:10', 'UTC') AND toDateTime('2022-03-11 15:45:10', 'UTC') // 30",
|
||||
}, {
|
||||
Description: "select flows table with better resolution",
|
||||
Tables: []flowsTable{
|
||||
|
||||
Reference in New Issue
Block a user