Repository navigation
fix(aspnetcore): add request context to application spans - #347
Conversation
Generated-By: PostHog Desktop Task-Id: 5681be44-4986-48db-b140-1bda88f75f96
posthog-dotnet Compliance ReportDate: 2026-10-18T10:54:15.375633+00:00 ✅ All Tests Passed!47/47 tests passed Capture Tests✅ 30/30 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
|
Note 🤖 Automated comment by QA Swarm — not written by a human Verdict: ✅ APPROVE (privacy round @ deb7271)Middleware now sets a request-scope flag from the client's construction-time disabled state. Disabled clients add no activity tags. No public API changes. ChecksIndependent review accepted the change. Known limit: an app that wraps Earlier roundsVerdict: ✅ APPROVE (round 1 @ 57bcd38)No remaining actionable finding in the reviewed change. Activity identity precedence, request cleanup, and host-owned listener lifetime were checked. Key findings
ConvergenceNo remaining duplicate finding. Reviewer summaries
Automated by QA Swarm. Human review is required. This comment does not approve a merge or release. |
Generated-By: PostHog Desktop Task-Id: bfd18848-e498-4352-a58a-b9ba85de4198
marandaneto
left a comment
There was a problem hiding this comment.
The code looks good; no qualifying findings. Verdict: correct.
[Robot] Prepared with PostHog Desktop on behalf of @pauldambra.
💡 Motivation and Context
Developers need to connect browser sessions to ASP.NET Core request traces. Request middleware currently applies browser context to events but leaves application spans without those IDs.
sessionIdandposthogDistinctIdtags to the incoming request activity, even when it started before middleware runs.ActivityListener. The application keeps its sampling decisions, provider, processors, and exporters.Child enrichment requires the host builder's
AddPostHog()or service configuration withUseAspNetCore(), followed byUsePostHogRequestContext(). Manual client-only middleware setup still runs and enriches the active request activity. The SDK does not add a native span API or trace exporter.Related: SDK span context tracking. This PR uses the existing span attribute names from the traces spec. The broader application-owned OpenTelemetry acceptance contract remains under discussion in that issue.
💚 How did you test it?
bin/fmt --checkpass.net8.0: 1,235 passed, two skipped. AI: 19 passed. Corenetcoreapp3.1: 1,225 passed, two skipped.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset fileA patch changeset was written in the repository's existing format for
PostHogandPostHog.AspNetCore.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
GPT-6 (Codex), using PostHog Desktop, shell tools, and the GitHub CLI. The implementation uses the supported .NET Activity API to keep OpenTelemetry optional. A service-owned listener has no sampling delegates and is disposed with the host service provider. Human review is required.
Created with PostHog Desktop