Bring in latest changes from dev.

Includes change to CPU detection and thread-safety of custom dimensions and metrics.