How to calculate kWh from amps
When you calculate kWh you are actually calculating energy, which is indeed the integral of power over time.

When you get discrete measurements of power, the easiest thing to do is to assume that the power remained constant for the entire time period since the previous measurement. So, multiply each power measurement by the time since the last power measurement and you have an estimate of how much energy was consumed since the previous measurement. Just add up these energy estimates for as long as you like, and you have an estimate for the total energy consumed over that period of time.

Be sure to mind the time units when making these calculations. It might be easiest to calculate watts times seconds (which equals joules) at each measurement interval. After you have added the number of joules that were used you can convert to watt-hours by dividing by 3600 (number of seconds in an hour). Divide again by 1000 to get kWh.