![]() |
VOOZH | about |
dotnet add package ZeroAlloc.EventSourcing.Telemetry --version 1.0.0
NuGet\Install-Package ZeroAlloc.EventSourcing.Telemetry -Version 1.0.0
<PackageReference Include="ZeroAlloc.EventSourcing.Telemetry" Version="1.0.0" />
<PackageVersion Include="ZeroAlloc.EventSourcing.Telemetry" Version="1.0.0" />Directory.Packages.props
<PackageReference Include="ZeroAlloc.EventSourcing.Telemetry" />Project file
paket add ZeroAlloc.EventSourcing.Telemetry --version 1.0.0
#r "nuget: ZeroAlloc.EventSourcing.Telemetry, 1.0.0"
#:package ZeroAlloc.EventSourcing.Telemetry@1.0.0
#addin nuget:?package=ZeroAlloc.EventSourcing.Telemetry&version=1.0.0Install as a Cake Addin
#tool nuget:?package=ZeroAlloc.EventSourcing.Telemetry&version=1.0.0Install as a Cake Tool
A high-performance, zero-allocation event sourcing library for .NET with streaming capabilities and production-grade reliability features.
dotnet add package ZeroAlloc.EventSourcing
var adapter = new SqlEventStoreAdapter(connectionString);
var serializer = new JsonEventSerializer();
var typeRegistry = new EventTypeRegistry();
var eventStore = new EventStore(adapter, serializer, typeRegistry);
// Append events
var streamId = new StreamId("order-123");
await eventStore.AppendAsync(
streamId,
new[] { (object)new OrderPlacedEvent { Id = "123", Amount = 100m } },
StreamPosition.Start
);
// Read events
var envelope = await eventStore.ReadAsync(streamId);
foreach (var evt in envelope.Events)
{
Console.WriteLine($"Event: {evt.Event}");
}
| Package | Description |
|---|---|
ZeroAlloc.EventSourcing |
Core library with event store and serialization |
ZeroAlloc.EventSourcing.Aggregates |
Aggregate patterns and source generation |
ZeroAlloc.EventSourcing.InMemory |
In-memory event store for testing |
ZeroAlloc.EventSourcing.PostgreSql |
PostgreSQL adapter with native streams |
ZeroAlloc.EventSourcing.SqlServer |
SQL Server adapter with native streams |
ZeroAlloc.EventSourcing.Kafka |
Kafka stream consumer for external event sources |
ZeroAlloc.EventSourcing.Telemetry |
BCL ActivitySource + Meter decorator around IAggregateRepository<,> — OpenTelemetry spans and metrics with no OTel SDK dependency |
All packages follow zero-allocation principles and are optimized for high-throughput scenarios.
ZeroAlloc.EventSourcing includes production-grade stream consumers for reliable event consumption with automatic position tracking, retry logic, and configurable error handling.
var consumer = new StreamConsumer(eventStore, checkpointStore, "my-consumer");
await consumer.ConsumeAsync(async (envelope, ct) => {
// Process event
Console.WriteLine(envelope.Event);
});
See for complete guide.
Consume events directly from Kafka topics with the same reliability features:
var options = new KafkaConsumerOptions
{
BootstrapServers = "localhost:9092",
Topic = "my-events",
GroupId = "my-service"
};
var consumer = new KafkaStreamConsumer(options, checkpointStore, serializer, registry);
await consumer.ConsumeAsync(async (envelope, ct) => {
// Process event from Kafka
await handler.ProcessAsync(envelope, ct);
});
See for complete guide.
Build denormalized views of your event data with multiple projection types:
var projection = new Projection(eventStore, "order-summaries");
await projection.ProjectAsync(async (envelope, state, ct) => {
if (envelope.Event is OrderPlacedEvent ope)
{
state["total"] = (decimal)(state["total"] ?? 0m) + ope.Amount;
}
return state;
});
Optimize aggregate loading with snapshots:
var options = new SnapshotOptions
{
Strategy = SnapshotStrategy.EveryNEvents(100)
};
var snapshot = await eventStore.GetSnapshotAsync(streamId, options);
ZeroAlloc.EventSourcing.Telemetry adds a hand-rolled decorator around IAggregateRepository<TAggregate, TId> that records Activity spans and metrics for every aggregate LoadAsync and SaveAsync — without taking a dependency on the OTel SDK.
dotnet add package ZeroAlloc.EventSourcing.Telemetry
services
.AddEventSourcing()
.UseInMemoryEventStore()
.AddAggregate<OrderAggregate, Guid>()
.WithTelemetry(); // call after each aggregate registration, before Build()
The decorator emits, under the ZeroAlloc.EventSourcing activity-source/meter name:
aggregate.load and aggregate.save, tagged with aggregate.type (= typeof(TAggregate).Name); status set to Error on exceptionaggregate.loads_total and aggregate.saves_total, incremented only when Result.IsSuccessaggregate.load_duration_ms and aggregate.save_duration_ms, recorded for both success and failure pathsAny OpenTelemetry SDK wired to the process picks up all three instruments automatically.
Breaking change in v2.0:
WithTelemetry()now decoratesIAggregateRepository<,>instead ofIEventStore. The oldevent_store.append/event_store.read/event_store.subscribespans no longer exist; the deletedInstrumentedEventStoreand its[Instrument]attribute onIEventStoreare gone. Existing dashboards must be re-pointed ataggregate.load/aggregate.save. See for the full migration table. The legacyUseEventSourcingTelemetry()extension remains as[Obsolete]and now delegates toWithTelemetry().
Complete documentation available at :
dotnet build ZeroAlloc.EventSourcing.slnx --configuration Release
dotnet test ZeroAlloc.EventSourcing.slnx --configuration Release
dotnet run --project benchmarks/ZeroAlloc.EventSourcing.Benchmarks -c Release
See LICENSE file for details.
See for guidelines.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 115 | 4/29/2026 |