-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: count replay events in ClickHouse as we ingest them #16994
Merged
Merged
Changes from 10 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
ff8b2e9
feat: count replay events in ClickHouse as we ingest them
pauldambra 3e8af12
Add to hogql db schema
pauldambra bee57bb
Update query snapshots
github-actions[bot] fe2a25a
Update query snapshots
github-actions[bot] 2064f1b
Update query snapshots
github-actions[bot] b8af913
don't need it on kafka table
pauldambra 906bbce
Update query snapshots
github-actions[bot] 564ad68
Merge branch 'master' into feat/count-replay-events
pauldambra 7c776b8
update desired columns
pauldambra 66d5b9d
switch to counting events and messages
pauldambra 6d89f3c
Update query snapshots
github-actions[bot] c6f0844
Merge branch 'master' into feat/count-replay-events
pauldambra e56a1ee
first pass addition of _timestamp
pauldambra dee3732
maybe like this
pauldambra 4d7e4c2
like this?
pauldambra 4a2223c
Update query snapshots
github-actions[bot] c558ba2
Merge branch 'master' into feat/count-replay-events
pauldambra 50c5097
explicit message count
pauldambra 72e5b7b
Update query snapshots
github-actions[bot] e9deb66
Update query snapshots
github-actions[bot] 4ea881f
Update query snapshots
github-actions[bot] b8bfffe
Update query snapshots
github-actions[bot] d946483
Update UI snapshots for `chromium` (2)
github-actions[bot] 3304e71
Update query snapshots
github-actions[bot] 9990557
hogql db schema too
pauldambra 0dc7fdf
Update query snapshots
github-actions[bot] ec31d81
Update UI snapshots for `chromium` (2)
github-actions[bot] 7faefca
Merge branch 'master' into feat/count-replay-events
pauldambra 129ae94
fix
pauldambra 98ba0af
Merge branch 'master' into feat/count-replay-events
pauldambra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file modified
BIN
-11.7 KB
(64%)
...-snapshots/Navigation-App-Page-With-Side-Bar-Hidden-Mobile-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-7.54 KB
(79%)
...s-snapshots/Navigation-App-Page-With-Side-Bar-Shown-Mobile-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
26 changes: 26 additions & 0 deletions
26
posthog/clickhouse/migrations/0048_session_replay_events_count.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions | ||
from posthog.models.session_replay_event.migrations_sql import ( | ||
DROP_SESSION_REPLAY_EVENTS_TABLE_MV_SQL, | ||
DROP_KAFKA_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
ADD_EVENT_COUNT_WRITABLE_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
ADD_EVENT_COUNT_DISTRIBUTED_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
ADD_EVENT_COUNT_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
) | ||
from posthog.models.session_replay_event.sql import ( | ||
SESSION_REPLAY_EVENTS_TABLE_MV_SQL, | ||
KAFKA_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
) | ||
|
||
operations = [ | ||
# we have to drop materialized view first so that we're no longer pulling from kakfa | ||
# then we drop the kafka table | ||
run_sql_with_exceptions(DROP_SESSION_REPLAY_EVENTS_TABLE_MV_SQL()), | ||
run_sql_with_exceptions(DROP_KAFKA_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
# now we can alter the target tables | ||
run_sql_with_exceptions(ADD_EVENT_COUNT_WRITABLE_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
run_sql_with_exceptions(ADD_EVENT_COUNT_DISTRIBUTED_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
run_sql_with_exceptions(ADD_EVENT_COUNT_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
# and then recreate the materialized views and kafka tables | ||
run_sql_with_exceptions(KAFKA_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
run_sql_with_exceptions(SESSION_REPLAY_EVENTS_TABLE_MV_SQL()), | ||
] |
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
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
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
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
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
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.
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.
this is clever... that's not always a good thing 🤣
Is it better to explicitly add
message_count: 1
in the plugin server to aid the future traveller?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.
I think it might be a bit more clear with
message_count: 1