fix(collector): resolve CS9153 + CS9207 interceptor collisions (broken main) - #439
Conversation
…CS9153 qyl.collector ran two interceptor generators that both targeted WebApplicationBuilder.Build(): ServiceDefaults (DI/hosted/health/endpoints) and Qyl.OpenTelemetry.AutoInstrumentation (OTel middleware). C# forbids two interceptors per call site, so the Release build failed with CS9153. Make ServiceDefaults the single owner of Build() and compose the OTel wrapper: - ServiceDefaultsSourceGenerator detects Qyl.OpenTelemetry.AutoInstrumentation (via QylInterceptedAspNetCore) and routes its Build() interceptor through QylInterceptedAspNetCore.Build(builder) (build + OTel middleware) instead of builder.Build(); without the package it builds the host directly (unchanged). - qyl.collector sets QylAutoInstrumentationInterceptWebApplicationBuilderBuild=false so the OTel generator yields Build() to ServiceDefaults. Requires Qyl.OpenTelemetry.AutoInstrumentation 3.1.1 (adds the opt-out). Version pin bump is gated on 3.1.1 indexing on nuget.org — WIP until then. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lves CS9153 + CS9207) Bump the OTel auto-instrumentation pin to 3.1.2, which carries both fixes the collector build needs: - #16 (3.1.1): WebApplicationBuilder.Build() interceptor opt-out, so ServiceDefaults owns Build() and composes QylInterceptedAspNetCore.Build — resolves CS9153. - #17 (3.1.2): the generator no longer emits an un-interceptable RequestDelegate.Invoke interceptor for hand-written middleware next(context) hops — resolves CS9207. Verified: a clean-cache restore resolves 3.1.2 from nuget.org (not a local feed), and `dotnet build services/qyl.collector -c Release` succeeds with 0 warnings / 0 errors. Health endpoints preserved — ServiceDefaults still registers health checks and maps MapQylDefaultEndpoints around the composed OTel Build(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (1)
🧰 Additional context used📓 Path-based instructions (4)**/*.{cs,csx,csproj,props}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/Directory.Packages.props📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**⚙️ CodeRabbit configuration file
Files:
**/*.props⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (1)
Summary by CodeRabbit
Walkthrough
Package Version Bump
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (7 passed)
Comment |
|
🚅 Deployed to the qyl-pr-439 environment in qyl
|
The Backend (.NET) job cached ~/.nuget/packages via setup-dotnet, keyed on dependency files including Directory.Packages.props. On the self-hosted runner that folder already persists on local disk between jobs, so the cache is redundant — and this PR's pin bump changed the key, forcing a post-job tar+upload of the accumulated 8.1 GB global packages folder (~17 min at ~5 MB/s) that serialized the whole PR (Frontend queued behind it). Disable the cache; restore stays fast from local disk. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
main's Backend (.NET) Release build was broken:services/qyl.collectorfailed to compile because the OTel auto-instrumentation generator collided with qyl's ServiceDefaults generator atProgram.cs'sbuilder.Build(). Root-causing revealed two distinct interceptor errors, both introduced bycde22004(the bump to OTel 3.1.0), only one of which had been diagnosed:WebApplicationBuilder.Build()Build()and composesQylInterceptedAspNetCore.Build; OTel opted out viaQylAutoInstrumentationInterceptWebApplicationBuilderBuild=falseRequestDelegate.Invokeinterceptor for middlewarenext(context)hops, which are delegate invocations the C# interceptors feature cannot interceptMethodKind.OrdinaryBoth fixes ship in OTel
3.1.2(this PR only bumps the pin; the generator work landed upstream):Qyl.OpenTelemetry.AutoInstrumentation#16→ 3.1.1 (Build opt-out)Qyl.OpenTelemetry.AutoInstrumentation#17→ 3.1.2 (RequestDelegate guard)Changes in this PR
internal/qyl.instrumentation.generators/…/ServiceDefaultsSourceGenerator.cs— detect OTel and compose itsBuildwrapper; ServiceDefaults becomes the singleBuild()interceptor. (commit41f948ad)services/qyl.collector/qyl.collector.csproj— setQylAutoInstrumentationInterceptWebApplicationBuilderBuild=false. (commit41f948ad)Directory.Packages.props— pinQyl.OpenTelemetry.AutoInstrumentation3.1.0 → 3.1.2. (commit541bac80)Verification (complete & verified)
3.1.2confirmed published and indexed on nuget.org; a clean-cachedotnet restoreresolves it fromhttps://api.nuget.org/v3/index.json(not a local feed).dotnet build services/qyl.collector -c Release→ 0 warnings, 0 errors (both CS9153 and CS9207 gone).RegisterQylHealthChecks+MapQylDefaultEndpointsaround the composed OTelBuild().🤖 Generated with Claude Code