NetPro.Analysic 6.0.16

dotnet add package NetPro.Analysic --version 6.0.16                
NuGet\Install-Package NetPro.Analysic -Version 6.0.16                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetPro.Analysic" Version="6.0.16" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetPro.Analysic --version 6.0.16                
#r "nuget: NetPro.Analysic, 6.0.16"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NetPro.Analysic as a Cake Addin
#addin nuget:?package=NetPro.Analysic&version=6.0.16

// Install NetPro.Analysic as a Cake Tool
#tool nuget:?package=NetPro.Analysic&version=6.0.16                

NetPro.Analysic使用

NuGet

同ip下对请求流量的精确控制,可控制1天 或者1小时内的错误数正确数

使用

appsetting.json
	"RequestAnalysisOption": {
		"Enabled": true, //是否开启流量分析
		"PolicyOption": [
			{
				"Enabled": true,
				"Path": "/api/v1/test/pay/post",
				"MaxSucceedLimit": 1000000, //当前path地址同ip一天内最大访问次数
				"MaxErrorLimit": 1000000,
				"HitDuration": "2d"  //触发限制的时间周期
				"LockDuration":"1d"//被锁定的持续时间
				"IsGlobalLock":true,
			},
			{
				"Enabled": true,
				"Path": "/api/v1/test/pay/post/account", 
				"MaxSucceedLimit": 100,
				"MaxErrorLimit": 50,
				"HitDuration": "2h"  //锁定持续2小时
			},
			{
				"Enabled": true,
				"Path": "/api/v1/test/pay/post/getname",
				"MaxSucceedLimit": 100,
				"MaxErrorLimit": 50,
				"HitDuration": "10m"  //锁定持续10分钟
			},
			{
				"Enabled": true,
				"Path": "/api/v1/test/pay/post/gatage",
				"MaxSucceedLimit": 100,
				"MaxErrorLimit": 50,
				"HitDuration": "10s"  //锁定持续10秒
			}
		]
	}

启用服务
方式一:
public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
    services.AddRequestAnalysic();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    app.UseRequestAnalysis();
}
方式二:

如增加了以下环境变量配置,可省略方式一中的初始化代码,内部将自动执行以上初始化

 "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "NetPro.Startup"

TODO:


 全局接口熔断策略:
 20秒以内超过10次请求指定接口错误率超过20% 触发阈值  持续10秒熔断(指标都是可配置)
 全局接口限制策略:
 同ip1小时内错误数大于10次触发阈值(指标都是可配置)
 同ip1小时内请求数大于20次触发阈值(指标都是可配置)

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.0.16 210 7/24/2023
6.0.15 463 7/19/2022
6.0.14 456 7/10/2022
6.0.13 443 6/15/2022
6.0.12 441 6/15/2022
6.0.11 445 6/15/2022
6.0.10 469 6/11/2022
6.0.9 447 6/8/2022
6.0.8 482 5/26/2022
6.0.8-beta.3 118 5/24/2022
6.0.8-beta.2 118 5/24/2022
6.0.7 476 5/18/2022
6.0.6 474 4/28/2022
6.0.5 470 3/30/2022
6.0.5-beta.20 117 4/27/2022
6.0.5-beta.19 124 4/25/2022
6.0.5-beta.18 117 4/22/2022
6.0.5-beta.17 129 4/16/2022
6.0.5-beta.16 130 4/8/2022
6.0.5-beta.15 126 4/8/2022
6.0.5-beta.14 130 4/7/2022
6.0.5-beta.13 137 4/7/2022
6.0.5-beta.12 128 4/6/2022
6.0.5-beta.11 125 4/6/2022
6.0.5-beta.10 124 3/31/2022
6.0.5-beta.9 130 3/26/2022
6.0.5-beta.8 126 3/22/2022
6.0.5-beta.7 121 3/21/2022
6.0.5-beta.6 127 3/14/2022
6.0.5-beta.5 125 3/2/2022
6.0.5-beta.4 126 2/22/2022
6.0.5-beta.3 125 2/18/2022
6.0.5-beta.2 123 2/18/2022
6.0.5-beta.1 129 2/16/2022
6.0.4 494 2/10/2022
6.0.3 465 2/9/2022
6.0.3-beta.9 122 2/10/2022
6.0.3-beta.7 138 1/27/2022
6.0.3-beta.6 136 1/19/2022
6.0.3-beta.5 131 1/17/2022
6.0.3-beta.4 136 1/16/2022
6.0.3-beta.3 141 1/14/2022
6.0.3-beta.2 139 1/13/2022
6.0.3-beta.1 165 1/11/2022
6.0.2 354 1/6/2022
6.0.1 1,001 12/3/2021
3.1.0 472 9/27/2020