The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Kevin Wang (3) [Avatar] Offline
The cloudwatch.js has a function recordTimeInMillis which supposed to log the execution time for an operation. But sometimes the operation is very fast (in my case, the MongoDB's the fetching operation becomes so fast after several calls), which the operation time even equals 0ms. When this happens, the recordTimeInMillis function will just return without logging anything. I changed the code in recordTimeInMillis function from
if (!ms) {


if (!ms && ms !== 0) {

It can help the logging behavior more consistently. I hope this can help others as well.
Yan Cui (73) [Avatar] Offline
Yeah that makes sense, the granularity of the node.js timer module just isn't granular enough in this case. Good call.