Jwang add resource measurements

sanity checks?

1. `queryId` should be a `Long` so you can detect when it's missing.
2. make sure it's not `null` and give an appropriate warning if so.