-
Notifications
You must be signed in to change notification settings - Fork 1.6k
chore: fixes and updates to livesteam #31050
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
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Disable / index and /jwt on prod. Cleanup geo filtering. Ensure team_id is set on subscription. In live_stats use a type not consuming any memory space. Remove subs by int comp.
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.
PR Summary
This PR implements several optimizations and maintenance improvements to the PostHog livestream component.
- Updated Go version from 1.24 to 1.24.1 in Dockerfile and modernized dependencies in go.mod
- Replaced string-based
ClientId
with numericSubID
using atomic counter for more efficient subscription identification - Changed
statsChan
type fromPostHogEvent
toCountEvent
and used emptynoSpaceType
struct in LRU caches to significantly reduce memory usage - Added 1000-element buffers to all processing channels to prevent blocking under load
- Improved JWT handling with new functions to extract team ID and API token from claims
- Disabled
/jwt
and/index
endpoints in production for better security - Optimized
removeSubscription
function to return immediately when match is found
12 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
f88cb20
to
ac2af98
Compare
ef0cf8c
to
a20f3ca
Compare
Daesgar
approved these changes
Apr 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Give livestream proper maintanance
Changes
Add buffers to processing channels
Disable / index and /jwt on prod.
Cleanup geo filtering.
Ensure team_id is set on subscription.
In live_stats use a type not consuming any memory space.
Remove subs by int comp.
Fix parsing timestamp if it's an integer.
Does this work well for both Cloud and self-hosted?
Yes.
How did you test this code?
Tests + run.