feat: Write person ID and properties to redis#9377
Conversation
|
Thanks for submitting the WIP PR, appreciate the visibility into the work |
yakkomajuri
left a comment
There was a problem hiding this comment.
Looking good. One comment that the buffer depends on this work, and it will use the person created_at field to determine what events should be sent there.
Could you (either in this PR or the next) add a cache for created_at (either as its own thing or bundled in the props by caching a larger subset of "person" instead of just props at the top level).
yakkomajuri
left a comment
There was a problem hiding this comment.
looks good - a few nits.
also, can we add a metric for each of the cache functions? redisSet already has metrics but I'd love to see a breakdown across each of the operations more clearly
5ca62a2 to
f5dbbe4
Compare
They are all just calling |
| clickhouse: ClickHouse | undefined, | ||
| statsd: StatsD | undefined | ||
| statsd: StatsD | undefined, | ||
| personInfoCacheTtl = 1, |
There was a problem hiding this comment.
would be best to have this to the same default as the config but sure
There was a problem hiding this comment.
set it like that on purpose to expire fast if not set.
Problem
For #9179
Storing person info in redis:
Changes
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?
Ran locally with
PERSON_INFO_TO_REDIS_TEAMS="1,2,3,4,5" ./bin/startSent an event with posthog python
>>> posthog.capture('test-id3', 'test-event', properties={ '$set': { 'userProperty': 16 } })Verified that info was in Redis as expected:
Changed the userProperty with py
>>> posthog.capture('test-id3', 'test-event', properties={ '$set': { 'userProperty': 334 } })In redis:
Added second user and merged
redis. Note that we didn't expire the old props and created_at, but that personId isn't used anymore.