Skip to content

Commit

Permalink
Merge pull request #531 from fomars/develop
Browse files Browse the repository at this point in the history
Console fix
  • Loading branch information
fomars committed Mar 6, 2018
2 parents 3368271 + 16278f6 commit e22d6fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion yandextank/core/tankcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def wait_for_finish(self):
end_time = time.time()
diff = end_time - begin_time
logger.debug("Polling took %s", diff)
logger.debug("Tank status:\n%s", json.dumps(self.status, indent=2))
logger.debug("Tank status: %s", json.dumps(self.status))
# screen refresh every 0.5 s
if diff < 0.5:
time.sleep(0.5 - diff)
Expand Down
11 changes: 7 additions & 4 deletions yandextank/plugins/Console/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ def __init__(self, window):
self.ticks = '_▁▂▃▄▅▆▇'.decode('utf-8')

def recalc_active(self, ts):
if not self.active_seconds:
self.active_seconds.append(ts)
self.data[ts] = {}
if ts not in self.active_seconds:
if self.active_seconds:
if ts > max(self.active_seconds):
for i in range(max(self.active_seconds) + 1, ts + 1):
self.active_seconds.append(i)
self.active_seconds.sort()
self.data[i] = {}
else:
self.active_seconds.append(ts)
self.data[ts] = {}
while len(self.active_seconds) > self.window:
self.active_seconds.pop(0)
for sec in self.data.keys():
Expand All @@ -241,6 +241,9 @@ def get_key_data(self, key):
def add(self, ts, key, value, color=''):
if ts not in self.data:
self.recalc_active(ts)
if ts < min(self.active_seconds):
self.log.warning('Sparkline got outdated second %s, oldest in list %s', ts, min(self.active_seconds))
return
value = max(value, 0)
self.data[ts][key] = (color, value)

Expand Down
6 changes: 2 additions & 4 deletions yandextank/plugins/DataUploader/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ def format_request_info(self, request, request_id):
'headers': str(self.filter_headers(request.headers)),
'body': request.body.replace('\n', '\\n') if isinstance(request.body, str) else request.body
}
return """
Request: {}""".format(json.dumps(request_info))
return """Request: {}""".format(json.dumps(request_info))

def format_response_info(self, resp, request_id):
response_info = {
Expand All @@ -161,8 +160,7 @@ def format_response_info(self, resp, request_id):
'headers': str(self.filter_headers(resp.headers)),
'content': resp.content.replace('\n', '\\n') if isinstance(resp.content, str) else resp.content
}
return """
Response: {}""".format(json.dumps(response_info))
return """Response: {}""".format(json.dumps(response_info))

def __make_api_request(
self,
Expand Down

0 comments on commit e22d6fd

Please sign in to comment.