sdk icon indicating copy to clipboard operation
sdk copied to clipboard

When using the flux query in graph panel targets, grid are not displaying.

Open kittucandy opened this issue 4 years ago • 6 comments
trafficstars

I am using Flux 2.X as the datasource.

I have defined the targets in my code like this..

board := sdk.NewBoard("sample")
board.ID = 1
row1 := board.AddRow("Sample row title")
// row1.Add(sdk.NewGraph("Sample graph"))
graph := sdk.NewGraph("Sample graph 2")
strPointer := sdk.MixedSource
graph.Datasource = &strPointer
target := sdk.Target{
	RefID:      "A",
	Datasource: "Influx 2.0",
	Query:      "Flux Query"}
//Query: "select * from"}
graph.AddTarget(&target)
graph.GraphPanel.Xaxis.Show = true
graph.GraphPanel.Yaxes = append(graph.GraphPanel.Yaxes, sdk.Axis{Show: true, Format: "short", LogBase: 1, Decimals: 0})
graph.GraphPanel.Yaxes = append(graph.GraphPanel.Yaxes, sdk.Axis{Show: true, Format: "short", LogBase: 1, Decimals: 0})
row1.Add(graph)

when the post call is made, i can able to see the dashboard and panel created, and targets added successfully with the query and datasource thats defined.. but i am not able to see the graph panel with grid and graph..

When i used the "Expr" instead of "Query" in the targets.. i can able to see grid coming, but the query is not visible..

is there a bug or sdk not not supporting Flux queries?

I am using grafana 7.3.3 and

kittucandy avatar Apr 04 '21 14:04 kittucandy

I am using grafana 7.3.3 and influxdb 2.X

kittucandy avatar Apr 05 '21 13:04 kittucandy

Screenshot 2021-04-05 at 6 55 15 PM

kittucandy avatar Apr 05 '21 13:04 kittucandy

When i create the same manually like adding a panel, graph and datasource and same query.. its working perfectly. Am i doing anything wrong in using the sdk? am i missed passing any values that are required?

kittucandy avatar Apr 05 '21 13:04 kittucandy

@GiedriusS can you help on this ? any update on this...

kittucandy avatar Apr 07 '21 05:04 kittucandy

Unfortunately but Grafana doesn't fully verify the model before accepting the input so such weird things could happen. I'm not sure when I will have time to get around this but you can help out by trying to create a Grafana dashboard with that panel manually, and comparing what you get with the sdk & what you get after creating the panel manually. This way you could deduce what is missing.

GiedriusS avatar Apr 08 '21 19:04 GiedriusS

大佬们。有解决方案嘛

lpg-it avatar Jun 25 '21 09:06 lpg-it