instrument-tracing
БесплатноБез исполняемых скриптовНе проверенAdd PostHog distributed tracing to see how requests flow through services and where time goes. Use after implementing features or reviewing PRs to ensure…
от PostHog★ 81 звезда на GitHubОб этом скилле
Add PostHog distributed tracing
Use this skill to add PostHog distributed tracing for new or changed code. Use it after implementing features or reviewing PRs to ensure request entry points, outbound calls, and background jobs produce spans, when the user asks to add tracing or spans, or to point existing OpenTelemetry tracing at PostHog. Supports any platform or language.
Supported platforms: Node.js, Next.js, Python (including Django, FastAPI, and Flask), Go, Java, .NET, PHP, Ruby, and any language via OpenTelemetry (OTLP).
PostHog tracing uses the standard OpenTelemetry SDK and an OTLP HTTP trace exporter. It does not need a PostHog SDK.
Instructions
Follow these steps IN ORDER:
STEP 1: Analyze the codebase and detect the platform.
- Detect the language, framework, and existing tracing setup.
- Look for dependency files and project files (package.json, requirements.txt, pyproject.toml, go.mod, pom.xml, build.gradle, *.csproj, Gemfile, composer.json, etc.).
- Look for lockfiles (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lockb, poetry.lock, uv.lock, go.sum, Gemfile.lock, composer.lock, etc.) to determine the package manager.
- Look for existing tracing: an OpenTelemetry tracer provider, an
instrumentation.tsfile, anopentelemetry-instrumentlaunch command, an OpenTelemetry Collector config, a Java agent flag, or another vendor's tracing agent. - Check whether a PostHog SDK (posthog-js, posthog-node, posthog-python) is already installed. You need this only for STEP 6.
STEP 2: Choose the capture path.
- If the codebase already exports OpenTelemetry traces, point the existing OTLP trace exporter (or Collector) at PostHog. Reuse the existing tracer provider. If it exports to another tracing backend, ask the user before you add PostHog as a second destination.
- Otherwise, add the OpenTelemetry SDK with an OTLP HTTP trace exporter and auto-instrumentation. Auto-instrumentation creates spans for HTTP servers, frameworks, and database drivers without code changes.
- Read the platform reference that matches the detected stack now. Use its "With OpenTelemetry" section. If no reference matches, use the general installation reference.
STEP 3: Install dependencies. (Skip if the codebase already exports OpenTelemetry traces.)
- Install the OpenTelemetry SDK, the OTLP HTTP/protobuf trace exporter, and the auto-instrumentation for the detected stack:
- Node.js and Next.js: the packages from the platform reference, plus
@opentelemetry/auto-instrumentations-node. - Python:
opentelemetry-distroandopentelemetry-exporter-otlp-proto-http, then runopentelemetry-bootstrap -a install. It installs the instrumentation packages for the libraries the app already uses. Do not installopentelemetry-instrumentation-all. - Go: the packages from the platform reference, plus the contrib instrumentation for each library, such as
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp. - Java: the zero-code
opentelemetry-javaagent.jar. It needs no dependency changes. - .NET:
OpenTelemetry,OpenTelemetry.Exporter.OpenTelemetryProtocol, andOpenTelemetry.Extensions.Hosting, plusOpenTelemetry.Instrumentation.AspNetCoreandOpenTelemetry.Instrumentation.Http. - PHP: the packages from the platform reference. For auto-instrumentation, the
opentelemetryPHP extension (from PECL) and theopen-telemetry/opentelemetry-auto-*package for the framework, such asopen-telemetry/opentelemetry-auto-slim. - Ruby:
opentelemetry-sdk,opentelemetry-exporter-otlp, andopentelemetry-instrumentation-all, enabled withc.use_all.
- Node.js and Next.js: the packages from the platform reference, plus
- Do not manually edit dependency files — use the package manager's install command.
- If the project keeps more than one lockfile for the same manifest, such as a second Gemfile lock for another bundle, update each one.
STEP 4: Configure the OTLP trace exporter.
- Send spans over OTLP HTTP/protobuf to
/i/v1/traceson the PostHog host, with the project token in anAuthorization: Bearerheader. Do not use/i/v0/ai/otel. That endpoint accepts only LLM spans. - With environment variables, set the full path in
OTEL_EXPORTER_OTLP_TRACES_ENDPOINTand the header inOTEL_EXPORTER_OTLP_TRACES_HEADERS(Authorization=Bearer <token>). Do not set the baseOTEL_EXPORTER_OTLP_ENDPOINTfor PostHog. It appends its own/v1/tracespath. - Set
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobufwhere the SDK or agent defaults to gRPC. This applies to the Java agent, .NET, and Python withopentelemetry-distro. - Python with
opentelemetry-distro: start the app withopentelemetry-instrument(for example,opentelemetry-instrument python app.py). It builds the tracer provider from the environment variables, so do not also build a provider in code. The distro also turns on OTLP metric and log export. SetOTEL_METRICS_EXPORTER=noneandOTEL_LOGS_EXPORTER=noneunless the app already sends those signals somewher
Установить instrument-tracing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл instrument-tracing?
Add PostHog distributed tracing to see how requests flow through services and where time goes. Use after implementing features or reviewing PRs to ensure request entry points, outbound calls, and background jobs produce spans, or when asked to add tracing or spans. Also handles pointing existing OpenTelemetry tracing at PostHog and initial OTLP exporter setup.
Как установить скилл instrument-tracing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл instrument-tracing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic