Skip to content

Metrics, SqlServer BatchBuilder, EfCore test fixes, and Weasel 8.8.0 upgrade#2233

Merged
jeremydmiller merged 18 commits intomainfrom
critterwatch
Feb 24, 2026
Merged

Metrics, SqlServer BatchBuilder, EfCore test fixes, and Weasel 8.8.0 upgrade#2233
jeremydmiller merged 18 commits intomainfrom
critterwatch

Conversation

@jeremydmiller
Copy link
Member

Summary

  • Add persistence metrics publishing through IWolverineObserver with SumByDestination, SumByMessageType, and Weight methods
  • Convert SqlServer persistence (NodePersistence + MessageStore) from CommandBuilder/SqlCommand to BatchBuilder/SqlBatch, mirroring the PostgreSQL pattern
  • Split EfCoreTests multi-tenancy tests into a separate EfCoreTests.MultiTenancy project to fix connection pool exhaustion
  • Upgrade Weasel.* NuGet packages from 8.7.1 to 8.8.0
  • Replace local JasperFx project references with NuGet packages
  • Various fixes: ServiceCapabilities filtering, CloudEvents sequenced partitioning, EF Core schema management

Test plan

  • SqlServerTests: 268/268 passed
  • EfCoreTests: 116/117 passed (1 flaky timing-dependent test)
  • EfCoreTests.MultiTenancy: 123/123 passed
  • Full solution builds clean on net9.0

🤖 Generated with Claude Code

jeremydmiller and others added 17 commits February 24, 2026 11:40
…ernal types from ServiceCapabilities

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
System.Text.Json has no built-in converter for System.Version, causing
it to serialize as {} and deserialize as null. This silently dropped
Version and WolverineVersion from ServiceCapabilities on the wire.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
System-role endpoints are internal to Wolverine and should not appear in
the exported ServiceCapabilities, matching the existing filtering pattern
used throughout Wolverine. Also adds tests for assembly-level message
exclusion and system endpoint filtering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When EnableInboxPartitioning is true, FetchCountsAsync now estimates
row counts from pg_class statistics instead of SELECT count(*) GROUP BY,
avoiding full table scans on large inbox tables. Falls back to exact
count when partition stats are stale (before VACUUM/ANALYZE has run).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…HandlingMetrics

Add aggregation methods for collating metrics across dimensions:
- SumByDestination groups by Destination URI with MessageType="*"
- SumByMessageType groups by MessageType with Destination="all://"
- Weight(int) multiplies all numeric values for weighted average support

Also removes NodeNumber from the record and adds Key() helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…amespace

Documents the full metrics data flow: IHandlerMetricsData records are posted
to the batching pipeline, applied to mutable PerTenantTracking counters, then
periodically exported as immutable MessageHandlingMetrics snapshots via the
IWolverineObserver. Covers all 11 files including record params, aggregation
methods, and weighted scaling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ate to latest versions

- JasperFx 1.19.0 → 1.20.0
- JasperFx.Events 1.21.0 → 1.21.1
- JasperFx.RuntimeCompiler already at 4.4.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…fix multi-tenancy

Replace EF Core's Database.EnsureCreatedAsync() (which bypasses EF migrations and
conflicts with Weasel schema management) with Weasel's EnsureDatabaseExistsAsync()
for catalog creation and CreateMigrationAsync()/ExecuteAsync() for table migration.

Key fixes:
- Add WolverineDbContextExtensions.EnsureDatabaseExistsAsync with credential fallback
  logic for NpgsqlDataSource connections that strip passwords
- Fix PostgresqlTenantedMessageStore.RefreshAsync DataSource branch missing the
  withMigration check, causing RefreshLiteAsync to incorrectly trigger migrations
- Add ensureAllTenantDatabasesExistAsync() to DataSource builder to create tenant
  databases via admin data source before building DbContexts
- Switch DataSource builder from EF Core IMigrator to Weasel migration
- Fix EntityFrameworkCoreSystemPart.FindResources() to skip tenanted DbContexts,
  preventing double migration from TenantedDbContextInitializer and DatabaseResource
- Remove duplicate AddResourceSetupOnStartup() calls from multi-tenancy tests
- Upgrade Weasel packages from 8.6.2 to 8.7.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…on pool exhaustion

Multi-tenancy tests were causing cascading failures when run with other EfCoreTests
due to PostgreSQL/SQL Server connection pool exhaustion. Moved all multi-tenancy tests
to EfCoreTests.MultiTenancy project (separate process = isolated pools). Also fixed
DisposeAsync across test fixtures to properly dispose hosts and clear connection pools,
added collection attributes for predictable test ordering, and updated the efcore
GitHub Action to build and test both projects.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…of CommandBuilder (SqlCommand)

Mirrors the PostgreSQL pattern by using Weasel.SqlServer's BatchBuilder with StartNewCommand()
for PersistAgentRestrictionsAsync, AssignAgentsAsync, and deleteMany methods.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant