Keep __name__ tag in results

pull/9967/head
Edd Robinson 2018-06-13 11:12:56 +01:00
parent 62dd27b5e8
commit 652bb3d3c3
2 changed files with 2 additions and 3 deletions

View File

@ -46,10 +46,9 @@ func WriteRequestToPoints(req *remote.WriteRequest) ([]models.Point, error) {
tags := make(map[string]string, len(ts.Labels))
for _, l := range ts.Labels {
tags[l.Name] = l.Value
if l.Name == prometheusNameTag {
measurement = l.Value
} else {
tags[l.Name] = l.Value
}
}

View File

@ -9639,7 +9639,7 @@ func TestServer_Prometheus_Write(t *testing.T) {
&Query{
name: "selecting the data should return it",
command: `SELECT * FROM db0.rp0.cpu`,
exp: fmt.Sprintf(`{"results":[{"statement_id":0,"series":[{"name":"cpu","columns":["time","host","value"],"values":[["%s","a",100],["%s","b",200]]}]}]}`, now.Format(time.RFC3339Nano), now.Add(10*time.Millisecond).Format(time.RFC3339Nano)),
exp: fmt.Sprintf(`{"results":[{"statement_id":0,"series":[{"name":"cpu","columns":["time","__name__","host","value"],"values":[["%s","cpu","a",100],["%s","cpu","b",200]]}]}]}`, now.Format(time.RFC3339Nano), now.Add(10*time.Millisecond).Format(time.RFC3339Nano)),
},
)