NimblePros.Metronome 0.4.1

dotnet add package NimblePros.Metronome --version 0.4.1
                    
NuGet\Install-Package NimblePros.Metronome -Version 0.4.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="NimblePros.Metronome" Version="0.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NimblePros.Metronome" Version="0.4.1" />
                    
Directory.Packages.props
<PackageReference Include="NimblePros.Metronome" />
                    
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 NimblePros.Metronome --version 0.4.1
                    
#r "nuget: NimblePros.Metronome, 0.4.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 NimblePros.Metronome@0.4.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=NimblePros.Metronome&version=0.4.1
                    
Install as a Cake Addin
#tool nuget:?package=NimblePros.Metronome&version=0.4.1
                    
Install as a Cake Tool

Metronome by NimblePros

A simple tool for tracking Database and Http calls per ASP.NET Core request.

Installation

Install the NuGet package:

Install-Package NimblePros.Metronome

dotnet add package NimblePros.Metronome

Usage

Refer to the samples in the samples directory.

Wire up services

builder.Services.AddMetronome();

Add Middleware

Add the middleware near the top of the pipeline. Recommended to be used only in development environment.

if (app.Environment.IsDevelopment())
{
  app.UseMetronomeLoggingMiddleware();
}

EF Core Query Tracking

builder.Services.AddDbContext<ApplicationDbContext>((provider, options) =>
    options.UseSqlite(connectionString) // or any other provider
        .AddMetronomeDbTracking(provider)
    );

HttpClient Tracking

// simple named client
builder.Services.AddHttpClient("Foo")
    .AddMetronomeHandler();

// strongly typed client
builder.Services.AddScoped<IPostsService, PostsService>(); // interface is optional
builder.Services.AddHttpClient<IPostsService, PostsService>()
    .ConfigureHttpClient(client =>
    {
      client.BaseAddress = new Uri("https://my-json-server.typicode.com/typicode/demo/");
    })
    .AddMetronomeHandler();

Expected Output

Log Output

When hitting individual pages or endpoints, you should see the following output in the console:

info: NimblePros.Metronome.CombinedCallLoggingMiddleware[0]
      Database calls: 2, Total time: 6.4678 ms
info: NimblePros.Metronome.CombinedCallLoggingMiddleware[0]
      HTTP calls: 1, Total time: 222.3137 ms

HTTP Headers

In addition, the information is added to a response header (unless configured not to do so):

image

Using the Information

You can use this to identify slow pages or endpoints and optimize them by adding caching, combining queries, or reducing the number of HTTP calls.

If you need help doing this in an effective way across your entire application, contact NimblePros. We do this all the time.

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 (4)

Showing the top 4 NuGet packages that depend on NimblePros.Metronome:

Package Downloads
SU2.C15e.Infrastructure

Clean Architecture template — Infrastructure layer (EF Core interceptors for audit/event-dispatch/soft-delete/no-lock, EfRepository, AppDbContext base, Dapper IDbSession, Redis + HybridCache + DistributedLock, Kafka producer/consumer base, MongoDB.EFCore wiring, Hangfire adapters, PhenX bulk-insert for SQL Server/PostgreSQL/MySQL/SQLite/Oracle, Serilog + OpenTelemetry wiring, fake implementations of UseCases interfaces). Numeronym `C15e` = CleanArchitecture. Generation 2026 series.

SU2.C15e.Web.Defaults

Clean Architecture template — batteries-included default host bundle for SU2.Web. Ships the AddServiceConfigs / AddOptionConfigs / AddMediatorSourceGen composition + UseAppMiddlewareAndSeedDatabase pipeline + Audit.NET HTTP middleware (UseAuditHttpMiddleware) + AddAuditHttpClient. References the meta SU2.Infrastructure so a host gets the full kitchen-sink in one reference. Lean consumers reference SU2.Web (core) + per-feature AddXxx() instead. Numeronym `C15e` = CleanArchitecture. Generation 2026 series.

SU2.Infrastructure

Clean Architecture template — Infrastructure layer (EF Core interceptors for audit/event-dispatch/soft-delete/no-lock, EfRepository, AppDbContext base, Dapper IDbSession, Redis + HybridCache + DistributedLock, Kafka producer/consumer base, MongoDB.EFCore wiring, Hangfire adapters, PhenX bulk-insert for SQL Server/PostgreSQL/MySQL/SQLite/Oracle, Serilog + OpenTelemetry wiring, fake implementations of UseCases interfaces). Numeronym `C15e` = CleanArchitecture. Generation 2026 series.

SU2.Web

Clean Architecture template — Web library layer (FastEndpoints BaseEndpoint base classes, InternalAuthorize, middleware: GlobalExceptionHandler/RequestCorrelation/Timeout, JsonErrorMessageResolver, CORS + Compression setup helpers, ForwardCurrentUserHandler, CurrentUser/CurrentUserOptions services, FastEndpointsErrorBuilder, ServiceConfigs + OptionConfigs + MediatorConfig + MiddlewareConfig extension methods). Numeronym `C15e` = CleanArchitecture. Generation 2026 series.

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on NimblePros.Metronome:

Repository Stars
ardalis/CleanArchitecture
Clean Architecture Solution Template: A proven Clean Architecture Template for ASP.NET Core 10
NimblePros/eShopOnWeb
Sample ASP.NET Core 10.0 reference application, powered by Microsoft, demonstrating a domain-centric application architecture with monolithic deployment model.
DevBetterCom/DevBetterWeb
A simple web application for devBetter
Version Downloads Last Updated
0.4.1 36,975 4/15/2025
0.4.0 1,610 12/20/2024
0.2.0 2,328 12/18/2024
0.1.0 237 12/18/2024

* Now it's on net8