-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Write person ID and properties to redis #9377
Conversation
Thanks for submitting the WIP PR, appreciate the visibility into the work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
constructor( | ||
postgres: Pool, | ||
redisPool: GenericPool<Redis.Redis>, | ||
kafkaProducer: KafkaProducerWrapper | undefined, | ||
clickhouse: ClickHouse | undefined, | ||
statsd: StatsD | undefined | ||
statsd: StatsD | undefined, | ||
personInfoCacheTtl = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be best to have this to the same default as the config but sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/start
Sent 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.