前端监控系统接口 | 青训营笔记

187 阅读9分钟

这是我参与「第四届青训营」笔记创作活动的第 2 天

前端监控系统

v1.0.0

后台管理系统/管理员

GET 登录

GET /login

Body 请求参数

{
  "username": "string",
  "password": "string"
}

请求参数

名称位置类型必选说明
bodybodyobjectnone
» usernamebodystringnone
» passwordbodystringnone

返回示例

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» tokenstringtruenonenone

后台管理系统/日志/稳定性

GET xhr日志

GET /logs

Body 请求参数

{
  "token": "string"
}

请求参数

名称位置类型必选说明
typequerystringnone
bodybodyobjectnone
» tokenbodystringnone

返回示例

成功

{
  "code": 20013,
  "data": [
    {
      "_id": "62e25766e8a775b8be90aeb2",
      "kind": "stability",
      "type": "xhr",
      "eventType": "load",
      "pathName": "http://localhost:3000/user?currentPage=1&pageSize=5",
      "method": "get",
      "params": "",
      "status": "200-OK",
      "duration": "10",
      "response": "[{\"id\":33,\"username\":\"test2\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":34,\"username\":\"test3\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":35,\"username\":\"test4\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":36,\"username\":\"test5\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":37,\"username\":\"test6\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"}]",
      "title": "前端监控",
      "url": "http://localhost:8080/",
      "timestamp": "2022-07-28T09:31:18.815Z",
      "userAgent": "chrome",
      "__v": 0
    },
    {
      "_id": "62e257a4e8a775b8be90aeb6",
      "kind": "stability",
      "type": "xhr",
      "eventType": "load",
      "pathName": "http://localhost:3000/user?currentPage=1&pageSize=5",
      "method": "get",
      "params": "",
      "status": "200-OK",
      "duration": "6",
      "response": "[{\"id\":33,\"username\":\"test2\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":34,\"username\":\"test3\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":35,\"username\":\"test4\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":36,\"username\":\"test5\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":37,\"username\":\"test6\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"}]",
      "title": "前端监控",
      "url": "http://localhost:8080/",
      "timestamp": "2022-07-28T09:32:20.819Z",
      "userAgent": "chrome",
      "__v": 0
    },
    {
      "_id": "62e258cae8a775b8be90aebe",
      "kind": "stability",
      "type": "xhr",
      "eventType": "load",
      "pathName": "http://localhost:3000/123",
      "method": "get",
      "params": "",
      "status": "404-Not Found",
      "duration": "2",
      "response": "{\"statusCode\":404,\"message\":\"Cannot GET /123\",\"error\":\"Not Found\"}",
      "title": "前端监控",
      "url": "http://localhost:8080/",
      "timestamp": "2022-07-28T09:37:14.760Z",
      "userAgent": "chrome",
      "__v": 0
    }
  ],
  "msg": "getXhr ok"
}
{
  "code": 20013,
  "data": [
    {
      "_id": "62e25766e8a775b8be90aeb2",
      "kind": "stability",
      "type": "xhr",
      "eventType": "load",
      "pathName": "http://localhost:3000/user?currentPage=1&pageSize=5",
      "method": "get",
      "params": "",
      "status": "200-OK",
      "duration": "10",
      "response": "[{\"id\":33,\"username\":\"test2\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":34,\"username\":\"test3\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":35,\"username\":\"test4\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":36,\"username\":\"test5\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":37,\"username\":\"test6\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"}]",
      "title": "前端监控",
      "url": "http://localhost:8080/",
      "timestamp": "2022-07-28T09:31:18.815Z",
      "userAgent": "chrome",
      "__v": 0
    },
    {
      "_id": "62e257a4e8a775b8be90aeb6",
      "kind": "stability",
      "type": "xhr",
      "eventType": "load",
      "pathName": "http://localhost:3000/user?currentPage=1&pageSize=5",
      "method": "get",
      "params": "",
      "status": "200-OK",
      "duration": "6",
      "response": "[{\"id\":33,\"username\":\"test2\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":34,\"username\":\"test3\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":35,\"username\":\"test4\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":36,\"username\":\"test5\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":37,\"username\":\"test6\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"}]",
      "title": "前端监控",
      "url": "http://localhost:8080/",
      "timestamp": "2022-07-28T09:32:20.819Z",
      "userAgent": "chrome",
      "__v": 0
    },
    {
      "_id": "62e258cae8a775b8be90aebe",
      "kind": "stability",
      "type": "xhr",
      "eventType": "load",
      "pathName": "http://localhost:3000/123",
      "method": "get",
      "params": "",
      "status": "404-Not Found",
      "duration": "2",
      "response": "{\"statusCode\":404,\"message\":\"Cannot GET /123\",\"error\":\"Not Found\"}",
      "title": "前端监控",
      "url": "http://localhost:8080/",
      "timestamp": "2022-07-28T09:37:14.760Z",
      "userAgent": "chrome",
      "__v": 0
    }
  ],
  "msg": "getXhr ok"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

