Skip to content

chore(aio): add Go OpenTelemetry setup to installation docs - #91989

Open
marco-g-pm wants to merge 4 commits into
masterfrom
claude/go-otel-docs-wizard-e7920f
Open

chore(aio): add Go OpenTelemetry setup to installation docs#91989
marco-g-pm wants to merge 4 commits into
masterfrom
claude/go-otel-docs-wizard-e7920f

Conversation

@marco-g-pm

@marco-g-pm marco-g-pm commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

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

  • The OpenTelemetry installation page gains a Go tab in every step: go get install, posthogotel.NewSpanProcessor setup, a hand-authored gen_ai.* span around an LLM call, and a context-based session-ID processor.

otel-go-tab

  • Provider and gateway pages (OpenAI, Anthropic, Google, Azure OpenAI, Bedrock, and the 15 OpenAI-compatible pages) gain a Go tab in the install code block. It says no Go wrapper exists yet and links the OpenTelemetry page.

openai-go-tab

  • That tab renders as plain text with a clickable link through a new prose block type in the in-app onboarding CodeBlock renderer. Blocks that do not declare language: '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?

  • Rendered on a local posthog.com dev site pointed at this branch: the Go tabs show on the OpenTelemetry and provider pages, the prose tab renders as text, and its link navigates to the OpenTelemetry page (screenshots above).
  • pnpm --filter=@posthog/frontend typescript:check reports no errors in the touched files.
  • Not run: the in-app onboarding scene render. The prose branch there is a four-line conditional beside the existing CodeSnippet call.

Automatic notifications

  • Publish to changelog?

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 prose block 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.

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>
@marco-g-pm marco-g-pm self-assigned this Aug 31, 2026
@trunk-io

trunk-io Bot commented Aug 31, 2026

Copy link
Copy Markdown

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

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

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

Trunk lane — non-backend lane

This 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.

⚠️ Bundle size — 🔺 +76.0 KiB (+0.1%)

Uncompressed size of every built .js bundle, compared against the base branch.

Total: 68.10 MiB · 🔺 +76.0 KiB (+0.1%)

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%)

Playwright — all passed

All tests passed.

View test results →

ℹ️ 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

@trunk-io

trunk-io Bot commented Aug 31, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@marco-g-pm
marco-g-pm marked this pull request as ready for review September 1, 2026 13:58
@marco-g-pm
marco-g-pm requested a review from a team September 1, 2026 13:58
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦔 Hogbox preview · ❌ build failed

The preview didn't come up for commit 7bc85e9. See the build log for the failing step. It'll retry on the next push.

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.

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested review from a team, MattBro, fercgomes and rafaeelaudibert and removed request for a team September 1, 2026 13:59
@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor
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

Comment thread docs/onboarding/ai-observability/opentelemetry.tsx Outdated
Comment thread docs/onboarding/ai-observability/opentelemetry.tsx
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@carlos-marchal-ph carlos-marchal-ph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but some details should be amended!

Comment thread docs/onboarding/ai-observability/_snippets/go-otel-tab.tsx Outdated
Comment thread docs/onboarding/ai-observability/aws-bedrock.tsx Outdated
Comment thread docs/onboarding/ai-observability/opentelemetry.tsx
Comment thread docs/onboarding/ai-observability/opentelemetry.tsx
Comment thread docs/onboarding/ai-observability/opentelemetry.tsx Outdated
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
marco-g-pm added a commit that referenced this pull request Sep 1, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants