WideEvents.AspNetCore 0.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package WideEvents.AspNetCore --version 0.2.1
                    
NuGet\Install-Package WideEvents.AspNetCore -Version 0.2.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="WideEvents.AspNetCore" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WideEvents.AspNetCore" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="WideEvents.AspNetCore" />
                    
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 WideEvents.AspNetCore --version 0.2.1
                    
#r "nuget: WideEvents.AspNetCore, 0.2.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 WideEvents.AspNetCore@0.2.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=WideEvents.AspNetCore&version=0.2.1
                    
Install as a Cake Addin
#tool nuget:?package=WideEvents.AspNetCore&version=0.2.1
                    
Install as a Cake Tool

WideEvents

WideEvents is a high-performance structured logging and observability framework for .NET focused on Wide Events and Canonical Log Lines.

Instead of producing dozens of fragmented logs during a request lifecycle, WideEvents captures a single rich, structured event containing operational, technical, and business context.

The goal is simple:

Make production systems easier to understand, debug, query, and observe.


Documentation

Full documentation lives in docs/, available in English and Portuguese:


Why WideEvents Exists

Traditional logging was designed for monoliths and local debugging.

Modern distributed systems generate:

  • fragmented logs
  • duplicated context
  • expensive correlation
  • noisy observability pipelines

A single HTTP request may produce:

  • controller logs
  • service logs
  • database logs
  • retry logs
  • integration logs
  • exception logs

Reconstructing what happened becomes operational archaeology.

WideEvents changes the model:

Instead of logging every step, emit a single canonical event describing the complete outcome of the request.


Example

Instead of:

Request started
Loading cart
Calling payment provider
Retrying payment
Payment failed
Request finished

WideEvents produces:

{
  "duration_ms": 1247,
  "status_code": 500,
  "outcome": "error",

  "payment": {
    "method": "card",
    "provider": "stripe"
  },

  "error": {
    "type": "PaymentError",
    "code": "card_declined"
  },

  "cart": {
    "id": "cart_xyz",
    "total_cents": 15999
  },

  "user": {
    "id": "user_456",
    "subscription": "premium"
  },

  "trace_id": "7d3b9c5f7b",
  "request_id": "req_8bf7ec2d"
}

One event. Full context.


Features

  • Structured wide events
  • Canonical log lines
  • OpenTelemetry integration
  • Automatic trace/span correlation
  • Structured nested JSON output
  • Adaptive sampling
  • PII masking/sanitization
  • Async exporter pipeline
  • Source-generated schemas
  • Minimal allocations
  • Extensible exporters
  • ASP.NET Core middleware
  • Kafka-ready architecture
  • High-throughput serialization options

Architecture

HTTP Request
     ↓
Middleware
     ↓
Scopes + Activity Context
     ↓
Wide Event Builder
     ↓
Structured Event
     ↓
Export Pipeline

WideEvents integrates with:

  • ILogger
  • OpenTelemetry
  • Serilog
  • OTLP collectors
  • Kafka pipelines
  • Structured JSON logging platforms

Installation

Core

dotnet add package WideEvents.Core

ASP.NET Core Integration

dotnet add package WideEvents.AspNetCore

OpenTelemetry Integration

dotnet add package WideEvents.OpenTelemetry

Quick Start

Register services

builder.Services.AddWideEvents(options =>
{
    options.EnableOpenTelemetry = true;
});

Enable middleware

app.UseWideEvents();

Add contextual data

WideEvent.Add("user.id", user.Id);
WideEvent.Add("cart.total_cents", cart.TotalCents);

Structured Events

WideEvents supports hierarchical structured events.

WideEvent.Add("payment.method", "card");
WideEvent.Add("payment.provider", "stripe");

Produces:

{
  "payment": {
    "method": "card",
    "provider": "stripe"
  }
}

OpenTelemetry

WideEvents automatically integrates with OpenTelemetry Activities.

Captured automatically:

  • trace_id
  • span_id
  • activity tags

Example:

builder.Services.AddWideEvents(options =>
{
    options.EnableOpenTelemetry = true;
});

Source Generated Schemas

Define strongly typed event schemas.

[WideEventSchema]
public partial record CheckoutEvent
{
    public string UserId { get; init; }
    public decimal Total { get; init; }
}

Generated automatically:

event.Enrich();

No reflection required.


Exporters

WideEvents supports asynchronous exporters.

Current architecture supports:

  • OpenTelemetry / OTLP
  • Kafka
  • Custom exporters

Example:

public class MyExporter : IWideEventExporter
{
    public Task ExportAsync(
        IReadOnlyDictionary<string, object?> evt,
        CancellationToken ct)
    {
        return Task.CompletedTask;
    }
}

Performance

WideEvents was designed with performance as a first-class concern.

Available serialization modes:

  • Source-generated System.Text.Json
  • Span-based pooled JSON writer
  • Minimal allocation pipelines

The framework avoids:

  • runtime reflection
  • blocking I/O
  • synchronous exporters
  • unnecessary allocations

Sampling

WideEvents supports adaptive sampling.

Example policy:

  • always keep errors
  • always keep slow requests
  • probabilistic sampling for successful requests

Data Governance

WideEvents includes sanitization hooks for:

  • PII masking
  • sensitive field filtering
  • compliance strategies

These capabilities are essential for modern observability pipelines where logs may contain business, customer, or regulated data.

Typical use cases include:

  • GDPR compliance
  • PCI DSS environments
  • internal security policies
  • audit and governance requirements
  • multi-tenant SaaS platforms

WideEvents allows organizations to centralize sanitization policies before events reach external systems such as Kafka, OTLP collectors, SIEMs, or analytics platforms.

Example:

{
  "user": {
    "email": "***"
  }
}

Philosophy

WideEvents is not "just logging".

It treats observability as structured operational data.

The framework is heavily inspired by:


Roadmap

WideEvents is being designed as a long-term observability platform for modern .NET systems.

Planned evolutions include:

Observability

  • ClickHouse exporter
  • Loki integration
  • Metrics integration
  • Dashboard templates
  • Native OpenTelemetry Logs support

Performance

  • Native AOT optimizations
  • Zero-allocation serialization pipelines
  • Advanced pooling strategies
  • Benchmark suite

Governance

  • Dynamic sampling
  • Schema registry
  • Centralized masking policies
  • Compliance-aware exporters

Developer Experience

  • Roslyn analyzers
  • dotnet new templates
  • Visual Studio tooling
  • Event schema validation

Contributing

Contributions, ideas, discussions, and experiments are welcome.

This project is focused on building practical observability tooling for modern .NET systems.


License

Licensed under the Apache License 2.0.

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 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.4 166 6/16/2026
0.2.3 132 5/28/2026
0.2.2 121 5/28/2026
0.2.1 112 5/26/2026
0.1.0-alpha.0.69 72 6/30/2026