Other languages metrics installation
Note: Metrics is in alpha. Setup details, including the ingestion endpoint, may change before general availability.
PostHog Metrics works with any OpenTelemetry-compatible client. If your app or infrastructure already exports OTLP metrics, point the exporter at PostHog. No PostHog packages required.
- 1
Install OpenTelemetry packages
RequiredThe key requirements are:
- Use OTLP (OpenTelemetry Protocol) for metrics export over HTTP
- Send metrics to your Metrics endpoint (see configuration step below)
- Include your project token in the Authorization header or as a
?token=query parameter
Find the OpenTelemetry SDK for your language in the official registry. If you already run an OpenTelemetry Collector, you can add PostHog as an additional exporter without touching application code.
- 2
Get your project token
RequiredYou'll need your PostHog project token to authenticate metrics requests. This is the same key you use for capturing events and exceptions with the PostHog SDK.
Important: Use your project token which starts with
phc_. Do not use a personal API key (which starts withphx_).You can find your project token in Project Settings.
- 3
Configure the exporter
RequiredMost OpenTelemetry SDKs pick up standard environment variables, so configuration is often no more than:
TerminalSet
OTEL_SERVICE_NAMEso metrics from different systems stay easy to tell apart. It's attached to every series and used by the Metrics UI for filtering.If you configure the exporter in code instead:
Endpoint:
Authentication: Include your project token either as an
Authorizationheader:Or as a query parameter on the endpoint:
- 4
Test your setup
Recommended- Trigger the code path that records a metric
- Open Metrics in the PostHog sidebar and pick your metric from the name picker
- Data points should appear within a minute of sending
If nothing shows up, check that the endpoint ends in
/i/v1/metrics, that the token starts withphc_, and see the troubleshooting section. Next steps
CheckpointWhat you can do with your metricsAction Description Why you need metrics What metrics show you that events and logs don't Getting started guide Pick the right metric type, add attributes carefully, and chart what matters Group and filter Group by an attribute for one line per value, or filter with key=valuechipsHow metrics works How metrics are ingested, stored, and queried Query with SQL Every metric lands in the posthog.metricstable, queryable from the SQL tab