mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
wip: began work on support for testdata tables & annotations support
This commit is contained in:
27
pkg/tsdb/testdata/scenarios.go
vendored
27
pkg/tsdb/testdata/scenarios.go
vendored
@@ -221,6 +221,33 @@ func init() {
|
||||
return queryRes
|
||||
},
|
||||
})
|
||||
|
||||
registerScenario(&Scenario{
|
||||
Id: "annotations",
|
||||
Name: "Annotations",
|
||||
|
||||
Handler: func(query *tsdb.Query, tsdbQuery *tsdb.TsdbQuery) *tsdb.QueryResult {
|
||||
timeWalkerMs := tsdbQuery.TimeRange.GetFromAsMsEpoch()
|
||||
to := tsdbQuery.TimeRange.GetToAsMsEpoch()
|
||||
|
||||
table := tsdb.Table{
|
||||
Columns: []tsdb.TableColumn{
|
||||
{Text: "time"},
|
||||
{Text: "message"},
|
||||
},
|
||||
Rows: []tsdb.RowValues{},
|
||||
}
|
||||
|
||||
for i := int64(0); i < 10 && timeWalkerMs < to; i++ {
|
||||
table.Rows = append(table.Rows, tsdb.RowValues{float64(timeWalkerMs), "hello"})
|
||||
timeWalkerMs += query.IntervalMs
|
||||
}
|
||||
|
||||
queryRes := tsdb.NewQueryResult()
|
||||
queryRes.Tables = append(queryRes.Tables, &table)
|
||||
return queryRes
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func registerScenario(scenario *Scenario) {
|
||||
|
Reference in New Issue
Block a user