Prometheus failed to write data into CrateDB after encountering error 'A document with the same primary key exists already'

You are correct, the adapter currently doesn’t handle upserts.
This probably can be changed by editing:

to

INSERT INTO metrics ("labels", "labels_hash", "timestamp", "value", "valueRaw") VALUES ($1, $2, $3, $4, $5)
ON CONFLICT ("timestamp", "labels_hash", "day__generated")
DO UPDATE SET
   "value" = excluded."value",
   "valueRaw" = excluded."valueRaw";
2 Likes