Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
def _spec_progress(spec_type):
    if spec_type == 'config':
        name = 'Config'
        func = get_default_config_spec
    elif spec_type == 'docs':
        name = 'Docs'
        func = get_default_docs_spec

    valid_checks = [
        x for x in sorted(get_valid_checks()) if not is_tile_only(x)
    ]
    total_checks = len(valid_checks)
    checks_with_spec = 0

    lines = [f'## {name} specs', '', None, '', '??? check "Completed"']

    for check in valid_checks:
        spec_path = func(check)
        if os.path.isfile(spec_path):
            checks_with_spec += 1
            status = 'X'
        else:
            status = ' '

        lines.append(f'    - [{status}] {check}')

    percent = checks_with_spec / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[4] = f'??? check "Completed {checks_with_spec}/{total_checks}"'
    return lines
Ejemplo n.º 3
0
def render_logs_progress():
    valid_checks = sorted(get_valid_checks())
    total_checks = len(valid_checks)
    checks_with_logs = 0

    lines = ['## Logs support', '', None, '', '??? check "Completed"']

    for check in valid_checks:
        status = None

        if not is_tile_only(check):
            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
        else:
            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':
                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
Ejemplo n.º 4
0
def render_metadata_progress():
    valid_checks = [
        x for x in sorted(get_valid_checks())
        if not is_tile_only(x) and not is_logs_only(x)
    ]
    total_checks = len(valid_checks)
    checks_with_metadata = 0

    lines = ['## Metadata submission', '', None, '', '??? check "Completed"']

    for check in valid_checks:
        status = ' '
        check_file = get_check_file(check)
        if os.path.exists(check_file):
            with open(check_file, 'r', encoding='utf-8') as f:
                contents = f.read()
                if 'self.set_metadata' in contents:
                    status = 'X'
                    checks_with_metadata += 1
        lines.append(f'    - [{status}] {check}')

    percent = checks_with_metadata / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[4] = f'??? check "Completed {checks_with_metadata}/{total_checks}"'
    return lines
Ejemplo n.º 5
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
Ejemplo n.º 6
0
def render_config_spec_progress():
    valid_checks = [
        x for x in sorted(get_valid_checks()) if not is_tile_only(x)
    ]
    total_checks = len(valid_checks)
    checks_with_config_spec = 0

    lines = ['## Config specs', '', None, '', '??? check "Completed"']

    for check in valid_checks:
        config_spec_path = get_default_config_spec(check)
        if os.path.isfile(config_spec_path):
            checks_with_config_spec += 1
            status = 'X'
        else:
            status = ' '

        lines.append(f'    - [{status}] {check}')

    percent = checks_with_config_spec / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[
        4] = f'??? check "Completed {checks_with_config_spec}/{total_checks}"'
    return lines
Ejemplo n.º 7
0
def render_e2e_progress():
    valid_checks = [x for x in sorted(get_valid_checks()) if not is_tile_only(x)]
    total_checks = len(valid_checks)
    checks_with_e2e = 0

    lines = ['## E2E tests', '', None, '', '??? check "Completed"']

    for check in valid_checks:
        if has_e2e(check):
            status = 'X'
            checks_with_e2e += 1
        else:
            status = ' '
        lines.append(f'    - [{status}] {check}')

    percent = checks_with_e2e / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    return lines
Ejemplo n.º 8
0
def render_logs_progress():
    not_possible = {
        'sap_hana'  # https://github.com/DataDog/architecture/blob/master/rfcs/agent-integrations/sap_hana.md#open-questions
    }
    valid_checks = sorted(set(get_valid_checks()).difference(not_possible))
    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
Ejemplo n.º 9
0
def render_recommended_monitors_progress():
    valid_checks = [x for x in sorted(get_valid_checks()) if not is_tile_only(x)]
    total_checks = len(valid_checks)
    checks_with_rm = 0

    lines = ['## Recommended monitors', '', None, '', '??? check "Completed"']

    for check in valid_checks:
        if has_recommended_monitor(check):
            checks_with_rm += 1
            status = 'X'
        else:
            status = ' '

        lines.append(f'    - [{status}] {check}')

    percent = checks_with_rm / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[4] = f'??? check "Completed {checks_with_rm}/{total_checks}"'
    return lines