def test_datastore_instances(self): datastore = proxy_stats.get_service_instances( 'mocked', 'appscale-datastore_server') self.assertEqual(datastore, [ '10.10.7.86:4000', '10.10.7.86:4001', '10.10.7.86:4002', '10.10.7.86:4003' ])
def test_taskqueue_instances(self): taskqueue = proxy_stats.get_service_instances('mocked', 'TaskQueue') self.assertEqual(taskqueue, [ '10.10.7.86:17447', '10.10.7.86:17448', '10.10.7.86:17449', '10.10.7.86:17450' ])
def test_taskqueue_instances(self): taskqueue = proxy_stats.get_service_instances('mocked', 'TaskQueue') self.assertEqual(taskqueue, [ '10.10.7.86:17447', '10.10.7.86:17448', '10.10.7.86:17449', '10.10.7.86:17450' ])
def test_dashboard_instances(self): dashboard = proxy_stats.get_service_instances( 'mocked', 'gae_appscaledashboard' ) self.assertEqual(dashboard, [ '10.10.9.111:20000', '10.10.9.111:20001', '10.10.9.111:20002' ])
def test_dashboard_instances(self): dashboard = proxy_stats.get_service_instances( 'mocked', 'gae_appscaledashboard' ) self.assertEqual(dashboard, [ '10.10.9.111:20000', '10.10.9.111:20001', '10.10.9.111:20002' ])
def test_datastore_instances(self): datastore = proxy_stats.get_service_instances( 'mocked', 'appscale-datastore_server' ) self.assertEqual(datastore, [ '10.10.7.86:4000', '10.10.7.86:4001', '10.10.7.86:4002', '10.10.7.86:4003' ])
def get_current(self): start_time = time.time() # Find all taskqueue servers tq_instances = proxy_stats.get_service_instances( proxy_stats.HAPROXY_SERVICES_STATS_SOCKET_PATH, "TaskQueue" ) # Query all TQ servers instances_responses = yield [ self.fetch_stats_from_instance(ip_port) for ip_port in tq_instances ] # Select successful instances_stats = [ stats_or_err for stats_or_err in instances_responses if isinstance(stats_or_err, InstanceStatsSnapshot) ] # Select failures failures = [ stats_or_err for stats_or_err in instances_responses if isinstance(stats_or_err, FailureSnapshot) ] # Prepare service stats current_reqs = sum(server.current_requests for server in instances_stats) total_cumulative = self.summarise_cumulative(instances_stats) total_recent = self.summarise_recent(instances_stats) instances_count = len(instances_stats) stats = TaskqueueServiceStatsSnapshot( utc_timestamp=int(time.time()), current_requests=current_reqs, cumulative=total_cumulative, recent=total_recent, instances=instances_stats, instances_count=instances_count, failures=failures ) logger.info( "Fetched Taskqueue server stats from {nodes} instances in {elapsed:.1f}s." .format(nodes=len(instances_stats), elapsed=time.time() - start_time) ) raise gen.Return(stats)
def test_unknown_proxy(self): unknown = proxy_stats.get_service_instances('mocked', 'gae_not_running') self.assertEqual(unknown, [])
def test_unknown_proxy(self): unknown = proxy_stats.get_service_instances('mocked', 'gae_not_running') self.assertEqual(unknown, [])