Skip to content

Commit

Permalink
[feature] error fixed
Browse files Browse the repository at this point in the history
**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)
  • Loading branch information
congxi authored and travilyu committed Aug 14, 2024
1 parent 2f5504d commit 0fde989
Showing 1 changed file with 42 additions and 13 deletions.
55 changes: 42 additions & 13 deletions deepflow-querier-datasource/pkg/plugin/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,12 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
return response, nil
}
}

var profile_event_type string = ""
// 获取profile_event_type
profile_event_type := qj["profile_event_type"].(string)
if qj["profile_event_type"] != nil {
profile_event_type = qj["profile_event_type"].(string)
}

//app类型
appType := queryText["appType"].(string)
Expand Down Expand Up @@ -251,15 +255,26 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
frame.Fields = append(frame.Fields,
data.NewField("level", nil, []float64{0}),
)
frame.Fields = append(frame.Fields,
data.NewField("value", nil, []float64{0}),
)
field := data.NewField("value", nil, []float64{0})
field.Config = &data.FieldConfig{
Unit: "ns",
}
frame.Fields = append(frame.Fields, field)

// frame.Fields = append(frame.Fields,
// data.NewField("value", nil, []float64{0}),
// )
frame.Fields = append(frame.Fields,
data.NewField("label", nil, []string{"_"}),
)
frame.Fields = append(frame.Fields,
data.NewField("self", nil, []float64{0}),
)
fieldSelf := data.NewField("self", nil, []float64{0})
fieldSelf.Config = &data.FieldConfig{
Unit: "ns",
}
frame.Fields = append(frame.Fields, fieldSelf)
// frame.Fields = append(frame.Fields,
// data.NewField("self", nil, []float64{0}),
// )
response.Frames = append(response.Frames, frame)
return response, nil
}
Expand Down Expand Up @@ -326,15 +341,29 @@ func (d *Datasource) query(ctx context.Context, pCtx backend.PluginContext, quer
frame.Fields = append(frame.Fields,
data.NewField("level", nil, dataAll["level"]),
)
frame.Fields = append(frame.Fields,
data.NewField("value", nil, dataAll["value"]),
)
fieldValue := data.NewField("value", nil, dataAll["value"])
fieldValue.Config = &data.FieldConfig{
Unit: "ns",
}
frame.Fields = append(frame.Fields, fieldValue)

// frame.Fields = append(frame.Fields,
// data.NewField("value", nil, dataAll["value"]),
// )

frame.Fields = append(frame.Fields,
data.NewField("label", nil, dataAll["label"]),
)
frame.Fields = append(frame.Fields,
data.NewField("self", nil, dataAll["self"]),
)

fieldSelf := data.NewField("self", nil, dataAll["self"])
fieldSelf.Config = &data.FieldConfig{
Unit: "ns",
}
frame.Fields = append(frame.Fields, fieldSelf)

// frame.Fields = append(frame.Fields,
// data.NewField("self", nil, dataAll["self"]),
// )
response.Frames = append(response.Frames, frame)
return response, nil
}
Expand Down

0 comments on commit 0fde989

Please sign in to comment.