NetPro.Analysic
6.0.3-beta.9
This is a prerelease version of NetPro.Analysic.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package NetPro.Analysic --version 6.0.3-beta.9
NuGet\Install-Package NetPro.Analysic -Version 6.0.3-beta.9
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.3-beta.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetPro.Analysic --version 6.0.3-beta.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NetPro.Analysic, 6.0.3-beta.9"
#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.3-beta.9&prerelease // Install NetPro.Analysic as a Cake Tool #tool nuget:?package=NetPro.Analysic&version=6.0.3-beta.9&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NetPro.Analysic使用
同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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- NetPro.Core (>= 6.0.3-beta.9)
- NetPro.CsRedis (>= 6.0.3-beta.9)
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 | 202 | 7/24/2023 |
6.0.15 | 457 | 7/19/2022 |
6.0.14 | 450 | 7/10/2022 |
6.0.13 | 435 | 6/15/2022 |
6.0.12 | 435 | 6/15/2022 |
6.0.11 | 439 | 6/15/2022 |
6.0.10 | 462 | 6/11/2022 |
6.0.9 | 440 | 6/8/2022 |
6.0.8 | 476 | 5/26/2022 |
6.0.8-beta.3 | 116 | 5/24/2022 |
6.0.8-beta.2 | 116 | 5/24/2022 |
6.0.7 | 469 | 5/18/2022 |
6.0.6 | 468 | 4/28/2022 |
6.0.5 | 458 | 3/30/2022 |
6.0.5-beta.20 | 115 | 4/27/2022 |
6.0.5-beta.19 | 121 | 4/25/2022 |
6.0.5-beta.18 | 114 | 4/22/2022 |
6.0.5-beta.17 | 121 | 4/16/2022 |
6.0.5-beta.16 | 128 | 4/8/2022 |
6.0.5-beta.15 | 124 | 4/8/2022 |
6.0.5-beta.14 | 128 | 4/7/2022 |
6.0.5-beta.13 | 135 | 4/7/2022 |
6.0.5-beta.12 | 126 | 4/6/2022 |
6.0.5-beta.11 | 123 | 4/6/2022 |
6.0.5-beta.10 | 122 | 3/31/2022 |
6.0.5-beta.9 | 128 | 3/26/2022 |
6.0.5-beta.8 | 124 | 3/22/2022 |
6.0.5-beta.7 | 119 | 3/21/2022 |
6.0.5-beta.6 | 125 | 3/14/2022 |
6.0.5-beta.5 | 123 | 3/2/2022 |
6.0.5-beta.4 | 122 | 2/22/2022 |
6.0.5-beta.3 | 123 | 2/18/2022 |
6.0.5-beta.2 | 121 | 2/18/2022 |
6.0.5-beta.1 | 127 | 2/16/2022 |
6.0.4 | 488 | 2/10/2022 |
6.0.3 | 459 | 2/9/2022 |
6.0.3-beta.9 | 120 | 2/10/2022 |
6.0.3-beta.7 | 135 | 1/27/2022 |
6.0.3-beta.6 | 134 | 1/19/2022 |
6.0.3-beta.5 | 129 | 1/17/2022 |
6.0.3-beta.4 | 134 | 1/16/2022 |
6.0.3-beta.3 | 139 | 1/14/2022 |
6.0.3-beta.2 | 137 | 1/13/2022 |
6.0.3-beta.1 | 163 | 1/11/2022 |
6.0.2 | 348 | 1/6/2022 |
6.0.1 | 995 | 12/3/2021 |
3.1.0 | 466 | 9/27/2020 |