{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "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"
      }
    ]
  },
  "description": "SocketX WebSocket Proxy Server - MTE Encryption Metrics",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": 42,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 100,
      "panels": [],
      "title": "Global Health",
      "type": "row"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 1
      },
      "id": 1,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /New websocket connection/\n| stats count() as total_connections",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": []
        }
      ],
      "title": "Total Connections",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 1
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE encryption event/ or @message like /MTE decryption event/\n| stats count() as total_messages",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": []
        }
      ],
      "title": "Total MTE Operations",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 8,
        "y": 1
      },
      "id": 3,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE encryption event/ or @message like /MTE decryption event/\n| stats sum(payload_size_bytes) as total_bytes",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": []
        }
      ],
      "title": "Total Bytes Processed",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.1
              },
              {
                "color": "red",
                "value": 0.5
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 12,
        "y": 1
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE encryption event/\n| stats avg(duration_ms) as avg_encrypt_ms",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": []
        }
      ],
      "title": "Avg Encrypt Time",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.1
              },
              {
                "color": "red",
                "value": 0.5
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 16,
        "y": 1
      },
      "id": 5,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE decryption event/\n| stats avg(duration_ms) as avg_decrypt_ms",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": []
        }
      ],
      "title": "Avg Decrypt Time",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 1
      },
      "id": 6,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /Websocket connection closed/\n| stats avg(audit.duration_seconds) as avg_duration",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": []
        }
      ],
      "title": "Avg Session Duration",
      "type": "stat"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "id": 101,
      "panels": [],
      "title": "Connection Metrics",
      "type": "row"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 6
      },
      "id": 10,
      "options": {
        "legend": {
          "calcs": ["sum", "mean"],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /New websocket connection/\n| stats count() as new_connections by bin($period s)",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin($period s)"]
        }
      ],
      "title": "New Connections",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 6
      },
      "id": 11,
      "options": {
        "legend": {
          "calcs": ["mean", "max"],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /Websocket connection closed/\n| stats avg(audit.duration_seconds) as avg_duration, max(audit.duration_seconds) as max_duration, min(audit.duration_seconds) as min_duration by bin($period s)",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin($period s)"]
        }
      ],
      "title": "Session Duration",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 14
      },
      "id": 102,
      "panels": [],
      "title": "MTE Performance",
      "type": "row"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.1
              },
              {
                "color": "red",
                "value": 0.5
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 0,
        "y": 15
      },
      "id": 20,
      "options": {
        "legend": {
          "calcs": ["mean", "max", "lastNotNull"],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE encryption event/\n| stats avg(duration_ms) as avg_ms, pct(duration_ms, 95) as p95_ms, pct(duration_ms, 99) as p99_ms by bin($period s)",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin($period", "s)"]
        }
      ],
      "title": "Encryption Latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.1
              },
              {
                "color": "red",
                "value": 0.5
              }
            ]
          },
          "unit": "ms"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 12,
        "y": 15
      },
      "id": 21,
      "options": {
        "legend": {
          "calcs": ["mean", "max", "lastNotNull"],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE decryption event/\n| stats avg(duration_ms) as avg_ms, pct(duration_ms, 95) as p95_ms, pct(duration_ms, 99) as p99_ms by bin($period s)",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin($period", "s)"]
        }
      ],
      "title": "Decryption Latency",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "encryptions"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "green",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "decryptions"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "blue",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 26
      },
      "id": 22,
      "options": {
        "legend": {
          "calcs": ["sum", "mean"],
          "displayMode": "table",
          "placement": "right",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE encryption event/\n| stats count() as encryptions by bin($period s)",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin($period s)"]
        },
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE decryption event/\n| stats count() as decryptions by bin($period s)",
          "hide": false,
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "B",
          "region": "$region",
          "statsGroups": ["bin($period s)"]
        }
      ],
      "title": "MTE Operations Over Time",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 34
      },
      "id": 103,
      "panels": [],
      "title": "Traffic & Throughput",
      "type": "row"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 35
      },
      "id": 30,
      "options": {
        "legend": {
          "calcs": ["sum", "mean"],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE encryption event/\n| stats sum(payload_size_bytes) as encrypted_bytes by bin($period s)",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin($period s)"]
        },
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE decryption event/\n| stats sum(payload_size_bytes) as decrypted_bytes by bin($period s)",
          "hide": false,
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "B",
          "region": "$region",
          "statsGroups": ["bin($period s)"]
        }
      ],
      "title": "Bytes Processed Over Time",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 35
      },
      "id": 31,
      "options": {
        "legend": {
          "calcs": ["mean", "max"],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE encryption event/ or @message like /MTE decryption event/\n| stats avg(payload_size_bytes) as avg_payload, max(payload_size_bytes) as max_payload, min(payload_size_bytes) as min_payload by bin($period s)",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin($period s)"]
        }
      ],
      "title": "Payload Size Statistics",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 43
      },
      "id": 32,
      "options": {
        "legend": {
          "calcs": ["sum", "mean"],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /Websocket connection closed/\n| stats sum(audit.messages_to_client) as to_client, sum(audit.messages_to_upstream) as to_upstream by bin($period s)",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin($period s)"]
        }
      ],
      "title": "Messages by Direction",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "decbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 43
      },
      "id": 33,
      "options": {
        "legend": {
          "calcs": ["sum", "mean"],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /Websocket connection closed/\n| stats sum(audit.bytes_to_client) as bytes_to_client, sum(audit.bytes_to_upstream) as bytes_to_upstream by bin($period s)",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin($period s)"]
        }
      ],
      "title": "Bytes by Direction",
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 51
      },
      "id": 104,
      "panels": [],
      "title": "Session Audit",
      "type": "row"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "duration_seconds"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "total_encrypt_ms"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "total_decrypt_ms"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 52
      },
      "id": 41,
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": "",
          "reducer": ["sum"],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "@timestamp"
          }
        ]
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /Websocket connection closed/\n| fields @timestamp, audit.connection_id as connection_id, audit.client_addr as client_addr, audit.duration_seconds as duration_seconds, audit.messages_to_client as msgs_to_client, audit.messages_to_upstream as msgs_to_upstream, audit.total_encrypt_time_ms as total_encrypt_ms, audit.total_decrypt_time_ms as total_decrypt_ms\n| sort @timestamp desc\n| limit 50",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": []
        }
      ],
      "title": "Recent Session Audits",
      "type": "table"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "duration_ms"
            },
            "properties": [
              {
                "id": "unit",
                "value": "ms"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "payload_size_bytes"
            },
            "properties": [
              {
                "id": "unit",
                "value": "decbytes"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 60
      },
      "id": 42,
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": "",
          "reducer": ["sum"],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "@timestamp"
          }
        ]
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "filter @message like /MTE encryption event/ or @message like /MTE decryption event/\n| fields @timestamp, connection_id, event_type, duration_ms, payload_size_bytes, upstream_server, origin\n| sort @timestamp desc\n| limit 100",
          "logGroups": [
            {
              "arn": "$loggroup",
              "name": "$loggroup"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": []
        }
      ],
      "title": "Recent MTE Events",
      "type": "table"
    },
    {
      "datasource": {
        "uid": "$datasource"
      },
      "gridPos": {
        "h": 2,
        "w": 24,
        "x": 0,
        "y": 70
      },
      "id": 99,
      "options": {
        "code": {
          "language": "plaintext",
          "showLineNumbers": false,
          "showMiniMap": false
        },
        "content": "SocketX WebSocket Proxy Server Dashboard - Monitoring MTE encryption/decryption operations, connection metrics, and throughput.",
        "mode": "markdown"
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "alias": "",
          "datasource": {
            "uid": "$datasource"
          },
          "dimensions": {},
          "expression": "",
          "id": "",
          "matchExact": true,
          "metricEditorMode": 0,
          "metricName": "",
          "metricQueryType": 0,
          "namespace": "",
          "refId": "A",
          "region": "default",
          "statistic": "Average"
        }
      ],
      "title": " ",
      "type": "text"
    }
  ],
  "refresh": "1m",
  "revision": 1,
  "schemaVersion": 38,
  "style": "dark",
  "tags": ["SocketX", "WebSocket", "MTE", "Encryption", "CloudWatch", "Logs"],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "CloudWatch-001",
          "value": "CloudWatch-001"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Data Source",
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "cloudwatch",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {
          "selected": false,
          "text": "us-east-1",
          "value": "us-east-1"
        },
        "datasource": {
          "type": "cloudwatch",
          "uid": "$datasource"
        },
        "definition": "regions()",
        "hide": 0,
        "includeAll": false,
        "label": "Region",
        "multi": false,
        "name": "region",
        "options": [],
        "query": "regions()",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "/ecs/socketx-grafana",
          "value": "arn:aws:logs:us-east-1:321186633847:log-group:/ecs/socketx-grafana:*"
        },
        "datasource": {
          "type": "cloudwatch",
          "uid": "$datasource"
        },
        "definition": "log_group_names()",
        "hide": 0,
        "includeAll": false,
        "label": "Log Group",
        "multi": false,
        "name": "loggroup",
        "options": [],
        "query": {
          "queryType": "logGroups",
          "refId": "CloudWatchVariableQueryEditor-VariableQuery",
          "region": "default"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "60",
          "value": "60"
        },
        "hide": 0,
        "includeAll": false,
        "label": "Period [sec]",
        "multi": false,
        "name": "period",
        "options": [
          {
            "selected": false,
            "text": "10",
            "value": "10"
          },
          {
            "selected": false,
            "text": "30",
            "value": "30"
          },
          {
            "selected": true,
            "text": "60",
            "value": "60"
          },
          {
            "selected": false,
            "text": "300",
            "value": "300"
          },
          {
            "selected": false,
            "text": "3600",
            "value": "3600"
          }
        ],
        "query": "10,30,60,300,3600",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "SocketX WebSocket Proxy",
  "uid": "socketx-ws-proxy",
  "version": 2,
  "weekStart": ""
}
