mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(influxdb): support mulitple tags
This commit is contained in:
parent
87650c150b
commit
522d40fa26
@ -3,6 +3,7 @@ package influxdb
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/tsdb"
|
"github.com/grafana/grafana/pkg/tsdb"
|
||||||
"gopkg.in/guregu/null.v3"
|
"gopkg.in/guregu/null.v3"
|
||||||
@ -45,17 +46,18 @@ func (rp *ResponseParser) parseResult(result []Row, queryResult *tsdb.QueryResul
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rp *ResponseParser) formatName(row Row, column string) string {
|
func (rp *ResponseParser) formatName(row Row, column string) string {
|
||||||
tags := ""
|
var tags []string
|
||||||
|
|
||||||
for k, v := range row.Tags {
|
for k, v := range row.Tags {
|
||||||
tags += k + ": " + v
|
tags = append(tags, fmt.Sprintf("%s: %s", k, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
if tags != "" {
|
tagText := ""
|
||||||
tags = fmt.Sprintf(" { %s }", tags)
|
if len(tags) > 0 {
|
||||||
|
tagText = fmt.Sprintf(" { %s }", strings.Join(tags, " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%s.%s%s", row.Name, column, tags)
|
return fmt.Sprintf("%s.%s%s", row.Name, column, tagText)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rp *ResponseParser) parseTimepoint(k []interface{}, valuePosition int) tsdb.TimePoint {
|
func (rp *ResponseParser) parseTimepoint(k []interface{}, valuePosition int) tsdb.TimePoint {
|
||||||
|
Loading…
Reference in New Issue
Block a user