Ejemplo n.º 1
0
def get_boxplot_endpoints(endpoint=None, form=None):
    """
    Generates a box plot visualization for the unit test endpoint hits performance results.
    :param endpoint: if specified, generate box plot for a specific endpoint, otherwise, generate for all tests
    :param form: the form that can be used for showing a subset of the data
    :return:
    """
    trace = []
    with session_scope() as db_session:
        if form:
            ids = get_travis_builds(db_session, limit=form.get_slider_value())
        else:
            ids = get_travis_builds(db_session)

        if not ids:
            return None
        for id in ids:
            if endpoint:
                values = get_endpoint_measurements_job(db_session,
                                                       name=endpoint,
                                                       job_id=id)
            else:
                values = get_endpoint_measurements(db_session, suite=id)

            trace.append(boxplot(values=values, label='{} -'.format(id)))

        layout = get_layout(xaxis={'title': 'Execution time (ms)'},
                            yaxis={
                                'title': 'Travis Build',
                                'autorange': 'reversed'
                            })

        return get_figure(layout=layout, data=trace)
Ejemplo n.º 2
0
def get_boxplot_tests(form=None):
    """
    Generates a box plot visualization for the unit test performance results.
    :param form: the form that can be used for showing a subset of the data
    :return:
    """
    trace = []
    with session_scope() as db_session:
        if form:
            suites = get_test_suites(db_session, limit=form.get_slider_value())
        else:
            suites = get_test_suites(db_session)

        if not suites:
            return None
        for s in suites:
            values = get_suite_measurements(db_session, suite=s)
            trace.append(boxplot(values=values, label='{} -'.format(s)))

        layout = get_layout(xaxis={'title': 'Execution time (ms)'},
                            yaxis={
                                'title': 'Travis Build',
                                'autorange': 'reversed'
                            })

        return get_figure(layout=layout, data=trace)
def endpoint_graph():
    """
    Creates a graph with the execution times per endpoint
    :return:
    """
    with session_scope() as db_session:
        data = get_endpoint_data_grouped(db_session, lambda x: simplify(x, 10))
        values = [
            boxplot(get_value(data, end.id, default=[]), name=end.name)
            for end in get_endpoints(db_session)
        ]

    layout = get_layout(height=350 + 40 * len(values),
                        xaxis={'title': 'Execution time (ms)'},
                        margin=get_margin())
    return get_figure(layout, values)
Ejemplo n.º 4
0
def users_graph(id, form):
    """
    Return an HTML box plot with a specific number of
    :param id: get the data for this endpoint only
    :param form: instance of SliderForm
    :return:
    """
    with session_scope() as db_session:
        users = get_users(db_session, id, form.get_slider_value())
        times = get_user_data_grouped(db_session, lambda x: simplify(x, 10),
                                      Request.endpoint_id == id)
        data = [boxplot(name=u, values=get_value(times, u)) for u in users]

    layout = get_layout(height=350 + 40 * len(data),
                        xaxis={'title': 'Execution time (ms)'},
                        yaxis={
                            'type': 'category',
                            'title': 'User'
                        })
    return get_figure(layout, data)
def versions_graph(db_session, endpoint_id, form):
    times = get_version_data_grouped(db_session, lambda x: simplify(x, 10),
                                     Request.endpoint_id == endpoint_id)
    first_requests = get_first_requests(db_session, endpoint_id,
                                        form.get_slider_value())
    data = [
        boxplot(name=format_version(
            request.version_requested,
            get_value(first_requests, request.version_requested)),
                values=get_value(times, request.version_requested),
                marker={'color': get_color(request.version_requested)})
        for request in first_requests
    ]

    layout = get_layout(height=350 + 40 * len(first_requests),
                        xaxis={'title': 'Execution time (ms)'},
                        yaxis={
                            'type': 'category',
                            'title': 'Version',
                            'autorange': 'reversed'
                        },
                        margin=get_margin())
    return get_figure(layout=layout, data=data)