GET 稳定性相关日志

GET /logs/stability

Body 请求参数

{
  "token": "string"
}

请求参数

名称位置类型必选说明
bodybodyobjectnone
» tokenbodystringnone

返回示例

成功

{
  "code": 20013,
  "data": {
    "error": [
      {
        "_id": "62e25764e8a775b8be90aeb0",
        "kind": "stability",
        "type": "error",
        "errorType": "jsError",
        "message": "Uncaught TypeError: Cannot set properties of undefined (setting 'b')",
        "filename": "http://localhost:8080/",
        "position": "27:28",
        "stack": "TypeError: Cannot set properties of undefined (setting 'b')\n    at errClick (http://localhost:8080/:27:28)\n    at HTMLInputElement.onclick (http://localhost:8080/:10:75)",
        "selector": "html body div.content aaa input#1",
        "title": "前端监控",
        "url": "http://localhost:8080/",
        "timestamp": "2022-07-28T09:31:16.494Z",
        "userAgent": "chrome",
        "__v": 0
      },
      {
        "_id": "62e25767e8a775b8be90aeb4",
        "kind": "stability",
        "type": "error",
        "errorType": "promiseError",
        "message": "Cannot set properties of undefined (setting 'b')",
        "filename": "http://localhost:8080/",
        "position": "31:36",
        "stack": "TypeError: Cannot set properties of undefined (setting 'b')\n    at http://localhost:8080/:31:36\n    at new Promise (<anonymous>)\n    at promiseClick (http://localhost:8080/:30:29)\n    at HTMLInputElement.onclick (http://localhost:8080/:11:84)",
        "selector": "html body div.content aaa input#2",
        "title": "前端监控",
        "url": "http://localhost:8080/",
        "timestamp": "2022-07-28T09:31:19.566Z",
        "userAgent": "chrome",
        "__v": 0
      }
    ],
    "blankScreen": [
      {
        "_id": "62e25739e8a775b8be90aeaa",
        "kind": "stability",
        "type": "blankScreen",
        "emptyPoints": "18",
        "screen": "1920x1080",
        "viewPort": "1289x969",
        "selector": "html",
        "title": "前端监控",
        "url": "http://localhost:8080/",
        "timestamp": "2022-07-28T09:30:33.579Z",
        "userAgent": "chrome",
        "__v": 0
      },
      {
        "_id": "62e258c7e8a775b8be90aeb8",
        "kind": "stability",
        "type": "blankScreen",
        "emptyPoints": "18",
        "screen": "1920x1080",
        "viewPort": "953x969",
        "selector": "html",
        "title": "前端监控",
        "url": "http://localhost:8080/",
        "timestamp": "2022-07-28T09:37:11.670Z",
        "userAgent": "chrome",
        "__v": 0
      }
    ],
    "xhr": [
      {
        "_id": "62e25766e8a775b8be90aeb2",
        "kind": "stability",
        "type": "xhr",
        "eventType": "load",
        "pathName": "http://localhost:3000/user?currentPage=1&pageSize=5",
        "method": "get",
        "params": "",
        "status": "200-OK",
        "duration": "10",
        "response": "[{\"id\":33,\"username\":\"test2\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":34,\"username\":\"test3\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":35,\"username\":\"test4\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":36,\"username\":\"test5\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":37,\"username\":\"test6\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"}]",
        "title": "前端监控",
        "url": "http://localhost:8080/",
        "timestamp": "2022-07-28T09:31:18.815Z",
        "userAgent": "chrome",
        "__v": 0
      },
      {
        "_id": "62e257a4e8a775b8be90aeb6",
        "kind": "stability",
        "type": "xhr",
        "eventType": "load",
        "pathName": "http://localhost:3000/user?currentPage=1&pageSize=5",
        "method": "get",
        "params": "",
        "status": "200-OK",
        "duration": "6",
        "response": "[{\"id\":33,\"username\":\"test2\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":34,\"username\":\"test3\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":35,\"username\":\"test4\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":36,\"username\":\"test5\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"},{\"id\":37,\"username\":\"test6\",\"password\":\"test\",\"openDate\":\"2022-07-04T11:53:07.742Z\"}]",
        "title": "前端监控",
        "url": "http://localhost:8080/",
        "timestamp": "2022-07-28T09:32:20.819Z",
        "userAgent": "chrome",
        "__v": 0
      },
      {
        "_id": "62e258cae8a775b8be90aebe",
        "kind": "stability",
        "type": "xhr",
        "eventType": "load",
        "pathName": "http://localhost:3000/123",
        "method": "get",
        "params": "",
        "status": "404-Not Found",
        "duration": "2",
        "response": "{\"statusCode\":404,\"message\":\"Cannot GET /123\",\"error\":\"Not Found\"}",
        "title": "前端监控",
        "url": "http://localhost:8080/",
        "timestamp": "2022-07-28T09:37:14.760Z",
        "userAgent": "chrome",
        "__v": 0
      }
    ]
  },
  "msg": "getStability ok"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

