Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions edge/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,16 +681,33 @@ func (bb *bufferedBatchMessage) ToRow() (row *models.Row) {
return
}
row.Columns = []string{"time"}
p := bb.points[0]
for f := range p.Fields() {

tagNames := make(map[string]struct{})
fieldNames := make(map[string]struct{})
// we have to walk all the points to get the columns.
for _, p := range bb.points {
for f := range p.Fields() {
fieldNames[f] = struct{}{}
}

// Append tags that are not on the batch
for t := range p.Tags() {
if _, ok := bb.begin.Tags()[t]; !ok {
tagNames[t] = struct{}{}
}
}
}
for f := range fieldNames {
row.Columns = append(row.Columns, f)
}

// Append tags that are not on the batch
for t := range p.Tags() {
for t := range tagNames {
if _, ok := bb.begin.Tags()[t]; !ok {
row.Columns = append(row.Columns, t)
}
}

// Sort all columns but leave time as first
sort.Strings(row.Columns[1:])
row.Values = make([][]interface{}, len(bb.points))
Expand Down