LevelUp.Bifrost.OpenTelemetry 0.4.0

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

Bifrost

Build License .NET

A high-performance, production-ready Channel-based work orchestration library for .NET 10. Provides bounded work queues, worker pool management, autoscaling, resilience, and comprehensive observability.

Features

  • Zero-allocation hot paths - ValueTask-based enqueue with no per-item allocations
  • Autoscaling - Dynamic worker scaling based on queue utilization with configurable watermarks
  • Resilience - Polly integration for retry, timeout, and circuit breaker patterns
  • Health Checks - ASP.NET Core health check integration
  • OpenTelemetry - Metrics and tracing support
  • Event Streaming - Pub/sub events for work lifecycle tracking

Packages

Package Description NuGet
LevelUp.Bifrost.Core Core abstractions with zero dependencies -
LevelUp.Bifrost Main implementation with Channel-based orchestration -
LevelUp.Bifrost.HealthChecks ASP.NET Core health check integration -
LevelUp.Bifrost.OpenTelemetry OpenTelemetry metrics support -
LevelUp.Bifrost.Resilience Polly resilience integration -

Quick Start

Installation

dotnet add package LevelUp.Bifrost
dotnet add package LevelUp.Bifrost.HealthChecks  # optional
dotnet add package LevelUp.Bifrost.OpenTelemetry  # optional
dotnet add package LevelUp.Bifrost.Resilience  # optional

Basic Usage

// 1. Define your work type
public record EmailJob(string To, string Subject, string Body);

// 2. Implement a handler
public class EmailHandler : IWorkHandler<EmailJob>
{
    private readonly IEmailService _emailService;

    public EmailHandler(IEmailService emailService)
    {
        _emailService = emailService;
    }

    public async ValueTask HandleAsync(EmailJob job, CancellationToken ct)
    {
        await _emailService.SendAsync(job.To, job.Subject, job.Body, ct);
    }
}

// 3. Register services
services.AddWorkOrchestrator<EmailJob>(options =>
{
    options.Capacity = 128;
    options.WorkerCount = 2;
})
.WithHandler<EmailHandler>();

// 4. Enqueue work
public class MyService
{
    private readonly IWorkOrchestrator<EmailJob> _orchestrator;

    public MyService(IWorkOrchestrator<EmailJob> orchestrator)
    {
        _orchestrator = orchestrator;
    }

    public async Task SendWelcomeEmailAsync(string email)
    {
        await _orchestrator.EnqueueAsync(
            new EmailJob(email, "Welcome!", "Thanks for signing up!"));
    }
}

With Autoscaling

services.AddWorkOrchestrator<EmailJob>(options =>
{
    options.Capacity = 128;
    options.WorkerCount = 2;
})
.WithHandler<EmailHandler>()
.WithAutoscaling(scaling =>
{
    scaling.MinWorkers = 1;
    scaling.MaxWorkers = 16;
    scaling.HighWatermark = 0.8;
    scaling.LowWatermark = 0.3;
    scaling.CooldownPeriod = TimeSpan.FromSeconds(30);
});

With Health Checks

services.AddWorkOrchestrator<EmailJob>(/* ... */)
    .WithHealthChecks();

// In your health check endpoint configuration
app.MapHealthChecks("/health");

With OpenTelemetry

services.AddWorkOrchestrator<EmailJob>(/* ... */)
    .WithOpenTelemetry();

With Resilience (Polly)

services.AddWorkOrchestrator<EmailJob>(/* ... */)
    .WithResilience(resilience =>
    {
        resilience.RetryCount = 3;
        resilience.Timeout = TimeSpan.FromSeconds(30);
        resilience.UseExponentialBackoff = true;
    });

API Overview

IWorkOrchestrator<TWork>

The main interface for enqueuing work:

public interface IWorkOrchestrator<TWork> : IAsyncDisposable
{
    // Core operations - zero-allocation hot path
    ValueTask EnqueueAsync(TWork work, CancellationToken ct = default);
    bool TryEnqueue(TWork work);

    // Observability (non-allocating property access)
    int PendingCount { get; }
    int ActiveWorkers { get; }
    int Capacity { get; }

    // Lifecycle
    Task StopAsync(CancellationToken ct = default);

    // Escape hatch for advanced scenarios
    ChannelWriter<TWork> Writer { get; }
}

IWorkHandler<TWork>

Implement this interface to handle work items:

public interface IWorkHandler<TWork>
{
    ValueTask HandleAsync(TWork work, CancellationToken ct);
}

Event Streaming

Subscribe to orchestrator events:

// Enable event streaming
services.AddWorkOrchestrator<EmailJob>(/* ... */)
    .WithEventStream();

// Subscribe to events
var eventOrchestrator = serviceProvider
    .GetRequiredService<IEventStreamOrchestrator<EmailJob>>();

await foreach (var evt in eventOrchestrator.GetEventStreamAsync<WorkCompletedEvent<EmailJob>>(ct))
{
    Console.WriteLine($"Work completed in {evt.Duration}");
}

Building from Source

# Clone the repository
git clone https://github.com/lvlup-sw/bifrost.git
cd bifrost

# Build
dotnet build

# Run tests
dotnet test

Design

See the design document for architectural details and implementation notes.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Product Compatible and additional computed target framework versions.
.NET 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.4.0 258 3/16/2026
0.3.5 96 3/15/2026
0.3.0 218 3/3/2026
0.2.0 86 3/3/2026
0.1.0 525 2/3/2026