后台管理系统/日志/业务

GET 业务相关日志

GET /logs/business

Body 请求参数

{
  "token": "string"
}

请求参数

名称位置类型必选说明
bodybodyobjectnone
» tokenbodystringnone

返回示例

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

后台管理系统/日志/性能

GET 性能相关日志

GET /logs/experience

Body 请求参数

{
  "token": "string"
}

请求参数

名称位置类型必选说明
bodybodyobjectnone
» tokenbodystringnone

返回示例

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

后台管理系统/App管理

GET 查询所有app

GET /app-manage

Body 请求参数

{
  "token": "string"
}

请求参数

名称位置类型必选说明
bodybodyobjectnone
» tokenbodystringnone

返回示例

成功

{
  "code": 20010,
  "data": [
    {
      "_id": "62e21e0730194d34717e751d",
      "appName": "改类在所没",
      "__v": 0
    },
    {
      "_id": "62e2204eeb9d8b0c55cac543",
      "appName": "风许三格南府",
      "__v": 0
    },
    {
      "_id": "62e2227e242ff42275299395",
      "appName": "京角线度",
      "__v": 0
    }
  ],
  "msg": "getAll ok"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

POST 新增一个app分类

POST /app-manage

Body 请求参数

{
  "token": "string",
  "appName": "string"
}

请求参数

名称位置类型必选说明
bodybodyobjectnone
» tokenbodystringnone
» appNamebodystringnone

返回示例

成功

{
  "code": 20010,
  "data": {},
  "msg": "add ok"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

DELETE 根据id删除app

DELETE /app-manage/{id}

Body 请求参数

{
  "token": "string"
}

请求参数

名称位置类型必选说明
idpathstringapp的id
bodybodyobjectnone
» tokenbodystringnone

返回示例

成功

{
  "code": 20011,
  "msg": "deleteAppInfo ok"
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

数据模型