sawtooth.cli.stats_lib.stats_utils module

class sawtooth.cli.stats_lib.stats_utils.ValidatorCommunications[source]

Bases: object

get_request(path, ccb=None, ecb=None)[source]
class sawtooth.cli.stats_lib.stats_utils.StatsModule[source]

Bases: object

initialize(module_list)[source]
connect()[source]
collect()[source]
process()[source]
analyze()[source]
report()[source]
stop()[source]
get_module(class_reference, default=None)[source]
class sawtooth.cli.stats_lib.stats_utils.DictWalker[source]

Bases: object

walk(data_dict)[source]
get_data()[source]
get_names()[source]
class sawtooth.cli.stats_lib.stats_utils.TransactionRate[source]

Bases: object

calculate_txn_rate(current_block_count, current_txn_count, window_size=10)[source]
Parameters:
  • current_block_count – current number of committed blocks
  • current_txn_count – current number of committed transactions
  • window_size – number of blocks to average over
Synopsis:
Each time the block count changes, a snapshot of the current number of committed txns and current time is placed in the queue. If there are two or more entries in the queue, the average txn rate and average block commit time is calculated. If there are more than window_size transactions in the queue, the oldest entry is popped from the queue.
Returns:average number of transactions per second avg_block_time: average block commit time
Return type:avg_txn_rate
class sawtooth.cli.stats_lib.stats_utils.StatsCollector[source]

Bases: object

get_names()[source]

Returns: All data element names as list - for csv writer (header)

get_data()[source]

Returns: All data element values in list - for csv writer

get_data_as_dict()[source]

Returns: returns platform stats as dictionary - for stats web interface

pprint_stats()[source]
sawtooth.cli.stats_lib.stats_utils.get_public_attrs_as_dict(class_instance)[source]
sawtooth.cli.stats_lib.stats_utils.named_tuple_init(named_tuple, default=0, defaults=None)[source]

Initialize the instance rather than the named tuple itself because some values have to be initialized at runtime :param named_tuple: named tuple instance of which is to be returned :param default: default value to be applied to all fields :param defaults: dict of default values to be applied to specified fields

Returns:an initialized instance of the named_tuple
class sawtooth.cli.stats_lib.stats_utils.SignalHandler[source]

Bases: sawtooth.cli.stats_lib.stats_utils.StatsModule