def render_check_signatures_progress():
    exclude = {
        'datadog_checks_base', 'datadog_checks_dev',
        'datadog_checks_downloader'
    }
    valid_checks = sorted([c for c in get_valid_checks() if c not in exclude])
    total_checks = len(valid_checks)
    checks_with_cs = 0

    lines = [
        '## Agent 8 check signatures', '', None, '', '??? check "Completed"'
    ]
    for check in valid_checks:
        if has_agent_8_check_signature(check):
            status = 'X'
            checks_with_cs += 1
        else:
            status = ' '
        lines.append(f'    - [{status}] {check}')

    percent = checks_with_cs / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[4] = f'??? check "Completed {checks_with_cs}/{total_checks}"'
    return lines
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
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
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
Beispiel #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
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
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
Beispiel #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
Beispiel #9
0
def render_process_signatures_progress():
    valid_checks = sorted(
        [c for c in get_valid_checks() if c not in PROCESS_SIGNATURE_EXCLUDE])
    total_checks = len(valid_checks)
    checks_with_ps = 0

    lines = ['## Process signatures', '', None, '', '??? check "Completed"']
    for check in valid_checks:
        if has_process_signature(check):
            status = 'X'
            checks_with_ps += 1
        else:
            status = ' '
        lines.append(f'    - [{status}] {check}')

    percent = checks_with_ps / total_checks * 100
    formatted_percent = f'{percent:.2f}'
    lines[2] = f'[={formatted_percent}% "{formatted_percent}%"]'
    lines[4] = f'??? check "Completed {checks_with_ps}/{total_checks}"'
    return lines
Beispiel #10
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
Beispiel #11
0
def render_config_validation_progress():
    valid_checks = sorted(c for c in get_valid_checks()
                          if os.path.isfile(get_default_config_spec(c)))
    total_checks = len(valid_checks)
    checks_with_config_validation = 0

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

    for check in valid_checks:
        if has_config_models(check):
            status = 'X'
            checks_with_config_validation += 1
        else:
            status = ' '

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

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