{
  "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": "MTE API Relay CloudWatch Log based metrics",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 22,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "C-COskuNz"
      },
      "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": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 10,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "C-COskuNz"
          },
          "expression": "parse @message /.*\"correlationId\":\"(?<correlationId>[^\"]*)\".*/\n| stats count_distinct(correlationId) as mar_outbound_requests_per_second by bin(1s)",
          "logGroups": [
            {
              "arn": "$mar_outbound_log_group",
              "name": "$mar_outbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        },
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "C-COskuNz"
          },
          "expression": "parse @message /.*\"correlationId\":\"(?<correlationId>[^\"]*)\".*/\n| stats count_distinct(correlationId) as mar_inbound_requests_per_second by bin(1s)",
          "hide": false,
          "logGroups": [
            {
              "arn": "$mar_inbound_log_group",
              "name": "$mar_inbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "B",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        }
      ],
      "title": "Requests Processed [req/sec]",
      "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": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 11,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "stats avg(RequestTotalTime) / 1000000 as mar_outbound_request_time by bin(1s)",
          "logGroups": [
            {
              "arn": "$mar_outbound_log_group",
              "name": "$mar_outbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        },
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "stats avg(RequestTotalTime) / 1000000 as mar_inbound_request_time by bin(1s)",
          "hide": false,
          "logGroups": [
            {
              "arn": "$mar_inbound_log_group",
              "name": "$mar_inbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "B",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        }
      ],
      "title": "Request Time [ms]",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "description": "",
      "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": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 8
      },
      "id": 15,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "stats avg(outboundProxyTime) / 1000000 as outbound_proxy_time_ms by bin(1s)",
          "logGroups": [
            {
              "arn": "$mar_outbound_log_group",
              "name": "$mar_outbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        }
      ],
      "title": "Outbound Proxy Time [ms]",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "cloudwatch",
        "uid": "${datasource}"
      },
      "description": "",
      "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": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "proxyTotalTimeMs"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "yellow",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "inbound_proxy_time_ms"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "yellow",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 8
      },
      "id": 14,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.4.7",
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${datasource}"
          },
          "expression": "stats avg(proxyTotalTime) / 1000000 as inbound_proxy_time_ms by bin(1s)",
          "logGroups": [
            {
              "arn": "$mar_inbound_log_group",
              "name": "$mar_inbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        }
      ],
      "title": "Inbound Proxy Time [ms]",
      "type": "timeseries"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "cloudwatch",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 16
      },
      "hiddenSeries": false,
      "id": 17,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "9.4.7",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "$datasource"
          },
          "expression": "stats avg(encodeRequestTime) / 1000000 as request_encode_time_ms by bin(1s)",
          "logGroups": [
            {
              "arn": "$mar_outbound_log_group",
              "name": "$mar_outbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Request Encode Time [ms]",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "ms",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {
        "requestDecodeTimeMs": "yellow",
        "request_decode_time": "yellow"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "cloudwatch",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 16
      },
      "hiddenSeries": false,
      "id": 13,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "9.4.7",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "$datasource"
          },
          "expression": "stats avg(requestDecodeTime) / 1000000 as request_decode_time by bin(1s)",
          "logGroups": [
            {
              "arn": "$mar_inbound_log_group",
              "name": "$mar_inbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Request Decode Time [ms]",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "ms",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "cloudwatch",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 24
      },
      "hiddenSeries": false,
      "id": 16,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "9.4.7",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "$datasource"
          },
          "expression": "stats avg(decodeResponseTime) / 1000000 as response_decode_time_ms by bin(1s)",
          "logGroups": [
            {
              "arn": "$mar_outbound_log_group",
              "name": "$mar_outbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Response Decode Time [ms]",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "ms",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {
        "responseEncodeTimeMs": "yellow",
        "response_encode_time_ms": "yellow"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "cloudwatch",
        "uid": "$datasource"
      },
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 24
      },
      "hiddenSeries": false,
      "id": 12,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "9.4.7",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "$datasource"
          },
          "expression": "stats avg(responseEncodeTime) / 1000000 as response_encode_time_ms by bin(1s)",
          "logGroups": [
            {
              "arn": "$mar_inbound_log_group",
              "name": "$mar_inbound_log_group"
            }
          ],
          "queryMode": "Logs",
          "refId": "A",
          "region": "$region",
          "statsGroups": ["bin(1s)"]
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Response Encode Time [ms]",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "ms",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "datasource": {
        "uid": "$datasource"
      },
      "gridPos": {
        "h": 2,
        "w": 24,
        "x": 0,
        "y": 32
      },
      "id": 9,
      "options": {
        "code": {
          "language": "plaintext",
          "showLineNumbers": false,
          "showMiniMap": false
        },
        "content": "For more information about the available metrics for Amazon CloudWatch Logs, please visit the [CloudWatch documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Monitoring-CloudWatch-Metrics.html).",
        "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": 3,
  "schemaVersion": 38,
  "style": "dark",
  "tags": [],
  "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,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {
          "selected": false,
          "text": "",
          "value": ""
        },
        "datasource": {
          "type": "cloudwatch",
          "uid": "$datasource"
        },
        "definition": "log_group_names()",
        "hide": 0,
        "includeAll": false,
        "label": "Outbound MTE API Relay",
        "multi": false,
        "name": "mar_outbound_log_group",
        "options": [],
        "query": {
          "logGroupPrefix": "",
          "queryType": "logGroups",
          "refId": "CloudWatchVariableQueryEditor-VariableQuery",
          "region": "default"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "",
          "value": ""
        },
        "datasource": {
          "type": "cloudwatch",
          "uid": "${datasource}"
        },
        "definition": "",
        "hide": 0,
        "includeAll": false,
        "label": "Inbound MTE API Relay",
        "multi": false,
        "name": "mar_inbound_log_group",
        "options": [],
        "query": {
          "logGroupPrefix": "",
          "queryType": "logGroups",
          "refId": "CloudWatchVariableQueryEditor-VariableQuery",
          "region": "default"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-30m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "MTE API Relay - Combined (Inbound + Outbound)",
  "uid": "MARCOMBIBdQw4w9WgXcQ",
  "version": 3,
  "weekStart": ""
}
