Repository navigation
Target net10.0 and net11.0, fix HTTP and header bugs, run CI on every PR - #14
Merged
Merged
Conversation
- Multi-target net10.0 and net11.0 (.NET 8 and 9 are out of support). Replace the deprecated Microsoft.AspNetCore.Http.Abstractions 2.2.0 package with a framework reference and update dependencies. - AddMetronome() now registers IHttpContextAccessor, so apps that don't use Identity no longer fail on the first tracked HTTP call. - HttpCallCountingHandler passes calls made outside a request through untracked instead of throwing NullReferenceException, and is registered as transient. - HttpCallCounter records calls under a lock, like DbCallCounter, so concurrent HTTP calls are all counted. - Fix the response header: drop the stray trailing text, format numbers with the invariant culture, and set rather than Add the header. - Use structured log message templates. - Move DbCallCountingInterceptor into the NimblePros.Metronome namespace and fix its nullability warnings. - Add integration tests for the middleware, HTTP handler and EF Core interceptor on a TestServer app without Identity. - CI: drop the paths filter so every PR to main is built, install the .NET 10 and 11 SDKs, test both frameworks and upload the package. - Bump to 0.5.0 and update the README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014WE1LzSNPYAu6PDCk7wEEo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Retargets the package to .NET 10 and 11, fixes several bugs in HTTP tracking and the response header, and makes CI run on every pull request.
Platform
net10.0;net11.0. .NET 8 and 9 reached end of support on Nov 10, 2026. The sample targetsnet10.0.Microsoft.AspNetCore.Http.Abstractions2.2.0 with<FrameworkReference Include="Microsoft.AspNetCore.App" />. That also covers the DI andMicrosoft.Extensions.Httpreferences, so those are removed.10.0.0or11.0.0depending on the framework, Dapper is2.1.100, and SourceLink is updated.0.5.0, with new release notes. This is also the first release that will include the Dapper support from Add Dapper extensions that track db calls #13.Bug fixes
IHttpContextAccessorwasn't registered.AddMetronome()now registers it. Before this, any app without Identity failed with an exception on its first tracked HTTP call.NullReferenceException. Calls from hosted services or startup code are now sent without being counted.HttpCallCounternow records under a lock, asDbCallCounteralready does. The handler is registered as transient, which is whatIHttpClientFactoryexpects.HttpCallCount: nat the end of the header is gone. Numbers use the invariant culture, so a de-DE server no longer writes6,4678ms. The header is set rather thanAdded, so a duplicate no longer throws.DbCallCountingInterceptorwas in the global namespace and is now inNimblePros.Metronome. Its nullability warnings are fixed.Behavior to check
DbCallCountingInterceptorby name needsusing NimblePros.Metronome;. Code that goes throughAddMetronomeDbTrackingis unaffected.AddDbContextPoolandAddDbContextFactoryaren't supported, and that HTTP calls outside a request aren't counted.CI
paths:filter, so every push and PR tomainis built. Before this, changes to the sample or the workflows never ran CI. No runs at all show up for this repository, so if this PR doesn't start a run, check Settings → Actions..nupkg. The release workflow pushes with--skip-duplicate. Both workflows havepermissions: contents: read.Testing
dotnet build,dotnet testanddotnet packonci.slnfsucceed with SDKs 10.0.404 and 11.0.100. All 24 tests pass on both net10.0 and net11.0, and the library builds with no warnings.MetronomeIntegrationTestsrun a minimal API app on aTestServerwithout Identity. They cover:AddHttpContextAccessor()line removed, 3 of these tests fail, so they catch the original bug./dapperreturnsNimblePros.Metronome: DbCallCount=1;DbCallDuration=0.2749ms;HttpCallCount=0;HttpCallDuration=0ms.Generated by Claude Code