Grafana dashboard: Dashboard Most Requested EndPoint
Description: Filtra a quantidade de requisição por endpoint e no caso de criação de um novo registro verifica na base se está batendo com a quantidade de resposta 201 do microservice


{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    },
    {
      "name": "DS_MYSQL-DBCOLABORADOR",
      "label": "MySQL-dbcolaborador",
      "description": "",
      "type": "datasource",
      "pluginId": "mysql",
      "pluginName": "MySQL"
    },
    {
      "name": "DS_MYSQL-DBEMPRESA",
      "label": "MySQL-dbempresa",
      "description": "",
      "type": "datasource",
      "pluginId": "mysql",
      "pluginName": "MySQL"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.1.6"
    },
    {
      "type": "datasource",
      "id": "mysql",
      "name": "MySQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 116,
      "panels": [],
      "title": "Microservice Service--Collaborator & Microservice Service--Company",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "decimals": 0,
          "mappings": [],
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 1
      },
      "id": 113,
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/situacao/v1/all\", status=\"200\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/situacao/v1/all\", status=\"200\"}[$__range])) / 100)",
          "legendFormat": "/situacao/v1/all",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/colaborador/auth/v1/signin\", status=\"200\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/colaborador/auth/v1/signin\", status=\"200\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/colaborador/auth/v1/signin",
          "range": true,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/colaborador/v1/profile\", status=\"200\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/colaborador/v1/profile\", status=\"200\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/colaborador/v1/profile",
          "range": true,
          "refId": "C"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/colaborador/v1/save\", status=\"202\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/colaborador/v1/save\", status=\"202\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/colaborador/v1/save",
          "range": true,
          "refId": "D"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/authorization/v1/all\", status=\"200\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/authorization/v1/all\", status=\"200\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/authorization/v1/all",
          "range": true,
          "refId": "E"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/authorization/v1/save\", status=\"201\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/authorization/v1/save\", status=\"201\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/authorization/v1/save",
          "range": true,
          "refId": "F"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/authorization/v1/save\", status=\"202\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/authorization/v1/save\", status=\"202\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/authorization/v1/save",
          "range": true,
          "refId": "G"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/colaborador\", status=\"200\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--collaborator\", uri=\"/colaborador\", status=\"200\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/colaborador?page={page}&size={size}",
          "range": true,
          "refId": "H"
        }
      ],
      "title": "Number of requests per endpoint (service--collaborator)",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "mysql",
        "uid": "${DS_MYSQL-DBCOLABORADOR}"
      },
      "description": "service--collaborator",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 8,
        "y": 1
      },
      "id": 114,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "none",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "9.1.6",
      "targets": [
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYSQL-DBCOLABORADOR}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  count(*)\nFROM colaborador\nWHERE\n  $__timeFilter(data_cadastro);",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "cod_authorization"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "empresa",
          "timeColumn": "data_cadastro",
          "timeColumnType": "datetime",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Total Registered",
      "type": "stat"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 9
      },
      "id": 2,
      "panels": [],
      "title": "Microservice Service--Company",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "decimals": 0,
          "mappings": [],
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 10
      },
      "id": 4,
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/authorization/v1/all\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/authorization/v1/all\"}[$__range])) / 100)",
          "legendFormat": "/authorization/v1/all",
          "range": true,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/authorization/v1/save\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/authorization/v1/save\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/authorization/v1/save",
          "range": true,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/situacao/v1/all\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/situacao/v1/all\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/situacao/v1/all",
          "range": true,
          "refId": "C"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/seguimento/v1/all\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/seguimento/v1/all\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/seguimento/v1/all",
          "range": true,
          "refId": "D"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/tiposistema/v1/all\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/tiposistema/v1/all\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/tiposistema/v1/all",
          "range": true,
          "refId": "E"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/empresa/v1/get/cnpj_cpf={cnpj_cpf}\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/empresa/v1/get/cnpj_cpf={cnpj_cpf}\" }[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/empresa/v1/get/cnpj_cpf={cnpj_cpf}",
          "range": true,
          "refId": "F"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/empresa/v1/get/id={id}\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/empresa/v1/get/id={id}\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/empresa/v1/get/id={id}",
          "range": true,
          "refId": "G"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "expr": "sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/empresa/v1/save\"}[$__range])) - (5 * sum(increase(http_server_requests_seconds_count{application=\"service--company\", uri=\"/empresa/v1/save\"}[$__range])) / 100)",
          "hide": false,
          "legendFormat": "/empresa/v1/save",
          "range": true,
          "refId": "H"
        }
      ],
      "title": "Number of requests per endpoint (service--company)",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "mysql",
        "uid": "${DS_MYSQL-DBEMPRESA}"
      },
      "description": "service--company",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 0,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 8,
        "y": 10
      },
      "id": 112,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "none",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "9.1.6",
      "targets": [
        {
          "datasource": {
            "type": "mysql",
            "uid": "${DS_MYSQL-DBEMPRESA}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  count(*)\nFROM empresa\nWHERE\n  $__timeFilter(data_cadastro);",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "cod_authorization"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "empresa",
          "timeColumn": "data_cadastro",
          "timeColumnType": "datetime",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Total Registered",
      "type": "stat"
    }
  ],
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Dashboard Most Requested EndPoint",
  "uid": "eoVB98nVk",
  "version": 52,
  "weekStart": "",
  "gnetId": 17052,
  "description": "Filtra a quantidade de requisição por endpoint e no caso de criação de um novo registro verifica na base se está batendo com a quantidade de resposta 201 do microservice"
}