mirror of
https://github.com/grafana/grafana.git
synced 2025-09-23 16:08:58 +08:00
add fillmode "last" to sql datasource
This adds a new fill mode last (last observation carried forward) for grafana to the sql datasources. This fill mode will fill in the last seen value in a series when a timepoint is missing or NULL if no value for that series has been seen yet.
This commit is contained in:
@ -116,9 +116,13 @@ func (m *postgresMacroEngine) evaluateMacro(name string, args []string) (string,
|
||||
if len(args) == 3 {
|
||||
m.query.Model.Set("fill", true)
|
||||
m.query.Model.Set("fillInterval", interval.Seconds())
|
||||
if args[2] == "NULL" {
|
||||
m.query.Model.Set("fillNull", true)
|
||||
} else {
|
||||
switch args[2] {
|
||||
case "NULL":
|
||||
m.query.Model.Set("fillMode", "null")
|
||||
case "last":
|
||||
m.query.Model.Set("fillMode", "last")
|
||||
default:
|
||||
m.query.Model.Set("fillMode", "value")
|
||||
floatVal, err := strconv.ParseFloat(args[2], 64)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error parsing fill value %v", args[2])
|
||||
|
Reference in New Issue
Block a user