0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00
Commit Graph

278 Commits

Author SHA1 Message Date
Karl-Aksel Puulmann
259a2290b4
Serialize/deserialize elements_chain on webhooks_ee (#3262)
Solves https://sentry.io/organizations/posthog/issues/2207757069/?project=1899813&query=is%3Aunassigned+is%3Aunresolved
2021-02-09 13:54:02 +01:00
Michael Matloka
62846fd565
Capture EE webhook task sending error (#3254) 2021-02-09 11:25:52 +01:00
Michael Matloka
973769340a
Revert "Revamp and optimize hooks on EE (#3119)" (#3249)
This reverts commit 5485fb058d.
2021-02-09 10:16:38 +01:00
Michael Matloka
5485fb058d
Revamp and optimize hooks on EE (#3119)
* Revamp and optimize hooks on EE

* Improve retry strategy

* Improve some minor things

* Cache available_features in memory

* Address feedback
2021-02-09 09:52:19 +01:00
Tim Glaser
b804ba9619
Refreshing insights (#3144)
* Refreshing insights

* Fix dashboarditem

* put exceptionhog back

* Fix ts issues

* fix tests

* Fix tests

* Remove printers

* fix type errors

* fix test

* Fix flickering

* Fix issues switching between views

* Use result for backwards compatability

* Fix tests
2021-02-08 20:26:36 +01:00
Eric Duong
1dbd3df937
2794 retention people (#3108)
* frontend changes

* backend changes

* remove print

* fix query

* remove print

* fix date

* fix tests

* fix trend query

* type

* adjust again

* another adjustment

* run again

* remove any

* fix array iteration
2021-02-08 10:28:38 -05:00
Karl-Aksel Puulmann
02f611b698
Fix stickiness comparison (#3195)
* Make stickiness comparison work

This blew up because comparison code was not initializing the right
subclass of filter.

https://sentry.io/organizations/posthog/issues/2137356539/?project=1899813&query=is%3Aunassigned+is%3Aunresolved&statsPeriod=14d

* Use new method in retention

* Include data in repr for filter

This should make debugging via sentry easier
2021-02-08 17:03:37 +02:00
James Greenhill
e8dcf13ad0
Emit timing gauge to statsd for sync_execute on clickhouse (#3209)
* Emit timing gauge to statsd for sync_execute on clickhouse

* take out of block for SHELL_PLUS_PRINT_SQL

* add docker testing for ease

* comment out cypress projectid
2021-02-05 14:13:38 -08:00
Eric Duong
811f96586d
Make action null safe (#3223)
* make action null safe

* add team id to filter

* change to proper exception
2021-02-05 15:38:15 -05:00
Karl-Aksel Puulmann
090bc73c0c
Don't blow up if funnel has no steps (#3222)
If funnel has no steps, we still send query from frontend despite
showing no results. While we could change frontend, we can also make the
query more robust.

Sentry: https://sentry.io/organizations/posthog/issues/2201253144/?project=1899813&query=is%3Aunassigned+is%3Aunresolved&statsPeriod=14d
2021-02-05 22:24:47 +02:00
Tim Glaser
728410c87b
1269 funnel trends 2 (#3079)
* WIP

* Closes #1269 funnel trends

* Fix tests

* fix

* fix tests

* Hide interval and featureflag display switcher

* fix one step issue

* fix insights

* Fix tests

* undo todo

* Fix label issues, add warning

* fix frontend issue

* fix
2021-02-05 14:32:28 +01:00
Michael Matloka
1f3145128c
Enable PLUGIN_SERVER_INGESTION (#3107)
* Enable PLUGIN_SERVER_INGESTION_HANDOFF = get_bool_from_env("PLUGIN_SERVER_INGESTION_HANDOFF

* Don't set PLUGIN_SERVER_INGESTION_HANDOFF in worker

* Add comments

* Remove _HANDOFF from PLUGIN_SERVER_INGESTION

* add stats counter for plugin server handoff, so we can verify events out and events in

* add whitelisted posthog and kea organizations

* disable ingestion this round --> first let's just check the plugin server can talk to kafka & clickhouse before sending real events to it

* enable ingestion in docker-compose.ch.yml

* eliminate bad merge

* async action event matching when using postgres plugin server ingestion (#3182)

* fix org

* remove _HANDOFF from topic

* add plugin_ to plugin server ingestion topic

* update plugin server to 0.7.0

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-02-04 16:17:24 +01:00
Paolo D'Amico
de317c8e87
Bulk invite team members (setup section II) (#3143)
Co-authored-by: Michael Matloka <dev@twixes.com>
2021-02-03 13:03:22 +01:00
Yakko Majuri
8087f5f1dd
Handle corrupted cache (#3169)
* Handle corrupted cache

* fix errors

* code quality

* minor update
2021-02-03 09:22:42 +00:00
Tim Glaser
bd068e96db
Simplify cohort queries (#3165) 2021-02-02 19:45:11 +01:00
Michael Matloka
bd3b1ef0d5
Clean up EE settings.py and fix Google auth whitelisted domains (#3159) 2021-02-02 16:03:01 +01:00
James Greenhill
34dbbec647
Remove clickhouse pooler from sync execute path (#3138) 2021-01-29 19:26:07 -08:00
Karl-Aksel Puulmann
1cc72c4da5
Populate a lone session recording for demo (#3128) 2021-01-29 14:28:55 +01:00
Karl-Aksel Puulmann
15d04d9e56
Improve demo data (#3111)
* Unify clickhouse and pg demo data creation

* Adapt yakkos demo data generation to normal demo

* Split demo.py into subfolder

* Add original, web data import

Note that elements are not added because they can't be added
automagically :(.

* Improve wording

* dont generate dashboards

* try get tests passing

* fix types

* Get cypress tests green
2021-01-28 13:50:01 +02:00
Tim Glaser
108a50264f
Remove emails from csv (#3115)
* Add team filter to cohort query to speed up

* Fix querying

* Remove emails from CSV upload

* fix clickhouse email
2021-01-28 11:43:46 +01:00
Karl-Aksel Puulmann
dba58f4467
Hotfix for missing session recording events (#3069)
* Hotfix for missing session recording events

Temporarily solves https://github.com/PostHog/posthog/issues/2927,
though the error will rear it's head again with plugin-based ingestion.

Opened https://github.com/PostHog/posthog/issues/3068 for long-term
solution.

* kwargs everywhere

* use settings over kwargs
2021-01-27 13:12:55 -08:00
Eric Duong
fcef914182
3072 retention person modal fix (#3080)
* fix time formatting

* fix queries and serializers

* fix ret tests

* fix tests

* fix tests

* remove unnecessary change
2021-01-27 10:01:12 +02:00
James Greenhill
583d4cdd26
Add whitelists for domains on Google OAuth (#3098) 2021-01-26 17:44:44 -08:00
Michael Matloka
a1d364c9f9
Revert "Revert "Move adding feature flags to event to capture endpoint (#3090)" (#3095)" (#3096)
This reverts commit 6c57aa0cea.
2021-01-27 00:14:09 +01:00
Michael Matloka
6c57aa0cea
Revert "Move adding feature flags to event to capture endpoint (#3090)" (#3095)
This reverts commit 00b5edf572.
2021-01-26 21:57:50 +01:00
Michael Matloka
00b5edf572
Move adding feature flags to event to capture endpoint (#3090)
* Move adding feature flags to event to capture endpoint

* Remove unused imports

* Don't create empty event properties dict

* Don't ever create event properties if dict not present

* Test feature flags in test_capture

* Ensure that every event has a properties dict

* Only apply PLUGIN_SERVER_INGESTION_HANDOFF to plugin-whitelisted orgs

* Adjust tests for ensured event properies dict
2021-01-26 18:23:28 +01:00
Eric Duong
2fef10315b
Add missing logic for action days in cohort calculating (#3056)
* add missing logic

* add test

* fix type
2021-01-26 13:26:32 +01:00
Eric Duong
cba416b9de
add try statement for deleting persons incase the table is dsitrbuted (#3042) 2021-01-21 15:30:09 -05:00
Eric Duong
97f0cbd27a
Round sessions value (#2925)
* add scaling function

* adjust test

* update tests

* patch errors

* fix import
2021-01-21 13:24:59 -05:00
Michael Matloka
eaa169100a
Add handing off event ingestion to plugin server (#2898)
* Add setting for handing off process_event_ee to plugin server

* Add StatsD settings to KEYS

* bin/plugin-server → start-plugin-server & docker-plugin-server

* Simplify to only add docker-plugin-server

* Bring back original comment

* Turn down verbosity of plugin server install

* Remove redundant if

* Fix comment

* Remove lone newline

* Roll back unsafe script changes

* Simplify dockerized plugins

* Add some depends_on

* Clarify HAND_OFF_INGESTION env var

* Use posthog-plugin-server 1.0.0-alpha.1

* Enhance bin/plugin-server and rm bin/docker-plugin-server

* Move around PLUGIN_SERVER_INGESTION_HANDOFF ifs

* Use posthog-plugin-server@1.0.0-alpha.2

* Support kafka+ssl:// in plugin-server

* Produce to topic events_ingestion_handoff for plugin server

* Use posthog-plugin-server@1.0.0-alpha.3

* Don't import Kafka topics in FOSS

* Use @posthog/plugin-server

* Update yarn.lock

* Add commands for external ClickHouse setup/teardown

* Actually delete test CH teardown command

* ClickhouseTestRunner.setup_test_environment() in setup_test_clickhouse

* Rework test setup script to work with Postgres too

* Restore master plugins dir for merge

* Unset PLUGIN_SERVER_INGESTION_HANDOFF in docker-compose.ch.yml

* Fix unimportant typo

* Build log_event data dict only once

* Make it clear in bin/plugin-server help that it's bin

* Space space
2021-01-21 15:39:44 +01:00
Michael Matloka
78ecbb60e7
Delete omni_person.proto (#3014)
We don't use this `omni` stuff.
2021-01-21 14:13:04 +01:00
Karl-Aksel Puulmann
29c1ed954d
Allow filtering by unseen recordings (#3000)
* Add model for session recording viewed

* Save view when querying for session recording data

* Send information to FE about whether session has been viewed

* Allow filtering by "recording unseen"

* Rename property

* Update migration
2021-01-21 09:42:00 +02:00
James Greenhill
a0a637bb49
Don't include materialized columns in kafka table (#3026) 2021-01-20 20:39:20 -08:00
James Greenhill
62b5343a62
Add user param for clickhouse if provided (#3025)
* Add user param for clickhouse if provided

* remove duplicate setting - forgot it was there!

* inconsistent naming between migrations and clickhouse-driver
2021-01-20 16:54:03 -08:00
James Greenhill
85a4c1c9d6
Setup logging to system.text_log in dev environment (#3024) 2021-01-20 16:51:11 -08:00
Tim Glaser
62c5e18358
Fix multiple actions in funnel (#3011) 2021-01-20 15:53:34 +01:00
Tim Glaser
02044c616f
Denormalize clickhouse props (#2903)
* Denormalize clickhouse props

* Add allow_denormalized_props option

* Use funnels

* fix funnel query

* Add more denormalized props

* Fix comma

* Use materialized columns instead of mat views

* duplicate ,'s

Co-authored-by: James Greenhill <fuziontech@gmail.com>
2021-01-20 12:38:27 +01:00
Karl-Aksel Puulmann
9354b7ce64
Highlight filtered events in events table and in session recording (#2954)
* Highlight rows from sessions which are matched by the filter

* Send start_time of recording to frontend

This helps us calculate offsets a bit better

* Use timestamp by server for date shown

* Load session events via kea logic

* Update rrweb, rrweb-player

* Highlight events user is filtering for in sessions player

* Handle empty case properly

* Add positive test

* Order session recording events in query

* Fix filtering by multiple events with differing names

previously only the first would have been used due to overlapping
params.

* Return all highlighted times as action_filter_times

* Send back ids not timestamps

This avoids weird rounding errors causing issues

* Show skeleton for longer

* update typing

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-01-19 21:16:42 -06:00
Karl-Aksel Puulmann
c245af6a3e
Filters design followups (#2993)
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-01-19 20:58:21 -06:00
Eric Duong
f269c2a43d
fix the itnerval bug (#2992) 2021-01-19 19:56:16 -06:00
Marius Andra
8d65088c5d
Set Once (#2972)
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-01-18 09:02:58 -06:00
Marius Andra
99e74da03d
Event must be a string (#2920)
* Event must be a string

* test that event can't be a dict

* convert dicts and other unknown event names to strings

* mypy

* update packages to have mypy working with python 3.9

* fix event name sanitization types

* fix misc type error from mypy/django-stubs update

* fix other type errors from mypy/django-stubs update

* add migration to update events for users if there's weird data in team.event_names

* ignore type to fix mypy issue

* fix migrations
2021-01-15 15:35:52 +01:00
Karl-Aksel Puulmann
3009e0aa2e
Support multiple action filters in sessions (#2946)
* Make it possible to filter by (multiple) action filters in postgres

Session will now contain "action_filter_times" key which lists when each
action filter occurred for the first time within the session.

This will be used to highlight rows/show special values in sessions
player.

* Clickhouse: support multiple action filters

* Remove dead code
2021-01-15 11:28:46 +01:00
Tim Glaser
1a6207d791
Upload static cohort csv (#2932)
* Upload static cohort using CSV, closes #2868

* fix tests

* Fix tests

* Fix e2e test

* Avoid double inserts

* Speed up query

* Move to params

* fix tests

* Use JSON instead of protobuf

* unused import

* produce instead of produce_proto

* Insert directly into clickhouse, no need for kafka

* a few quick fixes

* insert in batch to clickhouse

* test SQLi since we can't really trust what we are inserting

* Extra check for duplicates

Co-authored-by: James Greenhill <fuziontech@gmail.com>
2021-01-15 11:19:31 +01:00
Tim Glaser
a1ccbd1327
Add missing feature flags (#2944)
* Add missing feature flags

* fix types

* fix tests

* Move feature flags to model
2021-01-15 11:09:51 +01:00
Karl-Aksel Puulmann
17a31f0b43
Speed up sessions list query (#2934)
* Remove (apparently) useless person joins from sessions sql

* WIP: Make sessions list query use python iteration

* WIP: Show loader while session data is loading

* Aggregate together sessions

* Calculate start and end points of session separately

* Remove cruft code

* Load session events asynchronously for self-hosted

Note clickhouse behavior is unchanged.

* Update pagination logic for sessions

In addition to offset, postgres now returns a dict containing person_id,
timestamp which is used to make sure we filter events on different pages
correctly

* Add some tests to SessionListBuilder

* Fix typing errors

* Fix pagination limit

* Move tests to right file

* Query less events for sessions list

Since we're ordering by end_time we know events before last end_time are
all processed.

* Add test for current_url behavior

* Make sure old tests remain working

* Remove unused base class

* Move sessions-related queries to separate subfolder

* Extract sessions list code to separate file(s)

* Sort sessions by end time in ch as well

* List end time in sessions table

* Return person email when querying sessions lists on postgres

This gets used by the view

* Return email over all user properties for sessions in clickhouse and view

* Fix an ordering bug

* Fix a pagination bug

* Fix endpoint

* Fix basic sessions tests for pagination

* Sort consistently for sessions list builder

* Roll pagination into filters
2021-01-15 01:53:28 +02:00
Eric Duong
d420c931a9
restore path custom events (#2923)
* add pg logic

* add in custom event values
2021-01-13 15:05:06 +01:00
Eric Duong
a0ab699588
Proper interval rounding on normal trends (#2901)
* do proper interval rounding on normal trends

* patch inconsistency

* remove microseconds

* conditionall round interval

* adjust how date_from is handled

* add retention test

* edits and split test
2021-01-13 14:35:46 +01:00
Karl-Aksel Puulmann
19c50a2bfe
Sessions filtering system (#2912)
* Refactor adding filtering component

* Fix a type error

* Rename events to entries

This makes much more sense since you can select e.g. actions

* Start of the session filter box

* WIP: Sessions filtering

* Make SelectBox more generic

* Make sessions filtering visuals

* Extract operator value selection code

* Make action properties filterable

* Make it possible to filter by cohorts

* Filtering by events

* Make loading sessions possible with the new logic

* Make it possible to filter by actions/events via backend with new code

Note that it's all relying on old 'paths' - will refactor these later.

* Make it possible to filter by user properties

* Update imports

* Small fixes for sessions filter

* Add UserFilter file

* Ignore extra args to Property

* Make it possile to filter by recording duration

* Update how session duration filter works in the backend

* Rename a few columns

* Remove dead mixins

* Remove duplicated logic, put code behind feature flag

* Move sessions filters logic to subfolder

* Don't show properties if feature flag.

* Add saved filters support

This will require some discussion with Paolo - probably want to show
this on the side?

* Add divider before sessions table

* Narrower typing for recordings

* Some frontend for saving filters

* Small rename

* Add SessionsFilter model

* Save filter on backend

* add missing filter

* Extract const

* Make ActionFilterDropdown be able to pick actions again.

* Fix links from person modal to sessions

* Update tests.

* Fix database model

* Use proper deep equal for detecting active filter

* Remove unneeded field

* Only return filters from correct page

* Add missing data-attr

* Add instrumentation

* rename component

* Fix analytics metadata
2021-01-13 14:55:06 +02:00
Michael Matloka
3c13a3ef9c
Simplify plugin server service definitions (#2929) 2021-01-13 11:46:56 +01:00