Skip to content

Commit 0fde989

Browse files
congxitravilyu
congxi
authored andcommitted
[feature] error fixed
**Phenomenon and reproduction steps** **Root cause and solution** **Impactions** **Test method** **Affected branch(es)** * main **Checklist** - [ ] Dependencies update required - [ ] Common bug (similar problem in other repo)
1 parent 2f5504d commit 0fde989

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

deepflow-querier-datasource/pkg/plugin/datasource.go

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,12 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
204204
return response, nil
205205
}
206206
}
207+
208+
var profile_event_type string = ""
207209
// 获取profile_event_type
208-
profile_event_type := qj["profile_event_type"].(string)
210+
if qj["profile_event_type"] != nil {
211+
profile_event_type = qj["profile_event_type"].(string)
212+
}
209213

210214
//app类型
211215
appType := queryText["appType"].(string)
@@ -251,15 +255,26 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
251255
frame.Fields = append(frame.Fields,
252256
data.NewField("level", nil, []float64{0}),
253257
)
254-
frame.Fields = append(frame.Fields,
255-
data.NewField("value", nil, []float64{0}),
256-
)
258+
field := data.NewField("value", nil, []float64{0})
259+
field.Config = &data.FieldConfig{
260+
Unit: "ns",
261+
}
262+
frame.Fields = append(frame.Fields, field)
263+
264+
// frame.Fields = append(frame.Fields,
265+
// data.NewField("value", nil, []float64{0}),
266+
// )
257267
frame.Fields = append(frame.Fields,
258268
data.NewField("label", nil, []string{"_"}),
259269
)
260-
frame.Fields = append(frame.Fields,
261-
data.NewField("self", nil, []float64{0}),
262-
)
270+
fieldSelf := data.NewField("self", nil, []float64{0})
271+
fieldSelf.Config = &data.FieldConfig{
272+
Unit: "ns",
273+
}
274+
frame.Fields = append(frame.Fields, fieldSelf)
275+
// frame.Fields = append(frame.Fields,
276+
// data.NewField("self", nil, []float64{0}),
277+
// )
263278
response.Frames = append(response.Frames, frame)
264279
return response, nil
265280
}
@@ -326,15 +341,29 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
326341
frame.Fields = append(frame.Fields,
327342
data.NewField("level", nil, dataAll["level"]),
328343
)
329-
frame.Fields = append(frame.Fields,
330-
data.NewField("value", nil, dataAll["value"]),
331-
)
344+
fieldValue := data.NewField("value", nil, dataAll["value"])
345+
fieldValue.Config = &data.FieldConfig{
346+
Unit: "ns",
347+
}
348+
frame.Fields = append(frame.Fields, fieldValue)
349+
350+
// frame.Fields = append(frame.Fields,
351+
// data.NewField("value", nil, dataAll["value"]),
352+
// )
353+
332354
frame.Fields = append(frame.Fields,
333355
data.NewField("label", nil, dataAll["label"]),
334356
)
335-
frame.Fields = append(frame.Fields,
336-
data.NewField("self", nil, dataAll["self"]),
337-
)
357+
358+
fieldSelf := data.NewField("self", nil, dataAll["self"])
359+
fieldSelf.Config = &data.FieldConfig{
360+
Unit: "ns",
361+
}
362+
frame.Fields = append(frame.Fields, fieldSelf)
363+
364+
// frame.Fields = append(frame.Fields,
365+
// data.NewField("self", nil, dataAll["self"]),
366+
// )
338367
response.Frames = append(response.Frames, frame)
339368
return response, nil
340369
}

0 commit comments

Comments
 (0)