Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(flags): log team id, not the team instance, in hypercache refresh (#86479)

posthog[bot]9a495f580b8c
diff --git a/posthog/storage/hypercache.py b/posthog/storage/hypercache.py
index 7b5f7d69a4a4..ae85be7ca9a9 100644
--- a/posthog/storage/hypercache.py
+++ b/posthog/storage/hypercache.py
@@ -464,7 +464,8 @@ class HyperCache:
Pass ``data`` to write an already-built value and skip ``load_fn``; when None the
value is loaded via ``load_fn``.
"""
- logger.info(f"Syncing {self.namespace} cache for team {key}")
+ team_id = getattr(key, "pk", key)
+ logger.info("Syncing cache for team", namespace=self.namespace, team_id=team_id)
start_time = time.time()
success = False
@@ -485,13 +486,16 @@ class HyperCache:
# source of the failure already reported it, so don't report it again here.
HYPERCACHE_REBUILD_SKIPPED_COUNTER.labels(namespace=self.namespace, reason="dependency_unavailable").inc()
logger.warning(
- f"Skipping {self.namespace} cache sync for team {key}: dependency unavailable",
+ "Skipping cache sync for team: dependency unavailable",
namespace=self.namespace,
+ team_id=team_id,
)
return False
except Exception as e:
capture_exception(e)
- logger.exception(f"Failed to sync {self.namespace} cache for team {key}", exception=str(e))
+ logger.exception(
+ "Failed to sync cache for team", namespace=self.namespace, team_id=team_id, exception=str(e)
+ )
return False
finally:
duration = time.time() - start_time