def __init__(self): self.cp = ConsolePrint() self.ss = SystemStats() self.ps = PlatformStats() self.psis = PlatformIntervalStats() self.ps.psis = self.psis self.previous_net_bytes_recv = 0 self.previous_net_bytes_sent = 0 self.clients = [] self.known_endpoint_urls = [] self.known_endpoint_names = [] self.stats_loop_count = 0 self.tm = TopologyManager(self.clients) self.spm = StatsPrintManager( self.ss, self.ps, self.tm.topology_stats, self.clients) self.sscm = SummaryStatsCsvManager(self.ss, self.ps) self.vscm = ValidatorStatsCsvManager(self.clients)
def __init__(self, endpointmanager): self.epm = endpointmanager self.cp = ConsolePrint() self.ss = SystemStats() self.ps = PlatformStats() self.psis = PlatformIntervalStats() self.ps.psis = self.psis self.previous_net_bytes_recv = 0 self.previous_net_bytes_sent = 0 self.clients = [] self.known_endpoint_names = [] self.endpoints = {} self.stats_loop_count = 0 self.tm = TopologyManager(self.clients) self.bm = BranchManager(self.epm, Agent(reactor)) stats_providers = [ self.ss, self.ps, self.tm.topology_stats, self.bm, self.clients ] self.spm = StatsPrintManager(*stats_providers) self.ssw = StatsSnapshotWriter(*stats_providers) self.sscm = SummaryStatsCsvManager(self.ss, self.ps) self.vscm = ValidatorStatsCsvManager(self.clients)
def __init__(self, endpointmanager): self.epm = endpointmanager self.cp = ConsolePrint() self.ss = SystemStats() self.ps = PlatformStats() self.psis = PlatformIntervalStats() self.ps.psis = self.psis self.previous_net_bytes_recv = 0 self.previous_net_bytes_sent = 0 self.clients = [] self.known_endpoint_names = [] self.endpoints = {} self.stats_loop_count = 0 self.tm = TopologyManager(self.clients) self.bm = BranchManager(self.epm, Agent(reactor)) stats_providers = [self.ss, self.ps, self.tm.topology_stats, self.bm, self.clients] self.spm = StatsPrintManager(*stats_providers) self.ssw = StatsSnapshotWriter(*stats_providers) self.sscm = SummaryStatsCsvManager(self.ss, self.ps) self.vscm = ValidatorStatsCsvManager(self.clients)
class StatsManager(object): def __init__(self): self.cp = ConsolePrint() self.ss = SystemStats() self.ps = PlatformStats() self.psis = PlatformIntervalStats() self.ps.psis = self.psis self.previous_net_bytes_recv = 0 self.previous_net_bytes_sent = 0 self.clients = [] self.known_endpoint_urls = [] self.known_endpoint_names = [] self.stats_loop_count = 0 self.tm = TopologyManager(self.clients) self.spm = StatsPrintManager( self.ss, self.ps, self.tm.topology_stats, self.clients) self.sscm = SummaryStatsCsvManager(self.ss, self.ps) self.vscm = ValidatorStatsCsvManager(self.clients) def initialize_client_list(self, endpoints): # add validator stats client for each endpoint for val_num, endpoint in enumerate(endpoints.values()): url = 'http://{0}:{1}'.format( endpoint["Host"], endpoint["HttpPort"]) try: c = StatsClient(val_num, url) c.name = endpoint["Name"] self.known_endpoint_names.append(endpoint["Name"]) except: e = sys.exc_info()[0] print ("error creating stats clients: ", e) self.clients.append(c) def update_client_list(self, endpoints): # add validator stats client for each endpoint name for val_num, endpoint in enumerate(endpoints.values()): if endpoint["Name"] not in self.known_endpoint_names: val_num = len(self.known_endpoint_names) url = 'http://{0}:{1}'.format( endpoint["Host"], endpoint["HttpPort"]) c = StatsClient(val_num, url) c.name = endpoint["Name"] self.clients.append(c) self.known_endpoint_names.append(endpoint["Name"]) def stats_loop(self): self.process_stats(self.clients) self.print_stats() self.csv_write() for c in self.clients: c.stats_request() self.stats_loop_count += 1 return def stats_loop_done(self, result): reactor.stop() def stats_loop_error(self, failure): self.cp.cpstop() print failure reactor.stop() def process_stats(self, statsclients): self.ss.known_validators = len(statsclients) self.ss.active_validators = 0 self.ss.collect_stats(statsclients) self.ss.calculate_stats() self.ps.get_stats() psr = {"platform": self.ps.get_data_as_dict()} self.psis.calculate_interval_stats(psr) self.tm.update_topology() def print_stats(self): self.spm.print_stats() def csv_init(self, enable_summary, enable_validator): if enable_summary is True: self.sscm.initialize() if enable_validator is True: self.vscm.initialize() def csv_write(self): self.sscm.write_stats() self.vscm.write_stats() def csv_stop(self): self.sscm.stop() self.vscm.stop() def stats_stop(self): print "StatsManager is stopping" self.cp.cpstop() self.csv_stop()
class StatsManager(object): def __init__(self): self.cp = ConsolePrint() self.ss = SystemStats() self.ps = PlatformStats() self.psis = PlatformIntervalStats() self.ps.psis = self.psis self.previous_net_bytes_recv = 0 self.previous_net_bytes_sent = 0 self.clients = [] self.known_endpoint_urls = [] self.known_endpoint_names = [] self.stats_loop_count = 0 self.spm = StatsPrintManager(self.ss, self.ps, self.clients) self.sscm = SummaryStatsCsvManager(self.ss, self.ps) self.vscm = ValidatorStatsCsvManager(self.clients) def initialize_client_list(self, endpoints): # add validator stats client for each endpoint for val_num, endpoint in enumerate(endpoints.values()): url = 'http://{0}:{1}'.format( endpoint["Host"], endpoint["HttpPort"]) try: c = StatsClient(val_num, url) c.name = endpoint["Name"] self.known_endpoint_names.append(endpoint["Name"]) except: e = sys.exc_info()[0] print ("error creating stats clients: ", e) self.clients.append(c) def update_client_list(self, endpoints): # add validator stats client for each endpoint name for val_num, endpoint in enumerate(endpoints.values()): if endpoint["Name"] not in self.known_endpoint_names: val_num = len(self.known_endpoint_names) url = 'http://{0}:{1}'.format( endpoint["Host"], endpoint["HttpPort"]) c = StatsClient(val_num, url) c.name = endpoint["Name"] self.clients.append(c) self.known_endpoint_names.append(endpoint["Name"]) def stats_loop(self): self.process_stats(self.clients) self.print_stats() self.csv_write() for c in self.clients: c.stats_request() self.stats_loop_count += 1 return def stats_loop_done(self, result): reactor.stop() def stats_loop_failed(self, failure): print failure.getBriefTraceback() reactor.stop() def process_stats(self, statsclients): self.ss.known_validators = len(statsclients) self.ss.active_validators = 0 self.ss.collect_stats(statsclients) self.ss.calculate_stats() self.ps.get_stats() psr = {"platform": self.ps.get_data_as_dict()} self.psis.calculate_interval_stats(psr) def print_stats(self): self.spm.print_stats() def csv_init(self, enable_summary, enable_validator): if enable_summary is True: self.sscm.initialize() if enable_validator is True: self.vscm.initialize() def csv_write(self): self.sscm.write_stats() self.vscm.write_stats() def csv_stop(self): self.sscm.stop() self.vscm.stop() def stats_stop(self): print "StatsManager is stopping" self.cp.cpstop() self.csv_stop()