Interlace 1.0.0
dotnet add package Interlace --version 1.0.0
NuGet\Install-Package Interlace -Version 1.0.0
<PackageReference Include="Interlace" Version="1.0.0" />
<PackageVersion Include="Interlace" Version="1.0.0" />
<PackageReference Include="Interlace" />
paket add Interlace --version 1.0.0
#r "nuget: Interlace, 1.0.0"
#:package Interlace@1.0.0
#addin nuget:?package=Interlace&version=1.0.0
#tool nuget:?package=Interlace&version=1.0.0
Interlace
Interlace is a .NET library that eliminates hand-written observability code. You annotate your service interfaces with attributes, and at compile time Interlace generates the spans, metrics, wide events, and audit trails that would otherwise take dozens of lines per method.
[Observed(Layer = ObservabilityLayer.Service)]
public interface IOrderService
{
[Metric(Name = "orders_placed", Type = MetricType.Counter)]
[Audited(EventType = "OrderPlaced", CaptureResult = true)]
Task<Order> PlaceOrderAsync(
[CorrelationId] string orderId,
[SpanAttribute(Name = "order.sku")] string sku,
int quantity,
[Sensitive] string paymentToken,
CancellationToken ct = default);
}
Your implementation stays pure business logic:
public sealed class OrderService(IOrderRepository repository, IPricingService pricing) : IOrderService
{
public async Task<Order> PlaceOrderAsync(string orderId, string sku, int quantity, string paymentToken, CancellationToken ct)
{
decimal unitPrice = await pricing.GetPriceAsync(sku, ct);
Order order = new(orderId, sku, quantity, unitPrice);
return await repository.InsertAsync(order, ct);
}
}
From this single interface, Interlace generates interceptors that emit spans, operation/success/failure counters, a duration histogram, the custom orders_placed counter, an OrderPlaced audit event, wide event logs, and correlation context — with paymentToken excluded from every signal.
<details> <summary>Table of Contents</summary>
</details>
Requirements
- .NET 10 SDK or later (C# 14 required for interceptor support)
- An OpenTelemetry exporter package (e.g.
OpenTelemetry.Exporter.Consolefor local development)
Getting Started
1. Add package references:
<ItemGroup>
<PackageReference Include="Interlace" Version="1.0.0" />
<PackageReference Include="Interlace.Analyzers" Version="1.0.0" PrivateAssets="all" />
</ItemGroup>
2. Add this to your .csproj or Directory.Build.props:
<PropertyGroup>
<TelemetryAutoConfigureNamespace>true</TelemetryAutoConfigureNamespace>
</PropertyGroup>
This lets Interlace wire up the generated code automatically. See configuration for additional MSBuild properties.
3. Register runtime services in Program.cs:
using Interlace.Registration;
// Initializes the ActivitySource and Meter that generated interceptors use to emit spans and metrics.
// The names you choose here are how OpenTelemetry identifies which signals to collect —
// they must match what you pass to AddSource/AddMeter on the OTel side.
builder.Services.AddInterlace(options =>
{
options.ActivitySourceName = "MyApp.Telemetry";
options.MeterName = "MyApp.Telemetry";
});
// Optional: wire up OpenTelemetry exporters (uncomment the packages in step 1 first)
// builder.Services.AddOpenTelemetry()
// .WithTracing(t => t.AddSource("MyApp.Telemetry").AddConsoleExporter())
// .WithMetrics(m => m.AddMeter("MyApp.Telemetry").AddConsoleExporter());
4. Annotate your interfaces:
using Interlace.Annotations.Attributes;
[Observed(Layer = ObservabilityLayer.Service)]
public interface IOrderService
{
Task PlaceOrderAsync(
string orderId,
[SpanAttribute(Name = "order.sku")] string sku,
int quantity,
CancellationToken ct = default);
}
Every call to IOrderService.PlaceOrderAsync through DI now gets a span, metrics, and wide events — regardless of which class implements it.
For a complete walkthrough see the getting started guide.
Packages
| Package | Purpose |
|---|---|
Interlace |
Runtime services + telemetry attributes ([Observed], [Audited], [Metric], etc.) |
Interlace.Analyzers |
Source generator + Roslyn analyzer + code fixes (compile-time only) |
Attributes
| Attribute | Target | Purpose |
|---|---|---|
[Observed] |
Interface / Class | Enable telemetry interception for a type |
[ObservedEndpoint] |
Method | HTTP endpoint instrumentation with route template |
[ObservedJob] |
Class | Background job instrumentation with max duration tracking |
[Audited] |
Method | Generate audit trail records |
[AuditEntityId] |
Parameter | Bind audit entity identifier |
[Metric] |
Method | Custom counter, histogram, or up-down counter |
[MetricTag] |
Parameter | Bind metric dimension from parameter |
[MetricValue] |
Parameter | Bind metric value from parameter |
[SpanAttribute] |
Parameter | Add span tag from parameter |
[CorrelationId] |
Parameter | Propagate correlation context |
[Sensitive] |
Parameter | Exclude from all telemetry capture |
[NoTelemetry] |
Method | Opt out of interception (requires reason) |
[TelemetryOptions] |
Interface / Class / Method | Toggle individual signal channels |
[WideEvent] |
Method | Configure wide event emission |
Documentation
| Getting Started | Install, configure, and instrument your first service |
| Core Concepts | How interface-first interception works |
| Attributes Reference | All available telemetry attributes |
| Usage Guides | Configuration, patterns, and troubleshooting |
| Diagnostics | Analyzer rules (TEL001–TEL009) and fixes |
| Samples | Runnable examples for each feature |
Contributing
See CONTRIBUTING.md for development setup, build commands, and testing instructions.
License
See LICENSE for details.
| Product | Versions 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. |
-
net10.0
- Interlace.Annotations (>= 1.0.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.9)
- Microsoft.Extensions.DependencyInjection (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Logging (>= 10.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
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 |
|---|---|---|
| 1.0.0 | 104 | 2/16/2026 |