s/starttime/start_time/

This commit is contained in:
yuvipanda
2017-12-10 17:00:15 -08:00
parent 2559632079
commit 2099cd37fa

View File

@@ -390,7 +390,7 @@ class BaseHandler(RequestHandler):
@gen.coroutine @gen.coroutine
def spawn_single_user(self, user, server_name='', options=None): def spawn_single_user(self, user, server_name='', options=None):
# in case of error, include 'try again from /hub/home' message # in case of error, include 'try again from /hub/home' message
spawn_starttime = time.perf_counter() spawn_start_time = time.perf_counter()
self.extra_error_html = self.spawn_home_error self.extra_error_html = self.spawn_home_error
user_server_name = user.name user_server_name = user.name
@@ -403,7 +403,7 @@ class BaseHandler(RequestHandler):
SPAWN_DURATION_SECONDS.labels( SPAWN_DURATION_SECONDS.labels(
status='already-pending' status='already-pending'
).observe( ).observe(
time.perf_counter() - spawn_starttime time.perf_counter() - spawn_start_time
) )
raise RuntimeError("%s pending %s" % (user_server_name, pending)) raise RuntimeError("%s pending %s" % (user_server_name, pending))
@@ -426,7 +426,7 @@ class BaseHandler(RequestHandler):
SPAWN_DURATION_SECONDS.labels( SPAWN_DURATION_SECONDS.labels(
status='throttled' status='throttled'
).observe( ).observe(
time.perf_counter() - spawn_starttime time.perf_counter() - spawn_start_time
) )
raise web.HTTPError( raise web.HTTPError(
429, 429,
@@ -440,7 +440,7 @@ class BaseHandler(RequestHandler):
SPAWN_DURATION_SECONDS.labels( SPAWN_DURATION_SECONDS.labels(
status='too-many-users' status='too-many-users'
).observe( ).observe(
time.perf_counter() - spawn_starttime time.perf_counter() - spawn_start_time
) )
raise web.HTTPError(429, "Active user limit exceeded. Try again in a few minutes.") raise web.HTTPError(429, "Active user limit exceeded. Try again in a few minutes.")
@@ -477,9 +477,9 @@ class BaseHandler(RequestHandler):
SPAWN_DURATION_SECONDS.labels( SPAWN_DURATION_SECONDS.labels(
status='success' status='success'
).observe( ).observe(
time.perf_counter() - spawn_starttime time.perf_counter() - spawn_start_time
) )
proxy_add_starttime = time.perf_counter() proxy_add_start_time = time.perf_counter()
spawner._proxy_pending = True spawner._proxy_pending = True
try: try:
yield self.proxy.add_user(user, server_name) yield self.proxy.add_user(user, server_name)
@@ -487,7 +487,7 @@ class BaseHandler(RequestHandler):
PROXY_ADD_DURATION_SECONDS.labels( PROXY_ADD_DURATION_SECONDS.labels(
status='success' status='success'
).observe( ).observe(
time.perf_counter() - proxy_add_starttime time.perf_counter() - proxy_add_start_time
) )
except Exception: except Exception:
self.log.exception("Failed to add %s to proxy!", user_server_name) self.log.exception("Failed to add %s to proxy!", user_server_name)
@@ -496,7 +496,7 @@ class BaseHandler(RequestHandler):
PROXY_ADD_DURATION_SECONDS.labels( PROXY_ADD_DURATION_SECONDS.labels(
status='failure' status='failure'
).observe( ).observe(
time.perf_counter() - proxy_add_starttime time.perf_counter() - proxy_add_start_time
) )
else: else:
spawner.add_poll_callback(self.user_stopped, user, server_name) spawner.add_poll_callback(self.user_stopped, user, server_name)
@@ -537,7 +537,7 @@ class BaseHandler(RequestHandler):
SPAWN_DURATION_SECONDS.labels( SPAWN_DURATION_SECONDS.labels(
status='failed' status='failed'
).observe( ).observe(
time.perf_counter() - spawn_starttime time.perf_counter() - spawn_start_time
) )
raise web.HTTPError(500, "Spawner failed to start [status=%s]. The logs for %s may contain details." % ( raise web.HTTPError(500, "Spawner failed to start [status=%s]. The logs for %s may contain details." % (
status, spawner._log_name)) status, spawner._log_name))