apiVersion: 1
groups:
  - orgId: 1
    name: load-tester
    folder: canton-network
    interval: 1m
    rules:
      - uid: a1dbc4e8-7941-4351-9a14-f8573fd2be2b
        title: K6 Request Failure Rate Exceeded
        condition: D
        data:
          - refId: A
            relativeTimeRange:
              from: 300
              to: 0
            datasourceUid: prometheus
            model:
              disableTextWrap: false
              editorMode: builder
              expr: sum(k6_http_reqs_total)
              fullMetaSearch: false
              includeNullMetadata: true
              instant: true
              intervalMs: 1000
              legendFormat: __auto
              maxDataPoints: 43200
              range: false
              refId: A
              useBackend: false
          - refId: B
            relativeTimeRange:
              from: 300
              to: 0
            datasourceUid: prometheus
            model:
              datasource:
                type: prometheus
                uid: prometheus
              disableTextWrap: false
              editorMode: builder
              expr: sum(k6_http_reqs_total{expected_response="false"}) or on() vector(0)
              fullMetaSearch: false
              includeNullMetadata: true
              instant: true
              intervalMs: 1000
              legendFormat: __auto
              maxDataPoints: 43200
              range: false
              refId: B
              useBackend: false
          - refId: C
            relativeTimeRange:
              from: 600
              to: 0
            datasourceUid: __expr__
            model:
              conditions:
                - evaluator:
                    params:
                      - 0
                      - 0
                    type: gt
                  operator:
                    type: and
                  query:
                    params: []
                  reducer:
                    params: []
                    type: avg
                  type: query
              datasource:
                name: Expression
                type: __expr__
                uid: __expr__
              expression: ($B / $A) * 100
              intervalMs: 1000
              maxDataPoints: 43200
              refId: C
              type: math
          - refId: D
            relativeTimeRange:
              from: 600
              to: 0
            datasourceUid: __expr__
            model:
              conditions:
                - evaluator:
                    params:
                      - 50
                      - 0
                    type: gt
                  operator:
                    type: and
                  query:
                    params: []
                  reducer:
                    params: []
                    type: avg
                  type: query
              datasource:
                name: Expression
                type: __expr__
                uid: __expr__
              expression: C
              intervalMs: 1000
              maxDataPoints: 43200
              refId: D
              type: threshold
        noDataState: $NODATA
        execErrState: Alerting
        for: 1m
        annotations:
          description: ''
          runbook_url: ''
          summary: The k6 load tester experienced HTTP request failures at a rate past the acceptable threshold
        labels:
          gcloud_filter: ''
        isPaused: false
      - uid: ddogbytusmz9cb
        title: K6 Throughput Below Threshold
        condition: C
        data:
          - refId: A
            relativeTimeRange:
              from: 3600
              to: 0
            datasourceUid: prometheus
            model:
              disableTextWrap: false
              editorMode: builder
              expr: rate(k6_transfers_completed_total{scenario="generate_load"}[$__rate_interval])
              fullMetaSearch: false
              includeNullMetadata: true
              instant: true
              intervalMs: 1000
              legendFormat: __auto
              maxDataPoints: 43200
              range: false
              refId: A
              useBackend: false
          - refId: C
            relativeTimeRange:
              from: 3600
              to: 0
            datasourceUid: __expr__
            model:
              conditions:
                - evaluator:
                    params:
                      - $LOAD_TESTER_MIN_RATE
                    type: lt
                  operator:
                    type: and
                  query:
                    params:
                      - C
                  reducer:
                    params: []
                    type: last
                  type: query
              datasource:
                type: __expr__
                uid: __expr__
              expression: B
              intervalMs: 1000
              maxDataPoints: 43200
              refId: C
              type: threshold
          - refId: B
            datasourceUid: __expr__
            model:
              conditions:
                - evaluator:
                    params:
                      - 0
                      - 0
                    type: gt
                  operator:
                    type: and
                  query:
                    params: []
                  reducer:
                    params: []
                    type: avg
                  type: query
              datasource:
                name: Expression
                type: __expr__
                uid: __expr__
              expression: A
              hide: false
              reducer: mean
              refId: B
              type: reduce
        dashboardUid: ccbb2351-2ae2-462f-ae0e-f2c893ad1028
        panelId: 28
        noDataState: $NODATA
        execErrState: Alerting
        for: 15m # give some time for restarts
        annotations:
          __dashboardUid__: ccbb2351-2ae2-462f-ae0e-f2c893ad1028
          __panelId__: "28"
          severity: warning
          description: ''
          runbook_url: ''
          summary: Transaction rate from the k6 load tester is lower than expected threshold
        labels:
          '': ''
        isPaused: false
