[Enh]: Support OpenTelemetry logs export (OTLP)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- csharp
- 領域
- cli, observability-sre
調査の方向性
src/Service/Program.cs から開始し、既存の runtime.telemetry.open-telemetry 設定と dab add-telemetry コマンドをたどります。関連するスキーマとオプションのマッピングを確認し、logs-enabled がデフォルトでオフであること、CLI フラグが既存の endpoint、headers、protocol を再利用すること、既存の trace、metric、logger の動作が変わらないことを検証します。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C#
- スター
- 1.5k
- フォーク
- 371
- 平均マージ
- 9日 2時間
- マージ済み PR(30日)
- 10
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/data-api-builder のほかの issue
-
pgsql
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3598 ·
メンテナーはふだん 1 日以内に返信
-
2.x cli mcp-server
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3576 ·
メンテナーはふだん 1 日以内に返信
-
2.x health-endpoint
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3570 ·
メンテナーはふだん 1 日以内に返信
-
2.x telemetry
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3564 ·
メンテナーはふだん 1 日以内に返信
-
2.x telemetry
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Azure/data-api-builder#3562 ·
メンテナーはふだん 1 日以内に返信
Azure/data-api-builder の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
fluentassertions/fluentassertions#3353 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 半日 初心者へのやさしさ 78/100
unoplatform/uno#24769 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
AvaloniaUI/Avalonia#22323 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
microsoft/onnxruntime-genai#2633 ·
メンテナーはふだん 1 日以内に返信