Repository navigation
chore(aio): show per-request context in otel onboarding docs - #117555
Conversation
|
😎 Merged successfully - details. |
🤖 CI report✅ Trunk lane — non-backend laneThis PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes. ✅ Duplication (Python) — cleanNew Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying. ✅ Duplication (TypeScript) — cleanNew TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.
|
| File | Size | Δ vs base |
|---|---|---|
posthog-app/_parent/products/product_analytics/frontend/insights/insightScene/InsightScene.js |
56.4 KiB | 🔺 +56.4 KiB (new) |
posthog-app/src/scenes/insights/InsightScene.js |
removed | 🟢 -56.3 KiB (-100.0%) |
render-query/src/render-query/render-query.js |
24.60 MiB | 🔺 +25.3 KiB (+0.1%) |
posthog-app/_parent/products/tracing/frontend/components/TraceDialog/TraceDialog.js |
20.8 KiB | 🔺 +20.8 KiB (new) |
posthog-app/_parent/products/tracing/frontend/TracingScene.js |
172.8 KiB | 🟢 -18.9 KiB (-9.8%) |
posthog-app/_parent/products/business_intelligence/frontend/BusinessIntelligenceScene.js |
144.2 KiB | 🔺 +13.9 KiB (+10.7%) |
posthog-app/src/scenes/project-homepage/today/TodayReportHoverCardChart.js |
removed | 🟢 -11.8 KiB (-100.0%) |
posthog-app/_parent/products/product_analytics/frontend/insights/insightQuickStart/InsightQuickStart.js |
10.1 KiB | 🔺 +10.1 KiB (new) |
posthog-app/src/scenes/insights/InsightQuickStart/InsightQuickStart.js |
removed | 🟢 -10.0 KiB (-100.0%) |
posthog-app/_parent/products/business_knowledge/frontend/scenes/sources/BusinessKnowledgeScene.js |
28.1 KiB | 🔺 +8.9 KiB (+46.2%) |
posthog-app/_parent/products/autoresearch/frontend/AutoresearchPipelineScene.js |
110.3 KiB | 🔺 +8.7 KiB (+8.6%) |
posthog-app/src/scenes/project-homepage/today/TodayHome.js |
23.1 KiB | 🔺 +7.4 KiB (+47.4%) |
posthog-app/src/scenes/project-homepage/today/TodayReportHoverCard.js |
removed | 🟢 -7.4 KiB (-100.0%) |
posthog-app/_parent/products/workflows/frontend/WorkflowsScene.js |
56.5 KiB | 🔺 +6.9 KiB (+13.9%) |
posthog-app/src/layout/today/TodayObjectHoverCard.js |
5.1 KiB | 🔺 +5.1 KiB (new) |
posthog-app/src/scenes/project-homepage/today/TodayReportHoverCardMetric.js |
removed | 🟢 -4.9 KiB (-100.0%) |
posthog-app/src/scenes/AuthenticatedShell.js |
316.1 KiB | 🟢 -3.0 KiB (-1.0%) |
posthog-app/src/scenes/project-homepage/today/TodayReportPage.js |
64.1 KiB | 🔺 +2.6 KiB (+4.2%) |
posthog-app/_parent/products/business_knowledge/frontend/scenes/source/KnowledgeSourceScene.js |
20.0 KiB | 🔺 +1.3 KiB (+7.2%) |
posthog-app/_parent/products/review_hog/frontend/CodeReviewScene.js |
114.2 KiB | 🟢 -1.3 KiB (-1.1%) |
posthog-app/_parent/products/workflows/frontend/Broadcasts/BroadcastScene.js |
100.0 KiB | 🔺 +1.3 KiB (+1.3%) |
posthog-app/_parent/products/signals/frontend/inbox/InboxScene.js |
460.8 KiB | 🔺 +1.3 KiB (+0.3%) |
Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report
✅ Eager graph — within budget
How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.
| Root | Eager (shipped) | Δ vs base | Budget |
|---|---|---|---|
entry (logged-out pages, app bootstrap)src/index.tsx |
1012.3 KiB · 23 files | 🔺 +6.2 KiB (+0.6%) | █████████░ 86.4% of 1.14 MiB |
logged-out boot: index + App + bootApp (preloaded by every page, including /login)src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts |
2.88 MiB · 606 files | 🔺 +6.3 KiB (+0.2%) | █████████░ 94.8% of 3.03 MiB |
authenticated shell (every logged-in page)src/scenes/AuthenticatedShell.tsx |
7.46 MiB · 2,537 files | 🟢 -35.3 KiB (-0.5%) | ██████████ 97.6% of 7.64 MiB |
dashboard scenesrc/scenes/dashboard/Dashboard.tsx |
9.66 MiB · 3,623 files | 🔺 +18.5 KiB (+0.2%) | █████████░ 93.8% of 10.30 MiB |
today home pathsrc/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx |
7.85 MiB · 2,867 files | 🔺 +339.0 KiB (+4.4%) | ██████████ 99.5% of 7.89 MiB |
events scenesrc/scenes/activity/explore/EventsScene.tsx |
9.24 MiB · 3,450 files | 🔺 +18.7 KiB (+0.2%) | █████████░ 93.5% of 9.88 MiB |
replay detail scenesrc/scenes/session-recordings/detail/SessionRecordingDetail.tsx |
11.97 MiB · 4,295 files | 🔺 +13.4 KiB (+0.1%) | ████████░░ 79.5% of 15.05 MiB |
🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/svg/ stays out of src/index.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/components/ stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/layout/navigation-3000/navigationLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/scenes/dashboard/dashboardLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/lemon-ui/LemonMarkdown/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/RichContentEditor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/CodeSnippet/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/taxonomy/core-filter-definitions-by-group.json stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/zod/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/scenes/billing/billingLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/ProductEmptyState/productSetupPreloadLogic.ts stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/dashboards/frontend/widgets/previews/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 zod/v4/locales/de.js stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/svg/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/components/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/scenes/project-homepage/today/TodayReportPage.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/queries/Query/Query.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
Largest files eagerly shipped from src/index.tsx
| Size | File |
|---|---|
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 24.6 KiB | ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js |
| 6.3 KiB | ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js |
| 4.5 KiB | ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js |
| 3.9 KiB | ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js |
| 1.4 KiB | ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js |
| 1.3 KiB | src/RootErrorBoundary.tsx |
| 1.3 KiB | src/index.tsx |
| 912 B | ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js |
| 839 B | src/scenes/ChunkLoadErrorBoundary.tsx |
Largest files eagerly shipped from src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
| Size | File |
|---|---|
| 319.8 KiB | ../node_modules/.pnpm/posthog-js@1.438.8_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs |
| 220.2 KiB | ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 105.9 KiB | src/products.tsx |
| 99.6 KiB | src/lib/api.ts |
| 69.0 KiB | src/lib/lemon-ui/icons/icons.tsx |
| 38.7 KiB | ../node_modules/.pnpm/@dnd-kit+core@6.0.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.js |
| 33.9 KiB | ../node_modules/.pnpm/kea@4.0.0-pre.6_patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5_react@18.3.1/node_modules/kea/lib/index.cjs.js |
| 28.9 KiB | src/scenes/scenes.ts |
| 27.9 KiB | src/lib/constants.tsx |
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
| Size | File |
|---|---|
| 319.8 KiB | ../node_modules/.pnpm/posthog-js@1.438.8_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs |
| 281.1 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 220.2 KiB | ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 185.5 KiB | ../packages/quill/packages/quill/dist/index.js |
| 153.7 KiB | ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js |
| 139.9 KiB | ../packages/quill/packages/primitives/dist/index.js |
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 105.9 KiB | src/products.tsx |
| 99.6 KiB | src/lib/api.ts |
| 93.3 KiB | ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js |
Largest files eagerly shipped from src/scenes/dashboard/Dashboard.tsx
| Size | File |
|---|---|
| 319.8 KiB | ../node_modules/.pnpm/posthog-js@1.438.8_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs |
| 281.1 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 220.2 KiB | ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 185.5 KiB | ../packages/quill/packages/quill/dist/index.js |
| 181.9 KiB | src/queries/validators.js |
| 153.7 KiB | ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js |
| 139.9 KiB | ../packages/quill/packages/primitives/dist/index.js |
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 105.9 KiB | src/products.tsx |
| 99.6 KiB | src/lib/api.ts |
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
| Size | File |
|---|---|
| 319.8 KiB | ../node_modules/.pnpm/posthog-js@1.438.8_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs |
| 281.1 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 220.2 KiB | ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 185.5 KiB | ../packages/quill/packages/quill/dist/index.js |
| 153.7 KiB | ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js |
| 139.9 KiB | ../packages/quill/packages/primitives/dist/index.js |
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 105.9 KiB | src/products.tsx |
| 99.6 KiB | src/lib/api.ts |
| 93.3 KiB | ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js |
Largest files eagerly shipped from src/scenes/activity/explore/EventsScene.tsx
| Size | File |
|---|---|
| 319.8 KiB | ../node_modules/.pnpm/posthog-js@1.438.8_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs |
| 281.1 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 220.2 KiB | ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 185.5 KiB | ../packages/quill/packages/quill/dist/index.js |
| 181.9 KiB | src/queries/validators.js |
| 153.7 KiB | ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js |
| 139.9 KiB | ../packages/quill/packages/primitives/dist/index.js |
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 105.9 KiB | src/products.tsx |
| 99.6 KiB | src/lib/api.ts |
Largest files eagerly shipped from src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
| Size | File |
|---|---|
| 319.8 KiB | ../node_modules/.pnpm/posthog-js@1.438.8_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs |
| 316.0 KiB | ../node_modules/.pnpm/posthog-js@1.438.8_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/rrweb.js |
| 281.1 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 220.2 KiB | ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 185.5 KiB | ../packages/quill/packages/quill/dist/index.js |
| 181.9 KiB | src/queries/validators.js |
| 153.7 KiB | ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js |
| 126.8 KiB | ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js |
| 105.9 KiB | src/products.tsx |
| 99.6 KiB | src/lib/api.ts |
Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479
✅ Toolbar bundle — eager 2.24 MiB within budget
What the toolbar ships to customer pages, measured from the esbuild output (minified, post-tree-shake). The eager set is the entry plus everything statically imported from it — fetched before any feature runs; deferred chunks load lazily. The eager guardrail is 5.72 MiB. Each output file must also stay below 10 MB, where CloudFront stops compressing it. The module boundary is enforced separately by check-toolbar-graph.
| Metric | Size | Δ vs base | Budget |
|---|---|---|---|
| Eager (shipped) entry + static imports |
2.24 MiB · 19 files | 🔺 +2.0 KiB (+0.1%) | ████░░░░░░ 39.1% of 5.72 MiB |
| Deferred (lazy) | 2.10 MiB · 40 files | no change | n/a — loads on demand |
Loader dist/toolbar.js |
1.2 KiB | no change | █░░░░░░░░░ 6.0% of 19.5 KiB |
Largest eagerly-shipped chunks
| Size | File |
|---|---|
| 877.1 KiB | dist/toolbar/toolbar-app-I7G2FM3L.css |
| 664.2 KiB | dist/toolbar/chunk-chunk-SUEK4BA3.js |
| 257.8 KiB | dist/toolbar/chunk-chunk-7ZYWOYNH.js |
| 131.8 KiB | dist/toolbar/chunk-chunk-FDH2IBXT.js |
| 129.6 KiB | dist/toolbar/chunk-chunk-7KVJ3SBW.js |
| 74.7 KiB | dist/toolbar/toolbar-app-Q3M4UQVL.js |
| 69.0 KiB | dist/toolbar/chunk-chunk-TSAL54PB.js |
| 35.6 KiB | dist/toolbar/chunk-chunk-PVJXZTW7.js |
| 21.7 KiB | dist/toolbar/chunk-chunk-2ZQQMVWZ.js |
| 6.8 KiB | dist/toolbar/chunk-chunk-DV7IWQNF.js |
Posted automatically by check-toolbar-size · sizes are toolbar output bytes (shipped, post-tree-shake) from the esbuild metafile
✅ Dist folder size — 🔺 +2.07 MiB (+0.2%)
Total size of the built frontend/dist folder (all assets), compared against the base branch.
Total: 1016.71 MiB · 🔺 +2.07 MiB (+0.2%)
|
[Low impact] Updates documentation code examples for observability setup. The PR appears safe to merge, with a non-blocking correction needed in the Node sample. Reviews (1) · Last reviewed commit: "chore: otel per request context docs" · Reviewed by Greptile |
c03c7ac to
0f86edd
Compare
| // Pass the client to the processor you configured earlier | ||
| new PostHogSpanProcessor({ | ||
| projectToken: '<ph_project_token>', | ||
| host: '<ph_client_api_host>', | ||
| client: posthog, | ||
| }) |
There was a problem hiding this comment.
P2 · Wire the context client into the registered Node processor
When readers append this snippet to the earlier Node setup, new PostHogSpanProcessor creates an unregistered instance and discards it. The processor registered in spanProcessors still lacks client, so withContext contributes no user, session, or custom properties. Show the updated provider setup or explicitly replace its existing processor configuration.
There was a problem hiding this comment.
The new step calls identify_context(user_id), so omitting only the posthog.distinct_id resource attribute no longer makes events anonymous. You fixed the note on the OpenTelemetry page, but the same note is still the old wording on AutoGen, AWS Bedrock, Instructor, LlamaIndex, Mirascope, Pydantic AI, Semantic Kernel and smolagents. Worth applying the "don't set a distinct ID in the PostHog context" wording to those too.
| <Markdown> | ||
| {dedent` | ||
| In Go, \`posthog.NewRequestContextMiddleware\` fills the context for each HTTP request | ||
| from the \`X-PostHog-Distinct-Id\` and \`X-PostHog-Session-Id\` headers. |
There was a problem hiding this comment.
The X-PostHog-Session-Id header ends up as $session_id (posthog-go otel/request_context.go writes SessionId to $session_id), and AI ingestion doesn't derive $ai_session_id from it. Since this sits in the sessions step, a Go reader could expect the header to group traces in the Sessions tab. Maybe add that the header sets the web session ID and $ai_session_id still goes in Properties?
Problem
posthog.distinct_idresource attribute, which is fixed for the whole process.@posthog/ai8.14.0) and posthog-go#371 (otelv1.35.0).Changes
$ai_session_idand a custom property, in Python, Node and Go.SessionIdSpanProcessorexamples are gone.posthog-nodeclient as the processor'sclientoption. Go readers learn aboutNewRequestContextMiddleware.posthog-nodeto the Node install line and updates the anonymous-events note.otel-request-context.tsx, and 9 imports follow.How did you test this code?
Test rationale: docs-only change, so no new automated test.
$ai_generationevents with their own distinct ID,$session_id,$ai_session_idand custom property. A call outside a context stayed anonymous.posthog.distinct_idresource attribute (checked in Python).Release status
Docs update
This PR is the docs update.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5 (
claude-opus-5-5)/writing-user-facing-copy,/writing-pr-descriptions.🤖 Generated with Claude Code