Need help for a time series conversion to a frame

Hi! I’m developing a new backend plugin for time series data. I’ve encountered a problem: when I attempt to create a frame (with the corresponding fields) using an array value, the plugin doesn’t respond. I have two types of data: numeric and array. It comes through an API in the structure of [timestamp, value], where ‘value’ can be of either type. In the case of an array type, the length of the array is constant within the same time series, but two different time series can have different array lengths.

The approach I’m currently using to create the frame and the fields is:

frame := data.NewFrame("response",
    data.NewField("time", nil, []time.Time{}),
    data.NewField("values", nil, []float64{}),

for _, element := range query.Queries[0].Results[0].Values {
    frame.AppendRow(time.Unix(0, int64(element[0].(float64))*int64(time.Millisecond)), element[1].(float64))

response.Frames = append(response.Frames, frame)
return response

Can anyone help with this issue?

I solved creating a new frame for every array value.

That’s the right approach since the source of the data is variable (and very common).

Most datasources will have a frame conversion step between the api call and the response to Grafana.