5
5
6
6
# HttpReports
7
7
### 简单介绍
8
- HttpReports 是 .Net Core 下的一个Web组件, 适用于WebAPI,Ocelot网关应用,MVC项目,非常适合针对微服务应用使用,通过中间件的形式集成到您的项目中,可以让开发人员快速的搭建出一个 数据统计,分析,图表,监控 一体化的 Web站点。
9
-
10
- [ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a1.png )
11
-
12
- [ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a2.png )
8
+ HttpReports 是 .Net Core 下的一个Web项目, 适用于WebAPI,Ocelot网关应用,MVC项目,非常适合针对微服务应用使用,通过中间件的形式集成到您的项目中,可以让开发人员快速的搭建出一个 数据统计,分析,图表,监控 一体化的 Web站点。
13
9
14
- [ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a3.png )
10
+
11
+ ![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a1.png )
12
+ ![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a2.png )
13
+ ![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a3.png )
15
14
16
15
17
16
#### 主要模块
@@ -22,7 +21,7 @@ HttpReports: https://github.com/SpringLeee/HttpReports
22
21
23
22
HttpReports.Web: https://github.com/SpringLeee/HttpReportsWeb
24
23
25
- 在线预览: http://175.102.11.117:8801 账号 admin 密码admin
24
+ 在线预览: http://175.102.11.117:8801 账号 admin 密码 123456
26
25
27
26
#### 支持项目类型
28
27
@@ -141,7 +140,7 @@ services.AddHttpReportsMiddlewire(WebType.API, DBType.SqlServer,"Pay");
141
140
142
141
##### 3. appsettings.json 配置连接字符串
143
142
144
- 打开 appsetting.json, 添加数据库连接字符串, 需要手动创建数据库 HttpReports
143
+ 打开 appsetting.json, 添加数据库连接字符串, ** 需要手动创建数据库 HttpReports**
145
144
146
145
``` csharp
147
146
" ConnectionStrings" : {
@@ -155,9 +154,8 @@ services.AddHttpReportsMiddlewire(WebType.API, DBType.SqlServer,"Pay");
155
154
156
155
#### HttpReports.Web部分
157
156
158
- github源码:https://github.com/SpringLeee/HttpReportsWeb 有需要的也可以下载源码后编译,默认的git分支是Core 2.2 版本,还有一个 core 3.0的分支;
159
-
160
-
157
+ github源码:https://github.com/SpringLeee/HttpReportsWeb
158
+ 有需要的也可以下载源码后编译,默认的git分支是Core 2.2 版本,还有一个 core 3.0的分支;
161
159
162
160
这里提供 core2.2 和 3.0 的发布版本下载:
163
161
@@ -186,8 +184,9 @@ Core 3.0 发布版本:https://files.cnblogs.com/files/myshowtime/HttpReports3.
186
184
| Password | Web站点后台登录密码,可修改 |
187
185
188
186
修改数据库类型和连接字符串, 然后打开命令行,启动程序,或者部署到站点也可以
187
+
189
188
``` csharp
190
- dotnet HttpReports .Web .dll
189
+ dotnet HttpReports .Web .dll
191
190
```
192
191
跳到登录页,输入默认账号 admin 密码 123456,登录到系统,看一下主要的几个页面
193
192
@@ -212,25 +211,44 @@ HttpReports 监控预警主要针对以下几点:
212
211
213
212
![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a7.png )
214
213
215
- 这里演示添加一个监控,监控频率 选1小时,也就是1个小时 运行一次, 然后填入预警的收件邮箱,可填写多个邮箱, 服务节点 可以选中单个和多个节点,默认的话,下边 4个监控都是关闭状态,这里 我打开 响应超时 和 请求错误监控
214
+ 这里演示添加一个监控,监控频率 选1小时,也就是1个小时 运行一次,然后填入预警的收件邮箱,可填写多个邮箱, 服务节点 可以选中单个和多个节点,默认的话,下边 4个监控都是关闭状态, 如果需要勾选启动即可
215
+
216
+ ##### 响应超时监控配置
217
+
218
+ 预防一段时间内接口大量超时,设置超时时间为4000ms , 超时率为0.05% (最多支持两位小数,设置值要带上%号)
216
219
217
- ![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a8.png )
220
+ ![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a8.png )
218
221
222
+ ##### 请求错误监控配置
223
+
224
+ 预防一段时间内接口大量错误,设置错误HTTP状态码为500,503, 超时率为20%
219
225
220
226
![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a9.png )
221
227
222
- 保存任务,任务自动运行,如果数据达到预警值时,您就会收到HttpReports 发送给您的通知邮件
228
+ ##### IP异常监控配置
229
+
230
+ 预防机器人请求,防止一段时间大量重复IP请求,设置IP重复率为15%
231
+
232
+ ![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_b11.png )
233
+
234
+ ##### 请求量监控
235
+
236
+ 预防短时间内接口新增大量的请求,造成系统异常,设置 单位时间 请求量为100000,当请求量达到这个值触发预警
237
+
238
+ ![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_b12.png )
239
+
240
+ 保存任务,任务自动运行,监控频率可以逐渐修改,找到适合系统的预警值, 如果数据达到预警值时,您就会收到HttpReports 发送给您的预警通知邮件
223
241
224
242
225
243
### 项目环境基本要求
226
244
227
- WebAPI或者网关项目支持的 .Net Core 版本 2.2, 3.0, 3.1;
245
+ 使用HttpReports中间件的 .Net Core 版本 2.2, 3.0, 3.1;
228
246
229
- HttpReports.Web 的core版本为 2.2
247
+ HttpReports.Web 的core版本为 2.2 , 3.0
230
248
231
249
### 性能事项
232
250
233
- HttpReports 中间件是异步操作 ,所以对api接口请求的时间可以忽略,但是由于实质使用的是数据库存储,所以要注意直接请求到数据库的压力。
251
+ HttpReports 中间件存储数据是异步操作 ,所以对api接口请求的时间可以忽略, 存储数据是也只是存储基本信息,对请求内容和响应内容不作记录,后台监控任务采用Quartz.Net实现
234
252
235
253
下面是用PostMan做的一个简单测试:
236
254
@@ -253,21 +271,24 @@ WebAPI内的方法:
253
271
```
254
272
PostMan分别对添加中间件和不添加中间件的 API请求 1000次,每300ms请求一次
255
273
256
- 说明 | 请求次数 | 平均响应时间
274
+ 说明 | 请求次数 | 平均响应时间 ms
257
275
-|-|-
258
276
原生API|1000|32.535
259
- 使用中间件|1000|32.899
277
+ 使用中间件|1000|32.899
260
278
261
279
### 总结
262
280
263
- HttpReports 的实现原理并不复杂,如果你想给你的.Net Core 应用,快速的添加一套图表监控系统 ,那么使用HttpReports 是一个不错的选择,如果能帮助到您的话,还请希望给个Star, 感谢
281
+ HttpReports 后台使用简单三层,前端使用BootStrap,如果你想给你的程序,快速的添加一套分析,图表,监控系统 ,那么使用HttpReports 是一个不错的选择,如果能帮助到您的话,还请希望给个Star, 感谢 😆
282
+
283
+ https://github.com/SpringLeee/HttpReports
264
284
285
+ [ MIT] ( https://github.com/SpringLeee/HttpReports/blob/master/LICENSE " MIT ")
265
286
266
- ### 问题反馈
287
+ ### 交流反馈
267
288
268
- 如果您在使用过程中遇到了什么问题或者有好的建议的话,可以反馈到QQ群,也可以添加我的微信, 希望可以帮助到您
289
+ 如果您在项目中使用了HttpReports,欢迎添加QQ群, 有想法 有建议,有bug 都欢迎大家来沟通, 也可以添加我的微信, 希望可以帮助到您
269
290
270
- ![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a13 .png )
291
+ ![ ] ( https://images.cnblogs.com/cnblogs_com/myshowtime/1627540/o_a15 .png )
271
292
272
293
273
294
0 commit comments