How to use the grafanalib.core.Row function in grafanalib

To help you get started, we’ve selected a few grafanalib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kubernetes / perf-tests / clusterloader2 / pkg / prometheus / manifests / dashboards / defaults.py View on Github external
time = attr.ib(default=g.Time("now-30d", "now"))
    # Make it possible to use $source as a source.
    templating = attr.ib(default=g.Templating(list=[SOURCE_TEMPLATE]))


# Graph is a g.Graph with reasonable defaults applied.
@attr.s
class Graph(g.Graph):
    dataSource = attr.ib(default="$source")
    span = attr.ib(default=g.TOTAL_SPAN)
    tooltip = attr.ib(default=DECREASING_ORDER_TOOLTIP)
    nullPointMode = attr.ib(default=None)


@attr.s
class Row(g.Row):
    height = attr.ib(default=PANEL_HEIGHT)


@attr.s
class Target(g.Target):
    interval = attr.ib(default="5s")
    intervalFactor = attr.ib(default=1)


def simple_graph(title, exprs, legend="", interval="5s", **kwargs):
    if not isinstance(exprs, (list, tuple)):
        exprs = [exprs]
    if legend != "" and len(exprs) != 1:
        raise ValueError("legend can be specified only for a 1-element exprs")
    return Graph(
        title=title,
github mesosphere / spark-build / scale-tests / sdk.dashboard.py View on Github external
def resource_row(pod_type: str = None) -> G.Row:
    """
    Construct a Grafana row with resource statistics.
    """
    if pod_type:
        title = "Resources for pods of type {}".format(POD_TYPE_VARIABLE)
    else:
        title = "Resources for all pod types"

    selection = dict(framework_name=FRAMEWORK_VARIABLE)
    if pod_type:
        selection["executor_name"] = pod_type

    return G.Row(
        title=title,
        repeat=POD_TYPE_VARIABLE.lstrip("$") if pod_type else "",
        panels=[
            W.prometheus.PromGraph(
                data_source=PROMETHEUS_DATA_SOURCE,
                title="CPU",
                expressions=[
                    dict(expr=reduction('sum', metric(m, selection), selection),
                         legendFormat=title)
                    for m, title in [('cpus_limit', 'Available')]
                ],
                span=3,
                steppedLine=True,
                yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
            ),
            W.prometheus.PromGraph(
github mesosphere / spark-build / scale-tests / sdk.dashboard.py View on Github external
"declines_long",
        "revives",
        "revives_throttles",
        "declines_short",
    ]

    resolution = "1m"

    offer_timers = [
        "offers_process_p50",
        "offers_process_p90",
        "offers_process_p99",
        "offers_process_max",
    ]

    return G.Row(
        title="Scheduler statistics",
        panels=[
            W.prometheus.PromGraph(
                data_source=PROMETHEUS_DATA_SOURCE,
                title="cumulative offer statistic",
                expressions=[
                    {"expr": sum(service_metric(m)), "legendFormat": m}
                    for m in offer_metrics
                ],
                span=3,
                steppedLine=True,
                yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
            ),
            W.prometheus.PromGraph(
                data_source=PROMETHEUS_DATA_SOURCE,
                title="offer events per second [{} rate]".format(resolution),
github mesosphere / spark-build / scale-tests / sdk.dashboard.py View on Github external
def task_row() -> G.Row:
    """
    Construct a Grafana row containing scheduler task statistics
    """
    task_metrics = [
        "task_status_task_running",
        "task_status_task_finished",
        "task_status_task_lost",
        "task_status_task_failed",
    ]

    resolution = "1m"

    return G.Row(
        title="Task statistics",
        panels=[
            W.prometheus.PromGraph(
                data_source=PROMETHEUS_DATA_SOURCE,
                title="cumulative task statistic",
                expressions=[
                    {"expr": sum(service_metric(m)), "legendFormat": m}
                    for m in task_metrics
                ],
                span=3,
                steppedLine=True,
                yAxes=G.YAxes(left=G.YAxis(format="short", decimals=0)),
            ),
            W.prometheus.PromGraph(
                data_source=PROMETHEUS_DATA_SOURCE,
                title="task events per second [{} rate]".format(resolution),
github prometheus-operator / prometheus-operator / contrib / kube-prometheus / assets / grafana / _grafanalib.py View on Github external
def Row(
    panels, height=None, title='Dashboard Row', showTitle=False
):
    assert isinstance(height, (type(None), int))
    return core.Row(
        panels=panels, height=height, title=title, showTitle=showTitle,
        titleSize='h6', editable=False,
    )
github LeastAuthority / leastauthority.com / k8s / monitoring / grafana-dashboards.py View on Github external
G.Row(
                title="Cluster",
                panels=[
                    cpu_usage(PROMETHEUS, ["1m", "5m", "10m"]),
                    memory_usage(PROMETHEUS),
                    network_usage(PROMETHEUS),
                    filesystem_usage(PROMETHEUS),
                ],
            ),
            G.Row(
                title="Cluster2",
                panels=[
                    process_open_fds(PROMETHEUS),
                ],
            ),
            G.Row(panels=[
                tahoe_lafs_transfer_rate(PROMETHEUS),
                s4_customer_deployments(PROMETHEUS),
                unhandled_errors(PROMETHEUS),
            ]),
github LeastAuthority / leastauthority.com / k8s / monitoring / grafana-dashboards.py View on Github external
refId="D",
                        ),
                    ],
                ),
                last_convergence(PROMETHEUS),
            ]),
            G.Row(
                title="Cluster",
                panels=[
                    cpu_usage(PROMETHEUS, ["1m", "5m", "10m"]),
                    memory_usage(PROMETHEUS),
                    network_usage(PROMETHEUS),
                    filesystem_usage(PROMETHEUS),
                ],
            ),
            G.Row(
                title="Cluster2",
                panels=[
                    process_open_fds(PROMETHEUS),
                ],
            ),
            G.Row(panels=[
                tahoe_lafs_transfer_rate(PROMETHEUS),
                s4_customer_deployments(PROMETHEUS),
                unhandled_errors(PROMETHEUS),
            ]),