Skip to content
This repository was archived by the owner on Dec 29, 2020. It is now read-only.
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions postgres/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func (c *Client) WriteLabel(m *model.Metric, stmt *sql.Stmt, t time.Time) (writt
}

func (c *Client) WriteSamples(samples model.Samples) error {
txn, stmt, err := c.PrepareStmt(pq.CopyIn("metric_samples", "time", "name", "value", "lid"))
txn, stmt, err := c.PrepareStmt(pq.CopyIn("metric_samples", "time", "lid", "value"))
if err != nil {
level.Error(c.logger).Log("msg", "error preparing sample statement", "err", err)
return err
Expand Down Expand Up @@ -373,7 +373,7 @@ func (c *Client) WriteSample(s *model.Sample, txn *sql.Tx, stmt *sql.Stmt) (writ
}

level.Debug(c.logger).Log("name", name, "time", t, "value", v, "labels", lid)
_, err = stmt.Exec(t, name, v, lid)
_, err = stmt.Exec(t, lid, v)
if err != nil {
level.Error(c.logger).Log("msg", "error in single sample execution", "err", err)
// this is the only error case that is actually fatal for the transaction and must return err
Expand Down
1 change: 0 additions & 1 deletion schema/tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ WHERE
-- samples
CREATE TABLE IF NOT EXISTS metric_samples (
"time" TIMESTAMP NOT NULL, -- sample time
"name" TEXT NOT NULL, -- metric name
"lid" uuid NOT NULL, -- metric lid
"value" double precision NOT NULL -- value
);
Expand Down