@@ -204,8 +204,12 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
204
204
return response , nil
205
205
}
206
206
}
207
+
208
+ var profile_event_type string = ""
207
209
// 获取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
+ }
209
213
210
214
//app类型
211
215
appType := queryText ["appType" ].(string )
@@ -251,15 +255,26 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
251
255
frame .Fields = append (frame .Fields ,
252
256
data .NewField ("level" , nil , []float64 {0 }),
253
257
)
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
+ // )
257
267
frame .Fields = append (frame .Fields ,
258
268
data .NewField ("label" , nil , []string {"_" }),
259
269
)
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
+ // )
263
278
response .Frames = append (response .Frames , frame )
264
279
return response , nil
265
280
}
@@ -326,15 +341,29 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
326
341
frame .Fields = append (frame .Fields ,
327
342
data .NewField ("level" , nil , dataAll ["level" ]),
328
343
)
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
+
332
354
frame .Fields = append (frame .Fields ,
333
355
data .NewField ("label" , nil , dataAll ["label" ]),
334
356
)
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
+ // )
338
367
response .Frames = append (response .Frames , frame )
339
368
return response , nil
340
369
}
0 commit comments