NServiceBus.SimpleMonitoring 4.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NServiceBus.SimpleMonitoring --version 4.0.0                
NuGet\Install-Package NServiceBus.SimpleMonitoring -Version 4.0.0                
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="NServiceBus.SimpleMonitoring" Version="4.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NServiceBus.SimpleMonitoring --version 4.0.0                
#r "nuget: NServiceBus.SimpleMonitoring, 4.0.0"                
#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 NServiceBus.SimpleMonitoring as a Cake Addin
#addin nuget:?package=NServiceBus.SimpleMonitoring&version=4.0.0

// Install NServiceBus.SimpleMonitoring as a Cake Tool
#tool nuget:?package=NServiceBus.SimpleMonitoring&version=4.0.0                

NServiceBus.SimpleMonitoring

Adds some additional diagnostics to NServiceBus 8, 7, 6 and 5.

Version compatibility

NServiceBus NServiceBus.SimpleMonitoring
v5.x v1.x
v6.x v2.x
v7.x v3.x
v8.x v4.x

Please note that there might be versions targeting other NServiceBus versions. Please check the Releases for all versions. or check the root of the master branch of the repository.

Use cases

Additional processing duration information about processed messages is written to the log. A threshold can be configured so that a Warning log entry will be written indicating that a message is still processing. For example, a message should take less then 10 seconds to be processed, if it takes longer a Warning log entry is written while the message is still being processed. Messages that hang an endpoint can now easily be identified. When a message completes processing its total processing duration is written to the log with level Debug but a message that took more then the threshold will also be logged with log level Warning.

Log event examples

Log event written for every completed message:

DEBUG NServiceBus.SimpleMonitoring Message '000526b2-44cd-4d6d-9aa3-a8ad0126e6e6' total processing duration: '0:00:00,1349758'

Log event written for completed messages where the duration exceeds the threshold:

WARN NServiceBus.SimpleMonitoring Message '6625296c-50b1-4f07-ac90-a8ad0127304a' total processing duration (0:00:23,0370282) is larger than the threshold '0:00:15'.

Log event written every interval for each message currently being processed but exceeding the threshold

WARN NServiceBus.SimpleMonitoring Message '6625296c-50b1-4f07-ac90-a8ad0127304a' is already running for '0:00:20,1372179' which is larger than the thresshold '0:00:15'.

Note that the formatting of the log events is different per used logging framework but the message part is the same.

Installation

Via Nuget

Install the Nuget package NServiceBus.SimpleMonitoring

Zero configuration and deployment

Alternatively, download the nuget package, extract the DLL and drop-in the DLL in the endpoint installation path and restart the endpoint. Assembly scanning ensures this module will get auto loaded and enabled using default configuration values.

Configuration

Set the Warning threshold

The default warning threshold is 15 seconds.

The threshold value can only be configured via code or via AppSetting.

Note that is both are used the AppSetting takes precedence.

Via code:

endpointConfiguration.ReportLongRunningMessages(TimeSpan.FromMinutes(3));

Via AppSetting:

  <appSettings>
    <add key="NServiceBus/SimpleMonitoring/LongRunningMessages/WarningThresholdInSeconds" value="180"/>
  </appSettings>

Note that the above snippet will report messages with log level Warning if their processing duration is over 180 seconds (3 minutes).

Show durations for all messages

Message processing durations are always logged with log level Debug however the default NServiceBus log level is Info since version 5. Please set the NServiceBus logging log level to Debug if this is required.

Product 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. 
.NET Framework net472 is compatible.  net48 was computed.  net481 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.