groups:
- name: Dshackle
  rules:
  - alert: JsonRpcDshackleErrorRateIsHigh
    expr: rate(dshackle_request_jsonrpc_err_total[1m]) > 0.1
    for: 1m
    labels:
      severity: critical
    annotations:
      summary: "Json RPC erorr rate is high for (instance {{ $labels.instance }})"

  - alert: JsonRpcDshackleFailRateIsHigh
    expr: rate(dshackle_request_jsonrpc_fail_total[1m]) > 0.1
    for: 1m
    labels:
      severity: critical
    annotations:
      summary: "Json RPC erorr rate is high for (instance {{ $labels.instance }})"


  - alert: JsonRpcDshackleRateToHigh
    expr: rate(dshackle_request_jsonrpc_request_total[1m]) > 1000
    for: 1m
    labels:
      severity: critical
    annotations:
      summary: "Json RPC rate is high for (instance {{ $labels.instance }})"


  - alert: WsRpcDshackleErrorRateIsHigh
    expr: rate(dshackle_upstream_ws_err_total[1m]) > 0.1
    for: 1m
    labels:
      severity: critical
    annotations:
      summary: "WS RPC erorr rate is high for (instance {{ $labels.instance }})"

  - alert: UpstreamUnavailable
    expr: dshackle_upstreams_availability{status!~"(ok|lagging)"} > 0
    for: 1m
    labels:
      severity: warning
    annotations:
      summary: "One of the eth node is broken (instance {{ $labels.instance }})"

  - alert: NoEthNodesForNetwork
    expr: dshackle_upstreams_connected < 1
    for: 1m
    labels:
      severity: critical
    annotations:
      summary: "No nodes for network on (instance {{ $labels.instance }})"

  - alert: UpstreamIsNotSyncing
    expr: rate(dshackle_upstreams_lag[5m]) < 0
    for: 1m
    labels:
      severity: critical
    annotations:
      summary: "ETH Node is not syncing on host (instance {{ $labels.instance }})"
