Synergy.Monitor.Client
1.0.1
dotnet add package Synergy.Monitor.Client --version 1.0.1
NuGet\Install-Package Synergy.Monitor.Client -Version 1.0.1
<PackageReference Include="Synergy.Monitor.Client" Version="1.0.1" />
<PackageVersion Include="Synergy.Monitor.Client" Version="1.0.1" />
<PackageReference Include="Synergy.Monitor.Client" />
paket add Synergy.Monitor.Client --version 1.0.1
#r "nuget: Synergy.Monitor.Client, 1.0.1"
#:package Synergy.Monitor.Client@1.0.1
#addin nuget:?package=Synergy.Monitor.Client&version=1.0.1
#tool nuget:?package=Synergy.Monitor.Client&version=1.0.1
Synergy.Monitor.Client
Drop-in Wolverine middleware for Synergy Bounded Contexts. Automatically captures every Wolverine handler execution and publishes a WorkMonitoringEvent to the monitor.domain-events Kafka topic — with zero changes to your existing handlers.
Quick Start
1. Install the package
dotnet add package Synergy.Monitor.Client
2. Register services in Program.cs
// Register monitor services (before builder.Build())
builder.Services.AddSynergyMonitoring(builder.Configuration);
// Add middleware to Wolverine
builder.Host.UseWolverine(opts =>
{
opts.AddSynergyMonitoringMiddleware();
});
3. Add configuration to appsettings.json
{
"SynergyMonitor": {
"BoundedContext": "YourBCName",
"KafkaBootstrapServers": "your-kafka-broker:9092",
"TopicName": "monitor.domain-events",
"Enabled": true
}
}
That's it. Every Wolverine handler in your application is now automatically monitored.
What Gets Captured Automatically
| Field | Source |
|---|---|
BoundedContext |
Your config value |
EventType |
Wolverine message type name |
TenantId |
JWT claim (tenant_id) |
ActorUserId |
JWT claim (sub) |
ActorName |
JWT claim (name / preferred_username) |
SubjectId |
Id / AggregateId property on the message |
OccurredAt |
UTC timestamp |
DurationMs |
Handler execution time in milliseconds |
RequestPath |
HTTP request path |
IpAddress |
Client IP address |
CorrelationId |
Wolverine correlation ID |
Before/After Diff Tracking (Optional)
For update operations where you need old vs new entity state, inject KafkaMonitorPublisher directly into your handler and publish manually:
public class UpdateUserCommandHandler(
IUserRepository repo,
KafkaMonitorPublisher monitorPublisher)
{
public async Task Handle(UpdateUserCommand command, CancellationToken ct)
{
var existing = await repo.GetByIdAsync(command.Id, ct);
var oldJson = JsonSerializer.Serialize(existing);
existing.Update(command);
await repo.SaveAsync(existing, ct);
await monitorPublisher.PublishAsync(new WorkMonitoringEvent(
BoundedContext: "Admin",
EventType: "UpdateUser",
TenantId: command.TenantId,
OccurredAt: DateTime.UtcNow,
ActorUserId: command.ActorUserId,
ActorName: command.ActorName,
SubjectId: existing.Id,
SubjectType: "User",
OldValues: oldJson,
NewValues: JsonSerializer.Serialize(existing),
EventId: Guid.NewGuid()
), ct);
}
}
Configuration Reference
| Property | Required | Default | Description |
|---|---|---|---|
BoundedContext |
Yes | — | Your BC name as it appears in audit entries |
KafkaBootstrapServers |
Yes | — | Kafka broker address |
TopicName |
No | monitor.domain-events |
Kafka topic to publish to |
DefaultTenantId |
No | null |
Fallback tenant ID for background handlers without a JWT |
Enabled |
No | true |
Set to false to disable publishing without removing the package |
Safety Guarantee
The middleware never throws and never blocks your handler. If Kafka is unavailable, the event is silently logged and dropped. Your handler always completes successfully regardless of monitoring state.
Requirements
- .NET 8
- WolverineFx 5.x
- ASP.NET Core (for
IHttpContextAccessor— registered automatically byAddControllers())
License
MIT
| 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. |
-
net8.0
- Confluent.Kafka (>= 2.3.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
- WolverineFx (>= 5.39.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.