Field note / 2026

The meter with no readings

One OpsGraph test gave me a reading from a meter that had never sent one. A PostgreSQL left join and COUNT explained where it came from.

Read the note
An orange route tracing a path through a violet network of nodes.
Illustration of the evidence trail in a database investigation.

Where did the one come from?

I ran OpsGraph against a test database with a hosted language model. For one probe, the answer came back as one reading and one missing measurement. That probe had no readings at all. The query was valid, the database answered it, and the number was wrong.

Count the thing you mean

A left join keeps the probe in the result even when it has no matching readings. That leaves one output row with empty fields on the readings side. Count every output row and you get one. Count those empty fields as missing measurements and you can make the same mistake twice. I wanted two separate questions answered: how many readings exist, and how many of those readings have a missing value?

Give zero a place in the test

I added a probe with no readings to the metering fixture. I also added a narrow check before execution so the planner could correct this particular count. I then compared the actual SQL results with the evidence OpsGraph exported. For the empty probe, both counts had to come back as zero. A table full of busy meters would never have shown me that bug.

Related workOpsGraph