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
Beispiel #2
0
def render_saved_views_progress():
    valid_checks = [
        x for x in sorted(get_valid_checks())
        if not is_tile_only(x) and has_logs(x)
    ]
    total_checks = len(valid_checks)
    checks_with_sv = 0

    lines = [
        '## Default saved views (for integrations with logs)', '', 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}%"]'
    lines[4] = f'??? check "Completed {checks_with_sv}/{total_checks}"'
    return lines