0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 09:16:49 +01:00
Commit Graph

420 Commits

Author SHA1 Message Date
Rick Marron
b9877a6efe
recording filters work with backend events (#8276) 2022-01-25 16:42:01 -08:00
Rick Marron
0464a51d7d
Fix funnel order on the person modal for funnel trends (#8210)
* fix funnel order on funnel trend persons

* add utils test

* update test for cache update

* remove dupe import
2022-01-25 09:20:42 -08:00
Tim Glaser
f47b1308b5
[Proposal] Add automatic swagger doc generation (#8148)
* Add automatic swagger doc generation

* Fix test and mypy

* formatting

* fix formatting

* formatting

* update

* fix mypy
2022-01-24 17:21:56 +00:00
Neil Kakkar
d07f0fd14c
Fix Significance bugs and FF enablement bug (#8218)
* fix significance bugs and FF enablement bug

* reduce flaky test sensitivity
2022-01-24 16:26:21 +00:00
Karl-Aksel Puulmann
fda07665e5
Update test snapshots and test code (#8220) 2022-01-24 14:18:34 +02:00
Eric Duong
12da43034f
yeet(actions): Consolidate clickhouse actions to actions (#8150)
* actions working

* tests working

* types

* snapshots

* update snapshots
2022-01-21 09:42:18 -05:00
Neil Kakkar
a65e1116e0
Better experiment Significance calculations for Funnels (#8166)
* compute exposure independently for trend experiments

* use feature_flag_called instead

* make snapshot deterministic

* update funnel significance calculations
2022-01-21 10:22:07 +00:00
Neil Kakkar
01d1a4aab3
Compute exposure independently for trend experiments (#8114)
* compute exposure independently for trend experiments

* use feature_flag_called instead

* make snapshot deterministic
2022-01-20 16:46:00 +00:00
Rick Marron
24b7e7afe4
only get recordings for paths + trends (#8127) 2022-01-19 10:49:12 -08:00
Eric Duong
2ea18b382b
Encode prepared urls (#8103)
* encode

* don't use named

* fix typing

* add test

* add more comment

* remove lamdbas

* restore original
2022-01-19 09:29:00 -05:00
Rick Marron
2b9917a915
Recordings in paths (#8015)
* add recordings to path query

* uncomment cache

* add clarifying comment

* works for start/end paths

* move to extra fields/properties

* add tests

* cleanup

* update ff name

* fix flaky test

* test and handle path_dropoff_key case
2022-01-18 15:29:52 -08:00
Eric Duong
a71e899605
Yeetcode (#7830)
* remove django query tests

* remove funnel and caching check

* remove ee available var

* remove is_clickhouse_enabled

* remove abstract tests

* change primary db

* missing func

* unnecessary test

* try new e2e ci

* func arg

* remove param

* ci

* remove plugins in docker

* background

* change ur;

* add kafka url

* add step

* update docker

* primary docker file

* mount volumes correctly

* one more

* remove postgres tests

* remove foss

* remove all  is_clickhouse_neabled

* remove irrelelvant test

* remove extra arg

* remove var

* arg

* add foss comment

* add foss comment

* plugin server config

* Update posthog/utils.py

Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>

* migrate commands

* comment

* add clickhouse to pg tests

* change script

* change ordering

* deepsource

* restore foss tests

* test remove KAFKA_ENABLED from CI

* always wait

* up proper resources

* use one conftest

* restore

* remove unnecessary tests

* remove more pg

* log event tests

* fix more tests

* more tests

* type

* fix more tests

* last test

* typing

* account for shared class setup

* temp test cloud

* restore cloud master checkout

* adjust contexts

* backwards

Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>
Co-authored-by: yakkomajuri <yakko.majuri@gmail.com>
2022-01-18 14:32:28 -05:00
Neil Kakkar
7bf0cbbf4f
Secondary experiment metrics backend (#8065)
* wip secondary experiments

* clean up

* tweak initialiser
2022-01-18 16:42:48 +00:00
Karl-Aksel Puulmann
cae9b59779
Fix lifecycle rounding logic (#8057) 2022-01-18 09:52:49 +02:00
Neil Kakkar
aa7a37c5e2
Fix Experimentation bug (#8061) 2022-01-14 13:08:03 +00:00
Paolo D'Amico
2c5d9997ca
Extra sessions cleanup (#8037) 2022-01-13 19:20:47 -06:00
Karl-Aksel Puulmann
39f91a6d82
Drop sessions backend support (#8022) 2022-01-13 11:40:11 -06:00
Karl-Aksel Puulmann
d9bc06b7dd
Speed up lifecycle query (#8021)
* refactor(lifecycle): simplify clickhouse sql logic

This updates the SQL to be comprised of two queries, one for getting
new, returning, and resurrecting periods of activity, one for getting
dormant periods right after periods of activity.

Refers to https://github.com/PostHog/posthog/issues/7382

* refactor(lifecyle): use `ClickhouseEventQuery` to build event query

* format

* Use bounded_person_activity_by_period for both sides of dormant join

* refactor(lifecycle): reduce pdi2 join by one

This means we're now under the current query memory limit for orgs with
around 20m distinct_ids. It does remove some readability though :(

* update snapshot

* Add further comments to query

* Add further comments to query

* Add further comments to query

* Remove dead variables

* Refactor person_query overriding

* Lifecycle refactoring continued

* Update lifecycle tests (except people ones)

* Make lifecycle people endpoint happy

* Remove django lifecycle tests

* Add some edge case tests

* Add missing type

Co-authored-by: Harry Waye <harry@posthog.com>
2022-01-13 16:31:09 +02:00
Karl-Aksel Puulmann
784c7d3b08
Related groups query refactor (#7978)
* Resolve weird SQL formatting issue

* Use a discriminated union for ActorType

* Use standard response types for related groups

* Update typing

* Always filter related actors by group type index

* Update snapshots & typing
2022-01-12 13:15:43 +02:00
Li Yi Yu
21b52dc98a
Add trends option to experiment (#7947)
* add trends option to experiment

(cherry picked from commit be9b8911f9)

* connect trends experiments

* clean up some stuff

* fix test

* results chart display for trends

* fix some issues with trends

* add in loading states and different insight types results wording

* move experiment results into loader

* add progress bar and clean up loading state

* fix experiment insight type bug

* add text beneath percent bar

* typing..

* single filter hide duplicate row button

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2022-01-11 18:50:35 -05:00
Neil Kakkar
bed26c1c8f
reduce precision on trend experiment result tests (#7982) 2022-01-11 13:51:26 +00:00
Rick Marron
a3906d7f1c
Add recordings to trends person modal (#7852)
* add events for recordings to actor response in trends

* order of events doesnt matter in tests

* fix snapshots

* move to recordings objects

* filter to actual recording

* rename include_matched_recordings to include_recordings

* add benchmarks

* remove benchmark

* materialize window and session_id

* add frontend for recordings in person modal

* run prettier

* fix ff query param

* remove session_id + window_id materialization

* cleanup

* fix ts errors

* update snapshots

* fix tests

* rename TrendsPersonQuery -> ClickhouseTrendsActors

* remove flaky snapshot

* clean up should_include_recordings
2022-01-07 14:51:30 -08:00
Neil Kakkar
9f9b5f3ec3
Switch around experiment calculation methods (#7943)
* switch around experiment calculation methods

* cleanup add new comments
2022-01-07 16:02:52 +00:00
Neil Kakkar
982562db6a
Trend multivariate experiments backend (#7924)
* backend for trend experiment results

* cleanup

* address comment, remove flake

* add deps for docker build

* wip

* wip

* wip

* wip

* funnel multivariate experiments

* cleanup

* clean up

* remove numpy from requirements

* make typing happy until Li fixes this properly

* trend multivariate experiments

* clean
2022-01-06 13:44:18 -05:00
Neil Kakkar
b805a7e67f
Funnel multivariate experiment results API (#7922)
* funnel multivariate experiments

* cleanup

* remove numpy from requirements
2022-01-06 15:46:11 +00:00
Eric Duong
34d45e3436
[cohort] insight cohorts (#7569)
* initial working'

* fix tests

* correct tests

* typing

* update snapshot

* add funnel test

* remove unnused

* rest of tests

* function name

* typing

* raise if debugging otherwise send to sentry

* no limit option for cohorts

* remove duplicate

* propogate types correctly

* add param

* cleanup

* update snapshots

* add comment

* change var name

* reverse arg

* use func

* fix tests and types

* add simplify

* move simplification

* adjust checks

* explicit type

* don't init
2022-01-06 10:38:29 -05:00
Neil Kakkar
50bbafa33b
Backend for trend experiment results (#7878)
* backend for trend experiment results

* address comment, remove flake

* sort out dependencies
2022-01-05 17:15:12 +00:00
Karl-Aksel Puulmann
9141996e1c
Proposal: Set time bounds for "all of time" filter (#7849)
* Set time bounds for "all of time" filter

We won't display data points from before 2015 anymore, avoiding
confusion like in https://github.com/PostHog/posthog/issues/7626

* Disable dates before 2015, add tooltip
2022-01-05 14:34:33 +02:00
Karl-Aksel Puulmann
c2bddf09a2
Remove "minute" interval (#7847)
* Remove `minute` interval support from frontend

* Remove minute support from backend, default to hour instead

Also adds tests for interval logic

* Remove now-dead minute support from backend

* revert interval_candidate logic

* Move IntervalMixin to separate file
2022-01-05 13:11:58 +02:00
Karl-Aksel Puulmann
e5ee7b4270
Read from and write to person_distinct_id2 if async migration is done (#7846)
* Run queries against person_distinct_id2 when async migration is done

* Only write to clickhouse_person_unique_id topic if async migration is incomplete

* Update query snapshots

* Update plugin-server

* Adjust caching logic
2022-01-05 13:11:33 +02:00
Karl-Aksel Puulmann
3d8bcdfae0
Kill a dead filter type (#7850) 2021-12-29 08:45:37 +02:00
Karl-Aksel Puulmann
afce8efafb
Add benchmark for funnel query (#7813)
* Add benchmark for funnel query

Testing new sorting order takes the benchmark from 3.5s -> 1.5s \o/

* Update snapshots
2021-12-21 13:09:00 +02:00
Eric Duong
558559c5c7
[temp] increase timeout execution query check for retention (#7794)
* increase timeout execution query check

* snapshot

* pass as arg
2021-12-20 19:07:55 -05:00
Harry Waye
fdb4255303
chore(lifecycle): add comments and CTEs to clickhouse sql (#7773)
* chore(lifecycle): add comments and CTEs to clickhouse sql

It was really big and confusing, but hopefully this clarifies a little
what is going on. As a followup PR I'll be doing some work to make the
query faster :fingerscrossed: but I think worth at least getting this
in, assuming I haven't broken any tests!

* update snapshots

* remove day references

* update snapshots
2021-12-17 17:09:28 +00:00
Harry Waye
83386a5512
fix(retention): add regression test for not_icontains filter (#7748)
* fix(retention): add regression test for not_icontains filter

Previously if using the not_icontains filter, we were trying to double
substitute a query when fetching persons for retention. This adds a
test (and in the next commit a fix) such that we instead apply the
clickhouse substitute only once to each part of the query.

Resolves https://github.com/PostHog/posthog/issues/7747

* avoid double substitution

* Rework solution to not change ActorBaseQuery interface

* Remove unued import

* fix typing
2021-12-17 10:13:38 +00:00
Li Yi Yu
9eb989a473
Experiment create cleanup 2 (#7741)
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-12-16 15:09:47 +00:00
Eric Duong
30b5658fb3
[fix] Make sure ordering is consistent (#7738)
* make sure ordering is consistent

* ordering
2021-12-15 15:25:56 -05:00
Harry Waye
c595976779
fix(retention): fix breakdown people urls (#7642)
* fix(retention): fix breakdown people urls

This change returns people_url for each breakdown cohort in the
response. We also merge the initial and returning queries together,
as this makes it easier to align the people query also.

Note that I'm talking about person_id as opposed to actor_type etc.
but perhaps that can be a followup.

* clean up clickhouse params

* tidy up a little

* remove import

* remove non-breakdown specific code

* make cohort by initial event date a special breakdown case

* keep date for backwards compat

* Remove unused sql

* make test stable

* wip

* Get most of the tests working

* test(retention): remove graph retention test

We no longer need this, we have all the information we need from the
table response for retention, and can construct this on the frontend.

* revert any changes to posthog/queries/retention.py

* revert any changes to ee/clickhouse/models/person.py

* Revert posthog/queries/retention.py to merge-base

* Ensure actor id is a str

* Add type for actor serialiser for type narrowing

* run black

* sort imports

* Remove retention_actors.py

* fix typings

* format

* reverse str type

* sort imports

* rename

* split out functions

* remove deuplicate logic

* working

* fix type

* don't stringify

* fix test

* ordering doesn't matter

* trigger ci

Co-authored-by: eric <eeoneric@gmail.com>
2021-12-15 18:20:56 +00:00
Neil Kakkar
a78dde851b
Experiment Results Detail Page (#7606)
Co-authored-by: Li Yi Yu <li@posthog.com>
2021-12-14 12:37:36 +00:00
Marius Andra
1696ed5950
Update mypy and typed-ast, fail early if db version not in range (#7599)
* error if unsupported db version

* upgrade mypy

* fix various types for mypy

* you can have it in any color you want, as long as it's black

* fix mypy

* Update `kafka-python`

* Format with Black

* Fix mypy after merge

Co-authored-by: Michael Matloka <dev@twixes.com>
2021-12-10 09:29:04 +01:00
Eric Duong
a051f7ee1f
[actors] retention actors (#7495)
* convert to actor form

* change var name

* remove unused imports

* typing issue

* use subquery

* bad import

* groups for general retention query

* actor in period

* update imports

* update test

* remove comment
2021-12-09 10:11:21 -05:00
Neil Kakkar
c32b3a88c8
Experimentation backend (#7492) 2021-12-09 10:24:03 +00:00
Karl-Aksel Puulmann
3a4beda2ad
Speed up person_distinct_id queries for select clients (#7577)
* Create a new way to get distinct id queries thats gated by team_id

* Update most cases to use the new query

* Convert EVENT_JOIN_PERSON_SQL to new query

* Mostly convert GET_DISTINCT_IDS_BY_PERSON_ID_FILTER

* Mostly convert GET_DISTINCT_IDS_BY_PROPERTY_SQL

* Convert GET_PERSON_IDS_BY_FILTER

* Flag benchmarks

* Resolve circular imports

* Update a snapshot test

* Add a test for the new query logic
2021-12-08 15:59:41 +02:00
Eric Duong
cb470c160e
Change timeout to check execution time to 60 seconds (#7562)
* change timeout to 60 seconds

* update snapshots
2021-12-07 18:23:39 +00:00
Tim Glaser
180be54132
Don't capture error messages for trends (#7557) 2021-12-07 16:55:33 +00:00
Harry Waye
b94d02bc10
test(retention): add test for retention breakdown with materialized property (#7505)
* test(retention): add test for retention breakdown with materialized property

* remove unused imports

* Join tables based on breakdowns properties
2021-12-07 15:05:03 +00:00
Eric Duong
110aa9460b
[actor] Funnel correlation actor (#7456)
* match filter var name

* temp

* working tests

* wrong param

* types

* funnel correlation groups working

* typing

* funnel_people -> funnel_actors

* change naming of people -> actors

* update snapshots

* remove dirty change

* typing

* add check and types

* compare with master

* trigger tests
2021-12-06 09:43:58 -05:00
Eric Duong
4e0e69ac91
[actors] Stickiness actor pattern (#7440)
* separate class

* filter typing

* remove repeat

* refactor test

* add limits

* remove ee

* working tests

* working group tests for stickiness

* remove inits

* suggested changes

* typing

* adjust typing

* add correct params

* remove repeat
2021-12-02 11:43:20 -05:00
Harry Waye
79816a9715
feat(retention): add support for multiple breakdown props (#7431)
* test(retention): add http api tests for retention breakdowns

This just adds tests for person and event property breakdowns

* Add helper function for substituting clickhouse sql params

* feat(retention): add support for multiple breakdown props

This just reuses the work done for funnel multiple breakdown values. I
haven't tested this with anything other than person or event properties.
Rather than try to get it working for all the other property types.

The change adds a new `breakdowns` parameter to the retention endpoint,
that is the same as for funnels, e.g. it looks like:

```
{
    ...
    "breakdowns": [{"type": "person", "property": "os"}, ...]
    ...
}
```

The return structure is the same as the non-breakdown version, except we
also include a `breakdown_values` property that is e.g. `["Chrome",
"95"]`, and the `label` attribute for this case would be "Chrome::95".

* fix typing

* update query snapshots

* remove unused imports

* use `self.assertEqual` instead of `assert`

* Remove explicit should_join_persons

* Revert limit by changes, use breakdown_type

* update snapshots

* fix typing

* use json_encode_request_params in retention test requests

* update json_encode_request_params to encode_get_request_params to better reflect purpose

* perf(retention): add benchmark query for retention with breakdown

* no materialize
2021-12-02 13:35:33 +00:00
Karl-Aksel Puulmann
55d5c6faa0
Groups: Show "related groups" under group and person pages. (#7461)
* Use GroupTypeIndex type in BE

* Consistent ordering for group types

* Better BE type for group type index

* Handle non-url safe keys in groups

Previously this would crash due to never decoding the url and not
handling it in the backend

* Allow fetching related groups from the API

* Solve minor type errors

* Add a tooltip

* data-attr for tracking links

* Add related groups onto person page

* Fix an import

* Kill useEffect
2021-12-02 15:21:15 +02:00