ANcpLua.NET.Sdk.Web) automatically configures these when you use WebApplication.CreateBuilder().
Features
Auto-Instrumentation
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 namegen_ai.usage.input_tokens— Input token countgen_ai.usage.output_tokens— Output token count
Database Providers
ADO.NETDbCommand.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 textdb.namespace— Database name
ActivitySources
The instrumentation uses these ActivitySource names:
Subscribe to custom sources via configuration:
[OTel] Attribute
Mark record properties for automaticActivity.SetTag() generation:
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 settingsOpenApi
OpenAPI/Swagger settingsOpenTelemetry
Telemetry configurationAntiForgery
Anti-forgery token settingsStaticAssets
Static file servingDevLogs
Browser console bridgeDevLogs - Frontend Console Bridge
Captures browserconsole.log/warn/error and sends to server logs. Enabled by default in Development.
Add to your HTML (only served in Development):
[BROWSER] prefix:
