How to use the grafanalib.core.Graph 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 LeastAuthority / leastauthority.com / k8s / monitoring / grafana-dashboards.py View on Github external
def memory_usage(datasource):
    return G.Graph(
        title="Memory Usage",
        dataSource=datasource,

        xAxis=X_TIME,
        yAxes=[
            G.YAxis(
                # 2 ^ 30 bytes
                format="gbytes",
                label="Memory",
            ),
            G.YAxis(
                show=False,
            ),
        ],
        targets=[
            G.Target(
github LeastAuthority / leastauthority.com / k8s / monitoring / grafana-dashboards.py View on Github external
def unhandled_errors(datasource):
    return G.Graph(
        title="Unhandled Errors",
        dataSource=datasource,

        xAxis=X_TIME,
        yAxes=[
            G.YAxis(
                format="none",
                label="Count",
            ),
            G.YAxis(
                show=False,
            ),
        ],

        targets=[
            G.Target(
github weaveworks / grafanalib / grafanalib / prometheus.py View on Github external
letters = string.ascii_uppercase
    expressions = list(expressions)
    if len(expressions) > len(letters):
        raise ValueError(
            'Too many expressions. Can support at most {}, but got {}'.format(
                len(letters), len(expressions)))

    if all(isinstance(expr, dict) for expr in expressions):
        targets = [
            G.Target(refId=refId, **args)
            for (args, refId) in zip(expressions, letters)]
    else:
        targets = [
            G.Target(expr=expr, legendFormat=legend, refId=refId)
            for ((legend, expr), refId) in zip(expressions, letters)]
    return G.Graph(
        title=title,
        dataSource=data_source,
        targets=targets,
        **kwargs
    )
github LeastAuthority / leastauthority.com / k8s / monitoring / grafana-dashboards.py View on Github external
def network_usage(datasource):
    return G.Graph(
        title="Network Usage",
        dataSource=datasource,

        xAxis=X_TIME,
        yAxes=[
            G.YAxis(
                # 2^20 bytes / second
                format="MBs",
                label="Transferred",
            ),
            G.YAxis(
                show=False,
            ),
        ],
        targets=[
            G.Target(
github LeastAuthority / leastauthority.com / k8s / monitoring / grafana-dashboards.py View on Github external
def s4_customer_deployments(datasource):
    return G.Graph(
        title="Customer Deployments",
        dataSource=datasource,

        xAxis=X_TIME,
        yAxes=[
            G.YAxis(
                format="none",
                label="Total Customer Deployments",
                min=0,
                max=100,
            ),
            G.YAxis(
                show=False,
            ),
        ],
github LeastAuthority / leastauthority.com / k8s / monitoring / grafana-dashboards.py View on Github external
def last_convergence(datasource):
    return G.Graph(
        title="Since Last Convergence",
        dataSource=datasource,

        xAxis=X_TIME,
        yAxes=[
            G.YAxis(
                format="none",
                label="Period",
            ),
            G.YAxis(
                show=False,
            ),
        ],

        targets=[
            G.Target(
github prometheus-operator / prometheus-operator / contrib / kube-prometheus / assets / grafana / _grafanalib.py View on Github external
def Graph(
    id, title, targets, dashLength=None, dashes=False, spaceLength=None,
    xAxis=None, yAxes=None, nullPointMode='connected',
):
    def merge_target(target):
        return {**{
            'intervalFactor': 2,
            'legendFormat': '',
            'refId': 'A',
            'step': 600,
        }, **target}

    targets = [merge_target(t) for t in targets]
    assert isinstance(yAxes, YAxes)
    return core.Graph(
        id=id, title=title, dashLength=dashLength, dashes=dashes,
        spaceLength=spaceLength, targets=targets, xAxis=xAxis, yAxes=yAxes,
        dataSource='${DS_PROMETHEUS}', nullPointMode=nullPointMode, editable=False,
    )
github LeastAuthority / leastauthority.com / k8s / monitoring / grafana-dashboards.py View on Github external
legendFormat="Wormhole Signups Started",
                            refId="A",
                        ),
                        G.Target(
                            expr='sum(wormhole_signup_success{pod=~"s4-signup.*"})',
                            legendFormat="Wormhole Signups Completed",
                            refId="B",
                        ),
                        G.Target(
                            expr='sum(wormhole_signup_failure{pod=~"s4-signup.*"})',
                            legendFormat="Wormhole Signups Failed",
                            refId="C",
                        ),
                    ],
                ),
                G.Graph(
                    title="Usage",
                    dataSource=PROMETHEUS,

                    # Stack the connection graphs on each other, revealing
                    # both a total and a distribution across different grid
                    # router instances.
                    stack=True,
                    tooltip=G.Tooltip(
                        valueType=G.INDIVIDUAL,
                    ),

                    xAxis=X_TIME,
                    yAxes=[
                        G.YAxis(
                            format="none",
                            label="Count",
github LeastAuthority / leastauthority.com / k8s / monitoring / grafana-dashboards.py View on Github external
def tahoe_lafs_transfer_rate(datasource):
    def refidgen():
        for i in count():
            yield unicode(i)
    refid = refidgen()


    return G.Graph(
        title="Tahoe-LAFS Benchmarked Transfer Rate",
        dataSource=datasource,

        xAxis=X_TIME,
        yAxes=[
            G.YAxis(
                format="Bps",
                label="Transfer Rate",
            ),
            G.YAxis(
                show=False,
            ),
        ],

        targets=list(
            G.Target(