[Enh]: Support OpenTelemetry logs export (OTLP)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- csharp
- Ambito
- cli, observability-sre
Direzione di ricerca
Iniziare da src/Service/Program.cs e seguire la configurazione esistente di runtime.telemetry.open-telemetry e il comando dab add-telemetry. Esaminare lo schema correlato e la mappatura delle opzioni, quindi verificare che logs-enabled sia disattivato per impostazione predefinita, che il flag CLI riutilizzi endpoint, headers e protocol esistenti e che il comportamento esistente di trace, metric e logger rimanga invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Add an optional path for DAB's ILogger output to flow through the .NET OpenTelemetry SDK's logs pipeline and ship via OTLP, alongside the existing application-insights, azure-log-analytics, file, and console destinations.
Context
Per #2397, runtime.telemetry.open-telemetry was intentionally scoped to traces (ActivitySource) and metrics (Meter). The issue's framing "Serilog handles logging, while OpenTelemetry focuses on tracing and metrics" was accurate at the time: the .NET OpenTelemetry Logs API was experimental.
That's no longer the case. OpenTelemetry.Extensions.Logging and the OtlpLogExporter are stable in the .NET OpenTelemetry SDK (graduated in 1.5+). The ILoggingBuilder.AddOpenTelemetry() extension method is production-ready and is the canonical way modern .NET services emit logs to OTLP collectors. ASP.NET Core's own host builder supports it out of the box.
The result is a gap: DAB users who self-host on Kubernetes with a Grafana / Loki / Alloy / Tempo stack (or any non-Azure OTLP collector) have no first-class log destination. Stdout scraping by an external collector works but loses the structured ILogger scope / category metadata that flows naturally through the OTel logs pipeline.
Proposal
Add a logs-enabled sub-flag under the existing open-telemetry block:
{
"runtime": {
"telemetry": {
"open-telemetry": {
"enabled": true,
"endpoint": "http://otel-collector:4317",
"service-name": "dab",
"exporter-protocol": "grpc",
"logs-enabled": true // new, defaults to false
}
}
}
}
When logs-enabled: true, register an OpenTelemetry logs provider on builder.Logging that reuses the existing endpoint, headers, and exporter-protocol values. No new config fields, no schema disruption, no behavior change for existing users (default off).
Pseudocode in src/Service/Program.cs:
if (otelConfig.Enabled && otelConfig.LogsEnabled)
{
builder.Logging.AddOpenTelemetry(options =>
{
options.SetResourceBuilder(sharedResourceBuilder);
options.IncludeFormattedMessage = true;
options.IncludeScopes = true;
options.AddOtlpExporter(opt =>
{
opt.Endpoint = new Uri(otelConfig.Endpoint);
opt.Protocol = otelConfig.ExporterProtocol == "grpc"
? OtlpExportProtocol.Grpc
: OtlpExportProtocol.HttpProtobuf;
opt.Headers = otelConfig.Headers;
});
});
}
CLI flag in dab add-telemetry:
--otel-logs-enabled true|false
Why this is low-risk
- Additive. No change to traces / metrics / existing logger providers. Existing users see no behavior difference.
- Default off. Zero impact on the install-base until explicitly opted in.
- Reuses existing config surface. No new endpoint / headers / protocol fields — same connection params, three pipelines.
- Small footprint. ~30 lines of production code plus schema update plus a CLI option.
- Mirrors a pattern .NET teams ship in production today. The OTel SDK exposes traces / metrics / logs as a coherent three-signal builder; the missing logs piece is the only deviation here.
Validation
I run DAB on AKS behind a Grafana Alloy DaemonSet. I'm happy to test against a real OTLP gRPC receiver and post screenshots of DAB logs landing in Loki with full structured fields (scope_name, category, trace_id correlation with the existing OTel traces).
Offer
Happy to PR this if the team is open to the addition!
Closes the gap noted (implicitly) by the increasing number of users self-hosting DAB on non-Azure observability stacks; explicit framing of "Serilog vs OpenTelemetry" in #2397 predates the .NET Logs API going stable.
- Lingua principale
- C#
- Stelle
- 1.5k
- Fork
- 372
- Merge medio
- 9g 1h
- PR unite (30g)
- 13
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Azure/data-api-builder
-
pgsql
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/data-api-builder#3598 ·
-
2.x cli mcp-server
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/data-api-builder#3576 ·
-
2.x health-endpoint
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/data-api-builder#3570 ·
-
2.x telemetry
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/data-api-builder#3564 ·
-
2.x telemetry
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Azure/data-api-builder#3562 ·
Tutte le issue di Azure/data-api-builder
Issue simili
-
bug needs response
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Adyen/adyen-dotnet-api-library#1869 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
difficulty/starter 🚀 good first issue kind/bug platform/ios 🍎 project/non-ui ⚙️ triage/untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
unoplatform/uno#24650 ·
-
area-ai untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/extensions#7783 ·
-
untriaged
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
dotnet/dotnet-api-docs#13095 ·