autotest: gs cache: fix of list_suite_control metrics
This CL changes two things:
1: Distinguish the exceptions raised to help us to tell if the gs cache
server is really in trouble.
2: Set scale to 0.001 to the timers of calls to both gs_cache server and
devserver, so that we can have more precise results.
BUG=chromium:875349
TEST=Ran unit tests.
Change-Id: I7a6e7869bdb736fdd9fb806105d814db56ac11a6
Reviewed-on: https://chromium-review.googlesource.com/1214291
Commit-Ready: Congbin Guo <guocb@chromium.org>
Tested-by: Congbin Guo <guocb@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/client/common_lib/cros/gs_cache_client.py b/client/common_lib/cros/gs_cache_client.py
index 9a5eeea..67c00cb 100644
--- a/client/common_lib/cros/gs_cache_client.py
+++ b/client/common_lib/cros/gs_cache_client.py
@@ -211,7 +211,7 @@
try:
with metrics.SecondsTimer(
METRICS_PATH + '/call_timer', record_on_exception=True,
- add_exception_field=True,
+ add_exception_field=True, scale=0.001,
fields={'rpc_name': 'list_suite_controls',
'is_gs_cache_call': True}
):
@@ -223,14 +223,17 @@
logging.warn('GS Cache Error: %s', err)
logging.warn(
'Falling back to devserver call of "list_suite_controls".')
- c = metrics.Counter(METRICS_PATH + '/fallback_to_devserver')
+ c = metrics.Counter(METRICS_PATH + '/fallback_to_devserver_2')
+ error_type = ('other' if isinstance(err, NoGsCacheServerError) else
+ 'gs_cache_error')
c.increment(fields={'rpc_server': self._api.server_netloc,
- 'rpc_name': 'list_suite_controls'})
+ 'rpc_name': 'list_suite_controls',
+ 'error_type': error_type})
try:
with metrics.SecondsTimer(
METRICS_PATH + '/call_timer', record_on_exception=True,
- add_exception_field=True,
+ add_exception_field=True, scale=0.001,
fields={'rpc_name': 'list_suite_controls',
'is_gs_cache_call': False}
):