Galosys.Foundation.Actuator
26.5.20.1
dotnet add package Galosys.Foundation.Actuator --version 26.5.20.1
NuGet\Install-Package Galosys.Foundation.Actuator -Version 26.5.20.1
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="Galosys.Foundation.Actuator" Version="26.5.20.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Galosys.Foundation.Actuator" Version="26.5.20.1" />
<PackageReference Include="Galosys.Foundation.Actuator" />
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 Galosys.Foundation.Actuator --version 26.5.20.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Galosys.Foundation.Actuator, 26.5.20.1"
#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 Galosys.Foundation.Actuator@26.5.20.1
#: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=Galosys.Foundation.Actuator&version=26.5.20.1
#tool nuget:?package=Galosys.Foundation.Actuator&version=26.5.20.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Galosys.Foundation.Actuator
系统可观测性模块,提供审计日志、登录日志、请求日志的分层通道基础设施和后台消费者。
功能概述
| 组件 | 说明 |
|---|---|
AuditLog |
审计日志实体(Entity<long>) |
LoginLog |
登录日志实体(Entity<long>) |
RequestLog |
API 请求日志实体(Entity<long>) |
RequestLogCreateInput |
请求日志创建输入(Filter → Channel 传输对象) |
ILogChannel<T> |
分层日志通道抽象接口 |
ObservableLogChannel<T> |
Tier 1 可观测层(BoundedChannel + DropOldest) |
ReliableLogChannel<T> |
Tier 2 业务层(BoundedChannel + Wait) |
LoggingChannelOptions |
通道配置(容量/批量/采样率/重试) |
LoginLogReliableConsumer |
LoginLog 后台消费者(Reliable + 重试) |
AuditLogReliableConsumer |
AuditLog 后台消费者(Reliable + 重试) |
RequestLogBatchConsumer |
RequestLog 批量消费者(Observable + 批量写入) |
IAuditLogRepository |
AuditLog 持久化接口 |
ILoginLogRepository |
LoginLog 持久化接口 |
IRequestLogRepository |
RequestLog 持久化接口(支持批量) |
分层通道架构
| 层级 | 实现 | 容量 | 满时策略 | 适用场景 |
|---|---|---|---|---|
| Tier 1 可观测层 | ObservableLogChannel<T> |
50000 | DropOldest | RequestLog 等高流量可丢弃日志 |
| Tier 2 业务层 | ReliableLogChannel<T> |
5000 | Wait | AuditLog、LoginLog 等不可丢失日志 |
Quick Start
最小化配置
// 注册 Actuator 模块(Channel + Consumer)
services.AddActuator();
// 注册 EFCore 实现(提供 Repository 实现)
services.AddActuatorEFCore<MyDbContext>();
配置项(appsettings.json)
{
"LoggingChannels": {
"Observable": {
"Capacity": 50000, // Channel 容量
"BatchSize": 200, // 批量读取大小
"BatchIntervalMs": 500, // 批量读取间隔(ms)
"SamplingRate": 0.1, // 采样率 0.0~1.0
"AlwaysLogErrors": true // 错误始终记录
},
"Reliable": {
"Capacity": 5000, // Channel 容量
"MaxRetryCount": 3, // 最大重试次数
"RetryBaseDelayMs": 100 // 重试基础延迟(ms),指数退避
}
}
}
在 ASP.NET Core Filter 中使用
// AuditLogAttribute — 审计日志(自动记录请求/响应)
[AuditLog("修改用户", "User")]
public async Task<UnifiedResponse> UpdateUser(UpdateUserCmd cmd) { ... }
// RequestLogAttribute — 请求日志(自动记录耗时/状态)
[RequestLog("用户登录")]
public async Task<UnifiedResponse> Login(LoginCmd cmd) { ... }
// 手动发布登录日志
await HttpContext.PublishLoginLogAsync(userName, status: 1);
从 Core/AspNetCore 迁移说明
| 旧方法 | 新方法 |
|---|---|
services.AddLoginLogChannel() |
services.AddActuator() |
services.AddAuditLogChannel() |
services.AddActuator() |
services.AddRequestLogChannel() |
services.AddActuator() |
Galosys.Foundation.Core.AuditLog |
Galosys.Foundation.Actuator.AuditLog |
Galosys.Foundation.Core.LoginLog |
Galosys.Foundation.Actuator.LoginLog |
Galosys.Foundation.Core.RequestLog |
Galosys.Foundation.Actuator.RequestLog |
Microsoft.AspNetCore.Mvc.Filters.RequestLogCreateInput |
Galosys.Foundation.Actuator.RequestLogCreateInput |
Core 和 AspNetCore 中的旧方法已标记
[Obsolete]或直接移除,请迁移至 Actuator 模块。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Galosys.Foundation.Core (>= 26.5.20.1)
- microsoft.extensions.hosting (>= 8.0.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Galosys.Foundation.Actuator:
| Package | Downloads |
|---|---|
|
Galosys.Foundation.AspNetCore
Galosys.Foundation快速开发库 |
|
|
Galosys.Foundation.Rougamo
Galosys.Foundation快速开发库 |
|
|
Galosys.Foundation.AspectCore
Galosys.Foundation快速开发库 |
|
|
Galosys.Foundation.Castle
Galosys.Foundation快速开发库 |
|
|
Galosys.Foundation.Actuator.EntityFrameworkCore
Galosys.Foundation快速开发库 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.5.20.1 | 415 | 5/20/2026 |
| 26.5.19.1 | 427 | 5/19/2026 |
| 26.5.18.1 | 431 | 5/18/2026 |
| 26.5.15.1 | 429 | 5/15/2026 |
| 26.5.12.3 | 421 | 5/12/2026 |
| 26.5.12.2 | 436 | 5/12/2026 |
| 26.4.27.1-rc1 | 373 | 4/26/2026 |
| 26.4.25.1-rc1 | 381 | 4/25/2026 |
| 26.4.22.2-rc7 | 379 | 4/22/2026 |
| 26.4.22.2-rc6 | 382 | 4/22/2026 |
| 26.4.22.2-rc4 | 387 | 4/22/2026 |
| 26.4.22.2-rc3 | 371 | 4/22/2026 |