The operator you are commenting on is not difference, this is difference over time delta aka. derivative -- so it must have the time component. And our implementation behaves like rate in the sense that it does ensure that missing values will not result in invalid rate jumps, but the rate will be properly reset as if starting at the beginning of the stream.

So what we are focusing on here is the rate-like operator with all the requirements as this is what we need for nodewatcher. I don't think that we should support all possible operators from the beginning, but should instead focus on the ones that we actually need.

Yes, overflow/restarted counters should be handled. If anything, this functionality is something that separates "derivative" operator from "counter" operator. The only difference between them should be handling of overflow values IMO. Overflows can be handled by having a parameter that sets up the maximum possible legal value that the rate can have and resetting the counter for anything that goes over it (like in RRD).

Handling counter resets is more difficult as it can happen that they change very little (in respect to the maximum boundary) between resets. So in this case some external output should be required when some higher-level code detects that a reset is possible (like on node reboots in case of nodewatcher).