OpenTelemetryCollector: WithAppForwarding breaks manifest publish ("The endpoint `grpc` is not allocated for the resource")
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 62/100
調査の方向性
失敗しているコールバックは src/CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector/OpenTelemetryCollectorRoutingExtensions.cs の WithOpenTelemetryCollectorRouting 内にあります。問題の行は LogDebug 呼び出し内の endpoint.Url です。再現するには、AppHost に対して --publisher manifest を指定して dotnet run を実行し、例外が発生することを確認してください。マニフェストが完全に書き出され、実行モードで OTEL_EXPORTER_OTLP_ENDPOINT の値が引き続き解決されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Publishing an AppHost that uses AddOpenTelemetryCollector(...).WithAppForwarding() as a manifest fails with
Step 'publish-manifest' failed: The endpoint `grpc` is not allocated for the resource `otel-collector`.
The manifest file that is written is cut off in the middle (not valid JSON), and the process still exits with code 0.
Running the AppHost works; only publishing fails.
Cause
The environment callback registered by WithOpenTelemetryCollectorRouting reads endpoint.Url as an argument of a debug log call:
src/CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector/OpenTelemetryCollectorRoutingExtensions.cs
var endpoint = collectorBuilder.Resource.GetEndpoint(endpointName);
callback.Logger.LogDebug("Forwarding Telemetry for {name} to the collector on {endpoint}", builder.Resource.Name, endpoint.Url);
The argument is evaluated whatever the log level is. In publish mode no endpoint is allocated, so EndpointReference.Url throws. The line after it, which sets OTEL_EXPORTER_OTLP_ENDPOINT to the endpoint reference itself, is fine in both modes.
Stack trace (top):
System.InvalidOperationException: The endpoint `grpc` is not allocated for the resource `otel-collector`.
at Aspire.Hosting.ApplicationModel.EndpointReference.get_AllocatedEndpoint()
at Aspire.Hosting.ApplicationModel.EndpointReference.get_Url()
at Aspire.Hosting.OpenTelemetryCollectorRoutingExtensions.<>c__DisplayClass0_0`1.<WithOpenTelemetryCollectorRouting>b__0(EnvironmentCallbackContext callback)
at Aspire.Hosting.ApplicationModel.EnvironmentCallbackAnnotation.ExecuteCallbackAsync(EnvironmentCallbackContext context)
...
at Aspire.Hosting.Publishing.ManifestPublishingContext.WriteEnvironmentVariablesAsync(IResource resource)
at Aspire.Hosting.Publishing.ManifestPublishingContext.WriteContainerAsync(ContainerResource container)
Steps to reproduce
-
An AppHost with at least one container or project resource and
builder.AddOpenTelemetryCollector("otel-collector") .WithConfig("./otel/config.yaml") .WithAppForwarding(); -
dotnet run --project <AppHost> -- --publisher manifest --output-path ./manifest.json
I have not reduced this to a minimal project; the stack trace and the source line above are from a larger AppHost.
Expected behavior
The manifest is written completely; OTEL_EXPORTER_OTLP_ENDPOINT of the routed resources is an expression that refers to the collector's endpoint.
Suggested fix
Do not read Url in the callback, for example log the endpoint's name instead of its address, or log only in run mode (callback.ExecutionContext.IsRunMode). I can send a pull request for that if it helps.
Versions
- CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector 13.6.1 (the line is also on
mainas of 2026-11-23) - Aspire.Hosting / Aspire.AppHost.Sdk 13.6.5
- .NET 10
- 主要言語
- C#
- スター
- 637
- フォーク
- 209
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 131
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CommunityToolkit/Aspire のほかの issue
-
難易度 4/5 1〜2日 初心者へのやさしさ 22/100
CommunityToolkit/Aspire#2596 ·
メンテナーはふだん 1 日以内に返信
-
feature request :mailbox_with_mail:
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
CommunityToolkit/Aspire#2591 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
CommunityToolkit/Aspire#2533 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
CommunityToolkit/Aspire#2436 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[SqlProjects] Improve checksum cheks対応中かも @ErikEJ が 15 日前に担当しました。 オープン
CommunityToolkit/Aspire#2435 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
CommunityToolkit/Aspire の issue をすべて見る
似ている issue
-
area: scaffold status: needs-tests
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
provider:flagd type:fix
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
open-feature/dotnet-sdk-contrib#789 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
NimblePros/Metronome#23 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
jsboige/CoursIA#28504 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
CustomUnits: Battle Armor squads play tank movement sounds (move-audio default ignores FakeVehicle)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100