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
                    
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="Synergy.Monitor.Client" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Synergy.Monitor.Client" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Synergy.Monitor.Client" />
                    
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 Synergy.Monitor.Client --version 1.0.1
                    
#r "nuget: Synergy.Monitor.Client, 1.0.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 Synergy.Monitor.Client@1.0.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=Synergy.Monitor.Client&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Synergy.Monitor.Client&version=1.0.1
                    
Install as a Cake Tool

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 by AddControllers())

License

MIT

Product 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.

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
1.0.1 307 7/7/2026
1.0.0 117 7/7/2026