Grafana dashboard: WSO2 API Metrics
Description: This Dashboard provides an overview of API services deployed in Enterprise Integrator Cluster.

This Dashboard provides an overview of API services deployed in Enterprise Integrator Cluster. It will have dynamic panels for each API service deployed in Enterprise Integrator cluster and user have the ability to choose the API that they want to monitor using the drop down. Following stats are displayed in the API dashboards.
- Up Time
- All Request Count
- Successful Request Count
- Error Count
- Error Percentage
- Deployed Node Count: Number of nodes, service is deployed
- Request Rate
- Error Rate
- Response Time : This will be show as a heat map using recorded histograms. If tracing is enabled widget will have a link to redirect users to Jaeger UI

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    },
    {
      "name": "DS_LOKI",
      "label": "Loki",
      "description": "",
      "type": "datasource",
      "pluginId": "loki",
      "pluginName": "Loki"
    },
    {
      "name": "VAR_JAEGERHOST",
      "type": "constant",
      "label": "jaegerHost",
      "value": "localhost:8080",
      "description": "Add the Jaeger host and port as the value of this constant. It will be used to retrieve tracing information from jaeger"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.0.3"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "panel",
      "id": "heatmap",
      "name": "Heatmap",
      "version": ""
    },
    {
      "type": "panel",
      "id": "logs",
      "name": "Logs",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "loki",
      "name": "Loki",
      "version": "1.0.0"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 12888,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1598354110859,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "datasource": "${DS_PROMETHEUS}",
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 4,
      "panels": [],
      "repeat": "service",
      "title": "[[service]]",
      "type": "row"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": true,
      "colors": [
        "#56A64B",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 0,
        "y": 1
      },
      "id": 6,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.6.2",
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "time() - max(wso2_integration_service_up{service_name=~\"[[service]]\"})",
          "instant": false,
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "Up Time",
      "type": "singlestat",
      "valueFontSize": "150%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_PROMETHEUS}",
      "description": "Displays all time request count served by this API service. This will also include the error requests.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "0",
              "type": 1,
              "value": "null"
            }
          ],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 4,
        "y": 1
      },
      "id": 2,
      "links": [
        {
          "targetBlank": true,
          "title": "Visit Node Dashboard",
          "url": "https://stackoverflow.com/questions/43890629/prometheus-timestamps"
        }
      ],
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "center",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        }
      },
      "pluginVersion": "7.0.3",
      "targets": [
        {
          "expr": "sum((max_over_time(wso2_integration_api_request_count_total{service_name=~\"[[service]]\"}[$__range]))- (min_over_time(wso2_integration_api_request_count_total{service_name=~\"[[service]]\"}[$__range])))",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "All Request Count",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_PROMETHEUS}",
      "description": "Displays approximate request count received by this API service within the selected time range.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [
            {
              "id": 0,
              "op": "=",
              "text": "",
              "type": 1,
              "value": ""
            }
          ],
          "nullValueMode": "connected",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 8,
        "y": 1
      },
      "id": 16,
      "links": [],
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        }
      },
      "pluginVersion": "7.0.3",
      "targets": [
        {
          "expr": "(sum((max_over_time(wso2_integration_api_request_count_total{service_name=~\"[[service]]\"}[$__range]))- (min_over_time(wso2_integration_api_request_count_total{service_name=~\"[[service]]\"}[$__range]))))-(sum((max_over_time(wso2_integration_api_request_count_error_total{service_name=~\"[[service]]\"}[$__range]))- (min_over_time(wso2_integration_api_request_count_error_total{service_name=~\"[[service]]\"}[$__range]))))",
          "hide": false,
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        },
        {
          "expr": "(sum(max_over_time(wso2_integration_api_request_count_total{service_name=~\"[[service]]\"}[$__range])-min_over_time(wso2_integration_api_request_count_total{service_name=~\"[[service]]\"}[$__range])))",
          "hide": true,
          "interval": "1m",
          "legendFormat": "",
          "refId": "B"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Successful Request Count",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "description": "Displays all time error count occurred within this API service",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": [],
          "mappings": [
            {
              "from": "",
              "id": 1,
              "operator": "",
              "text": "0",
              "to": "",
              "type": 1,
              "value": "null"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 0
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 12,
        "y": 1
      },
      "id": 20,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        }
      },
      "pluginVersion": "7.0.3",
      "targets": [
        {
          "expr": "sum((max_over_time(wso2_integration_api_request_count_error_total{service_name=~\"[[service]]\"}[$__range]))-(min_over_time(wso2_integration_api_request_count_error_total{service_name=~\"[[service]]\"}[$__range])))",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Error Count",
      "type": "stat"
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "description": "Displays number of error requests occurred during the selected time range.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [
            {
              "from": "",
              "id": 1,
              "operator": "",
              "text": "0%",
              "to": "",
              "type": 1,
              "value": "null"
            }
          ],
          "noValue": "0%",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 75
              }
            ]
          },
          "unit": "percentunit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 16,
        "y": 1
      },
      "id": 19,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        }
      },
      "pluginVersion": "7.0.3",
      "targets": [
        {
          "expr": "sum((max_over_time(wso2_integration_proxy_request_count_error_total{service_name=~\"[[service]]\"}[$__range]))-(min_over_time(wso2_integration_proxy_request_count_error_total{service_name=~\"[[service]]\"}[$__range])))/sum((max_over_time(wso2_integration_proxy_request_count_total{service_name=~\"[[service]]\"}[$__range]))-(min_over_time(wso2_integration_proxy_request_count_total{service_name=~\"[[service]]\"}[$__range])))",
          "interval": "30s",
          "legendFormat": "Current",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Error Percentage",
      "type": "stat"
    },
    {
      "datasource": "${DS_PROMETHEUS}",
      "description": "Displays number of nodes this API service is deployed.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 20,
        "y": 1
      },
      "id": 18,
      "links": [],
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        }
      },
      "pluginVersion": "7.0.3",
      "targets": [
        {
          "expr": "count(wso2_integration_service_up{service_name=~\"[[service]]\"})",
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Deployed Node Count",
      "type": "stat"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "description": "Displays the request rate for this API service.",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 6
      },
      "hiddenSeries": false,
      "id": 9,
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": false,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum(rate(wso2_integration_api_request_count_total{service_name=~\"[[service]]\"}[$__interval]))",
          "interval": "70s",
          "intervalFactor": 1,
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Request Rate",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 0,
          "format": "reqps",
          "label": "TPS",
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "description": "Displays error rate of this API service.",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 6
      },
      "hiddenSeries": false,
      "id": 12,
      "interval": "",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": false,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sum(rate(wso2_integration_api_request_count_error_total{service_name=~\"[[service]]\"}[$__interval]))",
          "interval": "1m",
          "legendFormat": "{{kubernetes_pod_name}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Error Rate",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "short",
          "label": "TPS",
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cards": {
        "cardPadding": null,
        "cardRound": null
      },
      "color": {
        "cardColor": "#b4ff00",
        "colorScale": "sqrt",
        "colorScheme": "interpolateYlOrRd",
        "exponent": 0.5,
        "min": null,
        "mode": "spectrum"
      },
      "dataFormat": "tsbuckets",
      "datasource": "${DS_PROMETHEUS}",
      "description": "Displays the response time of all requests served by this API service in a heat map. Each tile will represent number of requests which fell in to the pre-defined time bucket during the bucket time span. If you seen any anomalies  please use the below link to view tracing information related to [[service]]",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 6
      },
      "heatmap": {},
      "hideZeroBuckets": false,
      "highlightCards": true,
      "id": 13,
      "interval": "",
      "legend": {
        "show": true
      },
      "links": [
        {
          "targetBlank": true,
          "title": "Tracing UI",
          "url": "http://[[jaegerHost]]/search?service=wso2-synapse&tags={\"componentName\":\"[[service]]\"}&start=${__from}000&end=${__to}000&lookback=custom"
        }
      ],
      "reverseYBuckets": false,
      "targets": [
        {
          "expr": "sum by (le)(increase(wso2_integration_api_latency_seconds{service_name=~\"[[service]]\", le=~\".+\"}[5m]))",
          "format": "heatmap",
          "hide": false,
          "instant": false,
          "interval": "1m",
          "legendFormat": "{{le}}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Response Time",
      "tooltip": {
        "show": true,
        "showHistogram": false
      },
      "type": "heatmap",
      "xAxis": {
        "show": true
      },
      "xBucketNumber": null,
      "xBucketSize": null,
      "yAxis": {
        "decimals": null,
        "format": "s",
        "logBase": 1,
        "max": null,
        "min": null,
        "show": true,
        "splitFactor": null
      },
      "yBucketBound": "upper",
      "yBucketNumber": null,
      "yBucketSize": null
    },
    {
      "datasource": "${DS_LOKI}",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 24,
        "x": 0,
        "y": 14
      },
      "id": 15,
      "options": {
        "showLabels": false,
        "showTime": true,
        "sortOrder": "Descending",
        "wrapLogMessage": true
      },
      "targets": [
        {
          "expr": "{service=\"{proxy:[[service]]}\"}",
          "refId": "A"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Logs",
      "type": "logs"
    }
  ],
  "refresh": "30s",
  "schemaVersion": 25,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(wso2_integration_service_up{service_type=\"api\"}, service_name)",
        "hide": 0,
        "includeAll": false,
        "label": "Service Name",
        "multi": true,
        "name": "service",
        "options": [],
        "query": "label_values(wso2_integration_service_up{service_type=\"api\"}, service_name)",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(wso2_integration_service_up{service_name=~\"$service\"}, instance)",
        "hide": 2,
        "includeAll": false,
        "label": "Node Name",
        "multi": false,
        "name": "node",
        "options": [],
        "query": "label_values(wso2_integration_service_up{service_name=~\"$service\"}, instance)",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {
          "value": "${VAR_JAEGERHOST}",
          "text": "${VAR_JAEGERHOST}"
        },
        "hide": 2,
        "label": null,
        "name": "jaegerHost",
        "options": [
          {
            "value": "${VAR_JAEGERHOST}",
            "text": "${VAR_JAEGERHOST}"
          }
        ],
        "query": "${VAR_JAEGERHOST}",
        "skipUrlSync": false,
        "type": "constant"
      }
    ]
  },
  "time": {
    "from": "2020-08-25T10:59:45.895Z",
    "to": "2020-08-25T11:14:45.895Z"
  },
  "timepicker": {
    "refresh_intervals": [
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "WSO2 API Metrics",
  "uid": "wso2-observerbility-api",
  "version": 1,
  "description": "This Dashboard provides an overview of API services deployed in Enterprise Integrator Cluster."
}