Skip to content

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 8 commits into from
Apr 10, 2025

Conversation

orian
Copy link
Contributor

@orian orian commented Apr 10, 2025

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.

orian added 4 commits April 10, 2025 12:24
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.
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 numeric SubID using atomic counter for more efficient subscription identification
  • Changed statsChan type from PostHogEvent to CountEvent and used empty noSpaceType 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

orian and others added 2 commits April 10, 2025 12:35
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@orian orian force-pushed the pawel/feat/livestream-fixes-for-parsing branch from f88cb20 to ac2af98 Compare April 10, 2025 10:38
@orian orian requested review from Daesgar and a team April 10, 2025 10:39
@orian orian force-pushed the pawel/feat/livestream-fixes-for-parsing branch from ef0cf8c to a20f3ca Compare April 10, 2025 10:45
@orian orian merged commit e70cdf2 into master Apr 10, 2025
90 checks passed
@orian orian deleted the pawel/feat/livestream-fixes-for-parsing branch April 10, 2025 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants