def render_logs_progress(): valid_checks = get_available_logs_integrations() total_checks = len(valid_checks) checks_with_logs = 0 lines = ['## Logs support', '', None, '', '??? check "Completed"'] for check in valid_checks: status = None tile_only = is_tile_only(check) check_has_logs = has_logs(check) if not tile_only: status = ' ' if check_has_logs: status = 'X' checks_with_logs += 1 if status != 'X' and tile_only: total_checks -= 1 # we cannot really add log collection to tile only integrations if status is not None: lines.append(f' - [{status}] {check}') percent = checks_with_logs / total_checks * 100 formatted_percent = f'{percent:.2f}' lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]' lines[4] = f'??? check "Completed {checks_with_logs}/{total_checks}"' return lines
def render_saved_views_progress(): valid_checks = get_available_logs_integrations() total_checks = len(valid_checks) checks_with_sv = 0 lines = ['## Default saved views', '', None, '', '??? check "Completed"'] for check in valid_checks: if has_saved_views(check): checks_with_sv += 1 status = 'X' else: status = ' ' lines.append(f' - [{status}] {check}') percent = checks_with_sv / total_checks * 100 formatted_percent = f'{percent:.2f}' lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]' return lines
def render_logs_progress(): valid_checks = get_available_logs_integrations() total_checks = len(valid_checks) checks_with_logs = 0 lines = ['## Logs support', '', None, '', '??? check "Completed"'] for check in valid_checks: status = None has_logs = False tile_only = is_tile_only(check) if not tile_only: status = ' ' config_file = get_config_file(check) with open(config_file, 'r', encoding='utf-8') as f: if '# logs:' in f.read(): status = 'X' checks_with_logs += 1 has_logs = True if not has_logs: readme_file = get_readme_file(check) if os.path.exists(readme_file): with open(readme_file, 'r', encoding='utf-8') as f: if '# Log collection' in f.read(): status = 'X' checks_with_logs += 1 if status != 'X' and tile_only: total_checks -= 1 # we cannot really add log collection to tile only integrations if status is not None: lines.append(f' - [{status}] {check}') percent = checks_with_logs / total_checks * 100 formatted_percent = f'{percent:.2f}' lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]' return lines