forked from p15670423/monkey
Delete unused function
This commit is contained in:
parent
31c348d26a
commit
347941c776
|
@ -28,20 +28,16 @@ class PerformanceAnalyzer(Analyzer):
|
|||
if not self.island_client.is_all_monkeys_dead():
|
||||
raise RuntimeError("Can't test report times since not all Monkeys have died.")
|
||||
|
||||
total_time = timedelta()
|
||||
|
||||
# Collect timings for all pages
|
||||
self.island_client.clear_caches()
|
||||
|
||||
report_resource_to_response_time = {}
|
||||
|
||||
for url in REPORT_URLS:
|
||||
report_resource_to_response_time[url] = self.island_client.get_elapsed_for_get_request(url)
|
||||
|
||||
timings = self.island_client.time_all_report_pages()
|
||||
|
||||
# Calculate total time and check each page
|
||||
single_page_time_less_then_max = True
|
||||
|
||||
for page, elapsed in timings.items():
|
||||
total_time = timedelta()
|
||||
for page, elapsed in report_resource_to_response_time.items():
|
||||
logger.info(f"page {page} took {str(elapsed)}")
|
||||
total_time += elapsed
|
||||
if elapsed > MAX_ALLOWED_SINGLE_PAGE_TIME:
|
||||
|
|
|
@ -97,26 +97,6 @@ class MonkeyIslandClient(object):
|
|||
response.raise_for_status()
|
||||
return response
|
||||
|
||||
def time_all_report_pages(self):
|
||||
"""
|
||||
Calculates elapsed time of request for each report URL
|
||||
Make sure to call clear_caches before this function if you want to measure "worst case" generation time.
|
||||
"""
|
||||
REPORT_URLS = [
|
||||
"api/report/security",
|
||||
"api/attack/report",
|
||||
"api/report/zero_trust/findings",
|
||||
"api/report/zero_trust/principles",
|
||||
"api/report/zero_trust/pillars"
|
||||
]
|
||||
|
||||
report_resource_to_response_time = {}
|
||||
|
||||
for url in REPORT_URLS:
|
||||
report_resource_to_response_time[url] = self.get_elapsed_for_get_request(url)
|
||||
|
||||
return report_resource_to_response_time
|
||||
|
||||
def get_elapsed_for_get_request(self, url):
|
||||
response = self.requests.get(url)
|
||||
if response.ok:
|
||||
|
|
Loading…
Reference in New Issue