[autotest] Log metadata along with reboot time for host

When a host reboots, we will not log reboot time in
elasticsearch db. The time recorded is the time the
stats.timer object was initialized. Included in the
metadata is the time in seconds of between
timer.start() and timer.stop(). Also refactored stats.py and
es_utils.py so that the default index for anything logged in stats
is formatted: <autotest_instance>_stats_metadata.
BUG=None
TEST=Ran generic_RebootTest, verfied results in elasticsearch db.
Change-Id: Icda3fd6d91a2808a949b9c2894a893c4bf0eadd0
Reviewed-on: https://chromium-review.googlesource.com/208142
Tested-by: Michael Liang <michaelliang@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Michael Liang <michaelliang@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
3 files changed