Grafana v8.5.3
But in alert
Should I put each line into a new frame ?
func (ds *SlsDatasource) BuildTimingGraph(logs []map[string]string, xcol string, ycols []string, frames *data.Frames) {
ds.SortLogs(logs, xcol)
frame := data.NewFrame("response1")
fieldMap := make(map[string][]float64)
var times []time.Time
for _, ycol := range ycols {
fieldMap[ycol] = make([]float64, 0)
}
for _, alog := range logs {...}
var frameLen int
for k, v := range fieldMap {
if len(v) > 0 {
if frameLen == 0 {
frameLen = len(v)
}
if len(v) == frameLen {
frame.Fields = append(frame.Fields, data.NewField(k, nil, v))
}
}
}
if len(times) == frameLen {
frame.Fields = append(frame.Fields, data.NewField("time", nil, times))
}
*frames = append(*frames, frame)
}
{"results":{"A":{"frames":[{"schema":{"name":"response1","refId":"A","fields":[{"name":"a","type":"number","typeInfo":{"frame":"float64"}},{"name":"b","type":"number","typeInfo":{"frame":"float64"}},{"name":"c","type":"number","typeInfo":{"frame":"float64"}},{"name":"time","type":"time","typeInfo":{"frame":"time.Time"}}]},"data":{"values":[[12785,16153,16144,3292],[8804,12138,12139,-654],[4789,8149,8124,-4650],[1653289200000,1653292800000,1653296400000,1653300000000]]}}]}}}
Thanks for help