Skip to content

Commit

Permalink
feat: 增加 bksql 查询指标打点 --story=116536911 (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamcleren authored Mar 18, 2024
1 parent 4b8b790 commit 4fb80b0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/unify-query/tsdb/bksql/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@ func (i Instance) GetInstanceType() string {
func getValue(k string, d map[string]interface{}) (string, error) {
var value string
if v, ok := d[k]; ok {
// 增加 nil 判断,避免回传的数值为空
if v == nil {
return value, nil
}

switch v.(type) {
case string:
value = fmt.Sprintf("%s", v)
Expand All @@ -525,7 +530,7 @@ func getValue(k string, d map[string]interface{}) (string, error) {
case int64, int32, int:
value = fmt.Sprintf("%d", v)
default:
return value, nil
return value, fmt.Errorf("get_value_error: type %T, %v in %s with %+v", v, v, k, d)
}
}
return value, nil
Expand Down

0 comments on commit 4fb80b0

Please sign in to comment.