Skip to main content
Opinionated service defaults for ASP.NET Core applications, inspired by .NET Aspire. The Web SDK (ANcpLua.NET.Sdk.Web) automatically configures these when you use WebApplication.CreateBuilder().

Features

Auto-Instrumentation

Preview Feature — Auto-instrumentation is implemented but pending end-to-end validation. Report issues at ANcpLua.NET.Sdk.
The SDK automatically instruments GenAI and database calls with OpenTelemetry spans via C# interceptors. No manual instrumentation code required.

GenAI Providers

Supported AI SDK calls are automatically wrapped with spans: Emitted span attributes:
  • gen_ai.system — Provider name (openai, anthropic, etc.)
  • gen_ai.operation.name — Operation type (chat, embeddings)
  • gen_ai.request.model — Model name
  • gen_ai.usage.input_tokens — Input token count
  • gen_ai.usage.output_tokens — Output token count

Database Providers

ADO.NET DbCommand.Execute* calls are automatically instrumented: Emitted span attributes:
  • db.system.name — Database system (postgresql, mysql, etc.)
  • db.operation.name — Operation type (ExecuteReader, ExecuteNonQuery)
  • db.query.text — SQL command text
  • db.namespace — Database name

ActivitySources

The instrumentation uses these ActivitySource names: Subscribe to custom sources via configuration:

[OTel] Attribute

Mark record properties for automatic Activity.SetTag() generation:
The source generator creates extension methods:

Usage

When using ANcpLua.NET.Sdk.Web, the source generator automatically intercepts WebApplication.CreateBuilder() calls, so explicit registration is optional.

Configuration

Customize behavior through the options callback:

Configuration Options

Https

HTTPS and HSTS settings

OpenApi

OpenAPI/Swagger settings

OpenTelemetry

Telemetry configuration

AntiForgery

Anti-forgery token settings

StaticAssets

Static file serving

DevLogs

Browser console bridge

DevLogs - Frontend Console Bridge

Captures browser console.log/warn/error and sends to server logs. Enabled by default in Development. Add to your HTML (only served in Development):
All frontend logs appear in server output with [BROWSER] prefix:

Opt-out

To disable auto-registration and configure services manually: