Install metrics
Contents
Note: Metrics is in open alpha. Any team can turn it on — open Metrics and select Enable metrics in the onboarding view. Setup details, including the ingestion endpoint, may change before general availability.
There are three ways to get metrics into PostHog:
- PostHog SDKs: if a PostHog SDK is already in your app, record metrics with the
posthog.metricsAPI. No new packages, no extra authentication. - OpenTelemetry (OTLP): if you use OpenTelemetry anywhere else, point your OTLP metrics exporter at PostHog. No PostHog packages required.
- Metrics agent: if your services already expose Prometheus
/metricsendpoints, run the PostHog metrics agent with Docker or the Kubernetes Helm chart to scrape and forward them, with no code changes. The same agent can also pull from Google Cloud Monitoring for managed-service metrics like Cloud SQL and load balancers.
Already capturing metrics with Prometheus, StatsD, or Datadog? You don't need to replace anything: add the PostHog call next to your existing instrumentation, using the same metric name and attributes, and migrate at your own pace.
SDK support by signal
| SDK | Logs | Traces | Metrics |
|---|---|---|---|
JavaScript web (posthog-js) | Native, 1.368.0+ | OpenTelemetry. posthog-js doesn't create spans. Use tracing_headers to link requests to sessions. | Native posthog.metrics, 1.399.0+ |
Node.js (posthog-node) | Native posthog.logger, 5.65.0+, or OpenTelemetry | Native, 5.52.0+ (experimental), or OpenTelemetry | Native posthog.metrics, 5.43.0+ |
Python (posthog) | OpenTelemetry | Native, 7.58.0+, or OpenTelemetry | Native posthog.metrics, 7.23.0+ |
| React Native | Native, posthog-react-native@4.44.0+ | OpenTelemetry | OpenTelemetry |
| iOS | Native, posthog-ios@3.58.0+ | OpenTelemetry | OpenTelemetry |
| Android | Native, posthog-android@3.46.0+ | OpenTelemetry | OpenTelemetry |
| Flutter | Native, posthog_flutter@5.27.0+ | OpenTelemetry | OpenTelemetry |
| Any other language | OpenTelemetry | OpenTelemetry | OpenTelemetry |
"Native" means the PostHog SDK records the signal with no OpenTelemetry packages. "OpenTelemetry" means you send it with an OpenTelemetry SDK or Collector pointed at your PostHog OTLP endpoint (/i/v1/logs, /i/v1/traces, or /i/v1/metrics) and your project token. Every PostHog SDK also captures events natively. Prometheus exporters can send metrics through the metrics agent.
Platforms
| Platform | Method |
|---|---|
| JavaScript (web) | posthog.metrics API in posthog-js |
| Node.js | posthog.metrics API in posthog-node |
| Python | posthog.metrics API in posthog-python |
| Other languages | Any OpenTelemetry-compatible OTLP metrics exporter |
| Docker | Metrics agent container that scrapes Prometheus /metrics targets |
| Kubernetes | Helm chart that scrapes prometheus.io/scrape annotated pods |
| Google Cloud | Metrics agent that pulls Google Cloud Monitoring metrics |
Note: Metrics uses the OpenTelemetry Protocol (OTLP) standard. If your language isn't listed, check the OpenTelemetry documentation for compatible libraries and see other languages.





