chore(aio): add Go OpenTelemetry setup to installation docs - #91989
chore(aio): add Go OpenTelemetry setup to installation docs#91989marco-g-pm wants to merge 4 commits into
Conversation
The posthog-go OTel bridge (PostHog/posthog-go#306) gives Go apps a supported path into AI observability. Add a Go tab to the OpenTelemetry installation steps (install, tracer setup, LLM call, session grouping), and point Go users on the provider wrapper pages at the OpenTelemetry integration, since no Go wrappers exist yet. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
🤖 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.
|
| File | Size | Δ vs base |
|---|---|---|
render-query/src/render-query/render-query.js |
21.81 MiB | 🔺 +12.8 KiB (+0.1%) |
posthog-app/src/scenes/real-time-usage/RealTimeUsage.js |
12.8 KiB | 🔺 +12.8 KiB (new) |
posthog-app/src/scenes/onboarding/Onboarding.js |
811.0 KiB | 🔺 +7.8 KiB (+1.0%) |
exporter/src/queries/schema.js |
1.20 MiB | 🔺 +5.3 KiB (+0.4%) |
posthog-app/src/queries/schema.js |
1.20 MiB | 🔺 +5.3 KiB (+0.4%) |
posthog-app/src/scenes/cohorts/Cohorts.js |
17.6 KiB | 🔺 +4.9 KiB (+39.0%) |
posthog-app/src/scenes/dashboard/dashboards/Dashboards.js |
29.4 KiB | 🔺 +4.3 KiB (+16.9%) |
posthog-app/_parent/products/metrics/frontend/MetricsScene.js |
73.4 KiB | 🔺 +4.2 KiB (+6.1%) |
posthog-app/_parent/products/signals/frontend/inbox/InboxScene.js |
758.0 KiB | 🔺 +3.2 KiB (+0.4%) |
posthog-app/src/scenes/surveys/Surveys.js |
26.6 KiB | 🟢 -2.4 KiB (-8.4%) |
exporter/src/exporter/scenes/ExporterNotebookScene.js |
3.40 MiB | 🔺 +2.2 KiB (+0.1%) |
posthog-app/_parent/products/workflows/frontend/WorkflowsScene.js |
88.7 KiB | 🔺 +2.1 KiB (+2.4%) |
exporter/_parent/products/signals/frontend/components/ScoutPicker/CyclotronJobInputScoutPicker.js |
1.9 KiB | 🔺 +1.9 KiB (new) |
posthog-app/_parent/products/signals/frontend/components/ScoutPicker/CyclotronJobInputScoutPicker.js |
1.8 KiB | 🔺 +1.8 KiB (new) |
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 |
1.42 MiB · 22 files | 🔺 +21.2 KiB (+1.5%) | ███░░░░░░░ 31.5% of 4.51 MiB |
authenticated shell (every logged-in page)src/scenes/AuthenticatedShell.tsx |
8.84 MiB · 3,248 files | 🔺 +6.9 KiB (+0.1%) | █████████░ 91.0% of 9.71 MiB |
🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.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 |
| 912 B | ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js |
| 789 B | src/scenes/ChunkLoadErrorBoundary.tsx |
| 762 B | src/index.tsx |
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
| Size | File |
|---|---|
| 307.0 KiB | ../node_modules/.pnpm/posthog-js@1.422.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/rrweb.js |
| 267.7 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 |
| 263.5 KiB | ../node_modules/.pnpm/posthog-js@1.422.5_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.js |
| 253.8 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 154.2 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 |
| 104.7 KiB | src/lib/api.ts |
| 95.2 KiB | ../packages/quill/packages/quill/dist/index.js |
| 93.3 KiB | ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js |
| 90.6 KiB | ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js |
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.26 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.26 MiB · 18 files | 🔺 +2.6 KiB (+0.1%) | ████░░░░░░ 39.5% of 5.72 MiB |
| Deferred (lazy) | 2.11 MiB · 45 files | 🔺 +912 B (+0.0%) | n/a — loads on demand |
Loader dist/toolbar.js |
1.1 KiB | no change | █░░░░░░░░░ 5.8% of 19.5 KiB |
Largest eagerly-shipped chunks
| Size | File |
|---|---|
| 751.6 KiB | dist/toolbar/toolbar-app-DVROT5MS.css |
| 590.0 KiB | dist/toolbar/chunk-chunk-YNQA4RO7.js |
| 484.7 KiB | dist/toolbar/chunk-chunk-RNKUEDGA.js |
| 134.1 KiB | dist/toolbar/chunk-chunk-57FSVJVI.js |
| 131.8 KiB | dist/toolbar/chunk-chunk-FDH2IBXT.js |
| 71.3 KiB | dist/toolbar/toolbar-app-M2WJJNQC.js |
| 69.0 KiB | dist/toolbar/chunk-chunk-TSAL54PB.js |
| 35.6 KiB | dist/toolbar/chunk-chunk-DLWHLAGH.js |
| 21.0 KiB | dist/toolbar/chunk-chunk-L4QNPKVO.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 — 🔺 +5.42 MiB (+0.4%)
Total size of the built frontend/dist folder (all assets), compared against the base branch.
Total: 1448.18 MiB · 🔺 +5.42 MiB (+0.4%)
ℹ️ Docs preview — preview build triggered
Docs from this PR will be published at posthog.com.
| Project | Preview | Updated (UTC) |
|---|---|---|
| posthog.com | Open preview | Sep 1, 2026, 4:14 PM |
The preview should be ready in about 10 minutes. Open the preview at /handbook/engineering/.
⚠️ complexity-ts — 1 function above 10 (max 18)
Cyclomatic complexity above 10 in changed typescript files. Warn only: worth simplifying when you next touch these functions.
| Function | Location | Complexity |
|---|---|---|
CodeBlock |
frontend/src/scenes/onboarding/shared/OnboardingDocsContentWrapper.tsx:121 |
18 |
🦔 Hogbox preview · ❌ build failedThe preview didn't come up for commit Previews are optional and never block merging. A failure here is often a hogland or tailnet hiccup rather than anything in your PR, so the check stays green and this comment is the status. |
Prompt To Fix All With AI### Issue 1
docs/onboarding/ai-observability/opentelemetry.tsx:170-172
**Existing-provider registration is invalid**
When a Go application already has an initialized `TracerProvider`, `sdktrace.WithSpanProcessor` cannot attach the PostHog processor because it is only a construction-time option. Following this guidance therefore fails to compile or leaves the processor unregistered, so PostHog spans and session IDs are not exported; existing providers require `RegisterSpanProcessor`.
### Issue 2
docs/onboarding/ai-observability/opentelemetry.tsx:242-245
**Failed spans lose AI markers**
When the LLM request returns an error, this branch ends the non-prefixed span before assigning any `gen_ai.*` attributes or error details. The documented PostHog filter consequently drops the span, so failed generations never appear in AI observability.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "chore(aio): add Go OpenTelemetry setup t..." | Re-trigger Greptile |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
carlos-marchal-ph
left a comment
There was a problem hiding this comment.
Looks good but some details should be amended!
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ports the review feedback from #91989: ADK Go emits message content as OTel log records, so generations captured via the bridge arrive without prompts and responses. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Problem
Go developers land on AI observability docs that show Python and Node only, with no mention of Go anywhere. posthog-go#306 adds a Go OTel bridge, so the docs need to carry the Go path.
For PostHog/posthog-go#306
Changes
go getinstall,posthogotel.NewSpanProcessorsetup, a hand-authoredgen_ai.*span around an LLM call, and a context-based session-ID processor.proseblock type in the in-app onboarding CodeBlock renderer. Blocks that do not declarelanguage: 'prose'are untouched. The posthog.com renderer gets the same support in a companion PR.Note
Merge after posthog-go#306: the page links
posthog-go/tree/main/otel/example, which 404s until the bridge lands. Companion PRs: context-mill#373 (wizard variant), wizard-workbench#3675 (fixture), and a posthog.com branch (marco/go-otel-aio-docs) for the site-side renderer and Go library page.How did you test this code?
pnpm --filter=@posthog/frontend typescript:checkreports no errors in the touched files.CodeSnippetcall.Automatic notifications
Docs update
This PR is the docs-content half; the posthog.com stub pages already import these components.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written by Claude Code from the Slack thread on posthog-go#306, with the assignee directing scope across the session: a per-page callout box became the condensed Go tab, the tab's code-comment styling became the
proseblock type, and the install-step Go paragraph and an ADK caveat were cut. Skills invoked: /writing-user-facing-copy, /writing-pr-descriptions. Go samples were checked against the posthog-go PR branch and the openai-go v3 API; the committed content contains only public repo material and placeholders.