{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 0,
        "w": 24,
        "h": 1
      },
      "id": 1,
      "panels": [],
      "title": "Overview",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 300
              },
              {
                "color": "red",
                "value": 900
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 0,
        "y": 1,
        "w": 6,
        "h": 6
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "11.0.0",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "max(aws_sqs_approximate_age_of_oldest_message_maximum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"})",
          "legendFormat": "oldest message age max",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Oldest Message Age",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 100
              },
              {
                "color": "red",
                "value": 1000
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 6,
        "y": 1,
        "w": 6,
        "h": 6
      },
      "id": 3,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "11.0.0",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(aws_sqs_approximate_number_of_messages_visible_average{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"})",
          "legendFormat": "visible backlog avg",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Visible Backlog",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 100
              },
              {
                "color": "red",
                "value": 1000
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 12,
        "y": 1,
        "w": 6,
        "h": 6
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "11.0.0",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(aws_sqs_approximate_number_of_messages_not_visible_average{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"})",
          "legendFormat": "in-flight avg",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "In-flight Messages",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "showPoints": "never",
            "spanNulls": false
          },
          "mappings": [],
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 12,
        "y": 7,
        "w": 12,
        "h": 8
      },
      "id": 6,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "aws_sqs_approximate_age_of_oldest_message_average{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}",
          "legendFormat": "{{dimension_QueueName}} average",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "aws_sqs_approximate_age_of_oldest_message_maximum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}",
          "legendFormat": "{{dimension_QueueName}} maximum",
          "range": true,
          "refId": "B"
        }
      ],
      "title": "Message Age by Queue",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "showPoints": "never",
            "spanNulls": false
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 0,
        "y": 15,
        "w": 24,
        "h": 8
      },
      "id": 7,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "aws_sqs_approximate_number_of_messages_visible_average{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}",
          "legendFormat": "{{dimension_QueueName}} visible average",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "aws_sqs_approximate_number_of_messages_visible_maximum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}",
          "legendFormat": "{{dimension_QueueName}} visible maximum",
          "range": true,
          "refId": "B"
        }
      ],
      "title": "Visible Backlog by Queue",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 23,
        "w": 24,
        "h": 1
      },
      "id": 8,
      "panels": [],
      "title": "Drilldown",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "showPoints": "never",
            "spanNulls": false
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 0,
        "y": 24,
        "w": 16,
        "h": 8
      },
      "id": 9,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (dimension_QueueName) (aws_sqs_number_of_messages_sent_sum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}) / 300",
          "legendFormat": "{{dimension_QueueName}} sent",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (dimension_QueueName) (aws_sqs_number_of_messages_received_sum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}) / 300",
          "legendFormat": "{{dimension_QueueName}} received",
          "range": true,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (dimension_QueueName) (aws_sqs_number_of_messages_deleted_sum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}) / 300",
          "legendFormat": "{{dimension_QueueName}} deleted",
          "range": true,
          "refId": "C"
        }
      ],
      "title": "Sent / Received / Deleted",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "showPoints": "never",
            "spanNulls": false
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 16,
        "y": 24,
        "w": 8,
        "h": 8
      },
      "id": 10,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (dimension_QueueName) (aws_sqs_number_of_empty_receives_sum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}) / 300",
          "legendFormat": "{{dimension_QueueName}} empty receives",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Empty Receives",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 32,
        "w": 24,
        "h": 1
      },
      "id": 11,
      "panels": [],
      "title": "Capacity",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "showPoints": "never",
            "spanNulls": false
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 0,
        "y": 33,
        "w": 12,
        "h": 8
      },
      "id": 12,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(aws_sqs_approximate_number_of_messages_visible_average{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"})",
          "legendFormat": "visible average",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(aws_sqs_approximate_number_of_messages_visible_maximum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"})",
          "legendFormat": "visible maximum",
          "range": true,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(aws_sqs_approximate_number_of_messages_not_visible_average{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"})",
          "legendFormat": "in-flight average",
          "range": true,
          "refId": "C"
        }
      ],
      "title": "Backlog Average / Peak / In-flight",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "showPoints": "never",
            "spanNulls": false
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 12,
        "y": 33,
        "w": 12,
        "h": 8
      },
      "id": 13,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(aws_sqs_number_of_messages_received_sum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}) / 300",
          "legendFormat": "received",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(aws_sqs_number_of_messages_deleted_sum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}) / 300",
          "legendFormat": "deleted",
          "range": true,
          "refId": "B"
        }
      ],
      "title": "Consumer Receive / Delete Throughput",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "showPoints": "never",
            "spanNulls": false
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 0,
        "y": 41,
        "w": 24,
        "h": 8
      },
      "id": 14,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum(aws_sqs_approximate_number_of_messages_visible_average{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}) / clamp_min(sum(aws_sqs_number_of_messages_deleted_sum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}), 1)",
          "legendFormat": "approx drain periods",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Approx Drain Periods",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 49,
        "w": 24,
        "h": 1
      },
      "id": 15,
      "panels": [],
      "title": "Debug",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "showPoints": "never",
            "spanNulls": false
          },
          "mappings": [],
          "unit": "ops"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 0,
        "y": 50,
        "w": 24,
        "h": 8
      },
      "id": 16,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "sum by (dimension_QueueName) (aws_sqs_number_of_messages_received_sum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"} - aws_sqs_number_of_messages_deleted_sum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}) / 300",
          "legendFormat": "{{dimension_QueueName}} receive-delete gap",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "Receive - Delete Gap",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "drawStyle": "line",
            "fillOpacity": 10,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "showPoints": "never",
            "spanNulls": false
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "x": 0,
        "y": 7,
        "w": 12,
        "h": 8
      },
      "id": 17,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "aws_sqs_approximate_number_of_messages_delayed_average{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}",
          "legendFormat": "{{dimension_QueueName}} delayed average",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "editorMode": "code",
          "expr": "aws_sqs_approximate_number_of_messages_delayed_maximum{dimension_QueueName=~\"$queue_name\", environment=~\"$environment\"}",
          "legendFormat": "{{dimension_QueueName}} delayed maximum",
          "range": true,
          "refId": "B"
        }
      ],
      "title": "Delayed Messages",
      "type": "timeseries"
    }
  ],
  "refresh": "1m",
  "schemaVersion": 39,
  "tags": [
    "aws",
    "sqs",
    "yace",
    "prometheus",
    "environment"
  ],
  "templating": {
    "list": [
      {
        "current": {},
        "hide": 0,
        "includeAll": false,
        "label": "Data source",
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "type": "datasource"
      },
      {
        "current": {
          "selected": true,
          "text": ".*",
          "value": ".*"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "definition": "label_values(aws_sqs_approximate_number_of_messages_visible_average, environment)",
        "hide": 0,
        "includeAll": true,
        "label": "Environment",
        "multi": true,
        "name": "environment",
        "options": [],
        "query": {
          "query": "label_values(aws_sqs_approximate_number_of_messages_visible_average, environment)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": true,
          "text": ".*",
          "value": ".*"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "definition": "label_values(aws_sqs_approximate_number_of_messages_visible_average{environment=~\"$environment\"}, dimension_QueueName)",
        "hide": 0,
        "includeAll": true,
        "label": "Queue",
        "multi": true,
        "name": "queue_name",
        "options": [],
        "query": {
          "query": "label_values(aws_sqs_approximate_number_of_messages_visible_average{environment=~\"$environment\"}, dimension_QueueName)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "sort": 1,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "AWS SQS - YACE Environment Overview",
  "uid": "aws-sqs-yace-environment-overview",
  "version": 2,
  "weekStart": ""
}
