Metrics config settable at module level; metrics client hardened
posthog-v7.28.0
1 feature2 enhancements3 fixesThis release1 featureNew capabilities2 enhancementsImprovements to existing features3 fixesBug fixesAI-tallied from the release notes
From the original release noteView original ↗
Minor changes
- 2d7f8cc The
client.metricsconfig can now be set through module-level settings: assignposthog.metrics = {"service_name": ..., ...}alongsideposthog.api_keyand the dict is applied whensetup()builds the global client. Previously module-configured apps had no way to pass the metrics config, so every series recorded through the global client shippedservice.name='unknown_service'. Late assignment (e.g. a Djangoready()hook running after an earlysetup()) still applies on the nextsetup()call, as long as the metrics API hasn't been used yet. — Thanks @DanielVisca!
Patch changes
-
6766309 Harden the alpha
posthog.metricsclient based on review follow-ups.- Metric attributes are now deep-snapshotted at capture time, so mutating a nested list/dict value after
count()/gauge()/histogram()can no longer rewrite an already-recorded series' attributes on the wire. - Failed metric flushes now retry with exponential backoff (first retry at the base interval, then doubling per consecutive failure, capped at 64x the flush interval — the shared JS logs ramp) instead of the fixed cadence, and the buffered window is dropped loudly after 8 consecutive failed flushes — previously documented as 3 but effectively 4.
- Invalid
metricsclient config (non-dict config orresource_attributes, non-numericflush_interval, non-integermax_series_per_flush, non-callablebefore_send) now degrades to defaults with a warning instead of raising from the firstclient.metrics.count()call, matching the client's no-throw contract. — Thanks @DanielVisca!
- Metric attributes are now deep-snapshotted at capture time, so mutating a nested list/dict value after
Fetched July 22, 2026
