VOOZH about

URL: https://www.nuget.org/packages/NetPro.Analysic

⇱ NuGet Gallery | NetPro.Analysic 6.0.16




👁 Image
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.
<PackageVersion Include="NetPro.Analysic" Version="6.0.16" />
 
Directory.Packages.props
<PackageReference Include="NetPro.Analysic" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NetPro.Analysic --version 6.0.16
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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.
#:package NetPro.Analysic@6.0.16
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NetPro.Analysic&version=6.0.16
 
Install as a Cake Addin
#tool nuget:?package=NetPro.Analysic&version=6.0.16
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 is compatible.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp3.1 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 385 7/24/2023
6.0.15 641 7/19/2022
6.0.14 653 7/10/2022
6.0.13 617 6/15/2022
6.0.12 605 6/15/2022
6.0.11 610 6/15/2022
6.0.10 639 6/11/2022
6.0.9 612 6/8/2022
6.0.8 657 5/26/2022
6.0.8-beta.3 253 5/24/2022
6.0.8-beta.2 265 5/24/2022
6.0.7 665 5/18/2022
6.0.6 639 4/28/2022
6.0.5-beta.20 273 4/27/2022
6.0.5-beta.19 258 4/25/2022
6.0.5-beta.18 261 4/22/2022
6.0.5-beta.17 274 4/16/2022
6.0.5-beta.16 275 4/8/2022
6.0.5-beta.15 281 4/8/2022
6.0.5-beta.14 288 4/7/2022
Loading failed