diff --git a/prometheus/converters.go b/prometheus/converters.go index 568679f474..b3d2206100 100644 --- a/prometheus/converters.go +++ b/prometheus/converters.go @@ -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 } } diff --git a/tests/server_test.go b/tests/server_test.go index 7f6f7f5d60..8d69543b27 100644 --- a/tests/server_test.go +++ b/tests/server_test.go @@ -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)), }, )