Skip to content

feat(skills): add instrument-tracing skill - #439

Merged
jonmcwest merged 2 commits into
mainfrom
jon/instrument-tracing
Oct 26, 2026
Merged

jonmcwest merged 2 commits into
mainfrom
jon/instrument-tracing

Conversation

@jonmcwest

Copy link
Copy Markdown
Contributor

Problem

The omnibus skill set has instrument-logs and instrument-metrics, but no tracing sibling. An agent that must add distributed tracing to an app has no single skill that detects the stack and sets up span export to PostHog.

Changes

Adds omnibus/instrument-tracing, the sibling of instrument-logs and instrument-metrics. It uses the same nine-step shape.

  • Capture uses OpenTelemetry. The skill installs the OpenTelemetry SDK with auto-instrumentation and an OTLP HTTP trace exporter. The exporter sends to /i/v1/traces with the project token as an Authorization: Bearer header. If the app already exports OpenTelemetry traces, the skill points that exporter at PostHog.
  • Why not the PostHog SDK first: PostHog SDK spans are manual only. They have no auto-instrumentation and no traceparent injection, so they cannot give distributed traces across services.
  • Python uses opentelemetry-distro plus opentelemetry-bootstrap -a install, not opentelemetry-instrumentation-all. It sets OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf, because the distro defaults to gRPC. It also turns off the distro's metric and log export.
  • Person and session context is optional (STEP 6). With OpenTelemetry only, the agent copies the X-POSTHOG-DISTINCT-ID and X-POSTHOG-SESSION-ID headers onto spans as posthogDistinctId and sessionId. If the app already has the PostHog SDK, it can add these attributes instead, for example PostHogContextSpanProcessor in Python. The skill does not install the PostHog SDK only for this step.
  • Serverless flushing and verification follow the logs and metrics skills.
  • CODEOWNERS gives context/skills/omnibus/instrument-tracing/ to @PostHog/team-apm, as with metrics/.

Endpoints, env var names, and the token format come from the distributed-tracing docs on posthog.com.

How this relates to the tracing/ skills (#391, #399)

The tracing/ family has one docs-only skill per platform (tracing-nodejs, tracing-python, and so on). It routes Node.js and Python apps that already use the PostHog SDK to the SDK span API. This PR does not change those files.

instrument-tracing is the omnibus, all-platform skill. It is OpenTelemetry-first for the reason above. It uses the same docs as references, and keeps the SDK span API as an option for apps that do not run OpenTelemetry.

Not in this PR

The skill has no cli: block, so the wizard does not run it yet. Wizard wiring is a follow-up, modeled on #390 and PostHog/wizard#1235.

How did you test this code?

  • npm test: 28 files, 219 tests pass.
  • npm run build: passes. dist/skills/omnibus-instrument-tracing.zip has SKILL.md and 12 reference files.
  • I did not run the skill against a sample app.

🤖 Generated with Claude Code

jonmcwest and others added 2 commits October 23, 2026 12:46
Adds the omnibus instrument-tracing skill, the sibling of instrument-logs and instrument-metrics. It detects the stack, sets up the OpenTelemetry SDK with auto-instrumentation, points the OTLP exporter at /i/v1/traces, covers serverless flushing, and verifies spans arrive.
The main path is now the OpenTelemetry SDK with an OTLP HTTP trace
exporter and auto-instrumentation. It does not need the PostHog SDK.
The PostHog SDK is an optional way to put person and session IDs on
spans. Without it, the agent copies the tracing headers onto spans.

Python uses opentelemetry-distro and opentelemetry-bootstrap, and sets
the HTTP/protobuf protocol because the distro defaults to gRPC.

CODEOWNERS gives the skill to @PostHog/team-apm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci feature-flags
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci feature-flags/django
  • /wizard-ci feature-flags/next-js
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a wizard branch:

  • /wizard-ci all wizard:my-branch

Add wizard:<branch> to any command above to pin the wizard branch. It defaults to main.

Results will be posted here when complete.

@jonmcwest
jonmcwest marked this pull request as ready for review October 23, 2026 11:55
@jonmcwest
jonmcwest requested a review from a team as a code owner October 23, 2026 11:55

@johncwaters johncwaters 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.

Note

Automated review. Not written by a human.

Approved by hand after checking the automated review.

@jonmcwest
jonmcwest merged commit 535aac8 into main Oct 26, 2026
18 checks passed
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.

2 participants