Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto shrink request stats table to fit terminal #1811

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion locust/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from collections import namedtuple, OrderedDict
from copy import copy
from itertools import chain
import os
import csv

import gevent
Expand All @@ -14,7 +15,11 @@

console_logger = logging.getLogger("locust.stats_logger")

STATS_NAME_WIDTH = 60
"""Space in table for request name. Auto shrink it if terminal is small (<160 characters)"""
try:
STATS_NAME_WIDTH = max(min(os.get_terminal_size()[0] - 80, 80), 0)
except OSError: # not a real terminal
STATS_NAME_WIDTH = 80
STATS_TYPE_WIDTH = 8

"""Default interval for how frequently results are written to console."""
Expand Down