Subchapter 93.12
references/start-here.mdMarkdown4 KBView on GitHub
AI agents: this is one page from PostHog’s docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt (opens in a new tab)
Cloud region: This page uses US Cloud hosts. For an EU Cloud project, use
https://eu.i.posthog.cominstead ofhttps://us.i.posthog.com(ingestion host).
PostHog Distributed Tracing works with any OpenTelemetry client. Use the OTel SDKs you already have, point your trace exporter at PostHog’s HTTP endpoint, and add your project token.
On Node.js and Python you can skip OpenTelemetry entirely: posthog-node and posthog create and export spans themselves, and spans made inside a request context carry the person and session they belong to. See the Node.js (opens in a new tab) and Python (opens in a new tab) guides.
Set these on your OpenTelemetry SDK:
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://us.i.posthog.com/i/v1/traces"
OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer <ph_project_token>"
OTEL_SERVICE_NAME="my-app"<ph_client_api_host> and <ph_project_token> are filled in with your project’s values when you’re logged in. Use your project token (the same one you use for capturing events), not a personal API key (opens in a new tab).
This is a different endpoint from PostHog’s AI/LLM tracing (/i/v0/ai/otel), which only accepts generative-AI spans. For general application traces, use /i/v1/traces.
For language-specific setup, follow one of our installation guides:
PostHog ingests spans using OpenTelemetry’s standard model: a trace is a tree of spans, each with a trace_id, span_id, and parent_span_id, plus timing, a service name, and attributes.
Wrap the operations you care about – incoming requests, outgoing calls, database queries – in spans, and enrich them with attributes for business context.
from opentelemetry import trace
tracer = trace.get_tracer("my-app")
with tracer.start_as_current_span("checkout") as span:
span.set_attribute("user.id", "123")
span.set_attribute("cart.value", 4200)
# ... your code ...Once spans are flowing into PostHog, you can:
Distributed tracing uses the same OpenTelemetry-based ingestion as Logs (opens in a new tab), so a single OTel setup covers both. Your traces also live in the same PostHog project as Session Replay (opens in a new tab), Error Tracking (opens in a new tab), and Product Analytics (opens in a new tab) – one platform instead of another observability vendor to run.
1/4
Install a trace exporter RequiredSend context-rich spans RequiredExplore your traces RequiredPart of PostHog’s observability suite Recommended
Install a trace exporter
Required