Accurate estimation of battery usage of a sensor

I want to try to continuously calculate the battery draw of a sensor over time using the INA219 DC Current Sensor.
I am thinking as an example i could:

Get the current every 1 ms
Multiply that value by 1/3600000
Since mAh is calculated by (mA)*(hour) and I'm taking a sample every 1/3600000 of an hour

Add that value to a running total which will show how many mAh's have been drawn since the start of the test.
1 ms will probably be too quick to read the data from the serial port but if i did every 2 ms i would calculate (mA)*(1/1800000) and add that running total. I could do this for any period of sampling i need depending on how precise i want it to be.

I know i can do a much easier estimation using the average current draw but my device has spikeing current and i would like to see if this estimate would be more accurate.

Does this seem to make sense or am I overlooking something here?

I wonder why you want to do this . The capacity of a battery is given at a certain steady current drain.
If you load is small and spiky , then the capacity you get from the battery could be more or less than that stated .
You might miss the spikes too, if they are short as the A/D takes an instantaneous reading

Ahh yes i was overanalyzing this and forgot a battery is a capacitor and smooths the voltage/current spikes... thank you!

Do a bit of googling on coulomb counters. That is the way a lot of people do it.

This is current integration, aka coulomb counting and it is the correct way to do things. If the dynamic range of the current being measured is high, this can be problematic.

Doesn't do anything to the current spikes. A battery is a voltage source with some small resistance in series (aka internal resistance). Any capacitance is irrelevant as the internal resistance and lead stray inductance will dominate.