コード例 #1
0
ファイル: test_core.py プロジェクト: strangeman/grafanalib
def dummy_alert_condition() -> G.AlertCondition:
    return G.AlertCondition(
        target=G.Target(),
        evaluator=G.Evaluator(type=G.EVAL_GT, params=42),
        timeRange=G.TimeRange(from_time='5m', to_time='now'),
        operator=G.OP_AND,
        reducerType=G.RTYPE_AVG,
    )
コード例 #2
0
def test_graph_panel_alert():
    data_source = 'dummy data source'
    targets = ['dummy_prom_query']
    title = 'dummy title'
    alert = [
        G.AlertCondition(G.Target(), G.Evaluator('a', 'b'), G.TimeRange('5', '6'), 'd', 'e')
    ]
    thresholds = [
        G.GraphThreshold(20.0),
        G.GraphThreshold(40.2, colorMode="ok")
    ]
    graph = G.Graph(data_source, targets, title, thresholds=thresholds, alert=alert)
    data = graph.to_json_data()
    assert data['targets'] == targets
    assert data['datasource'] == data_source
    assert data['title'] == title
    assert data['alert'] == alert
    assert data['thresholds'] == []
コード例 #3
0
def dummy_evaluator() -> G.Evaluator:
    return G.Evaluator(
        type=G.EVAL_GT,
        params=42
    )