0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-30 19:41:46 +01:00
Commit Graph

360 Commits

Author SHA1 Message Date
Neil Kakkar
7c9d67e6ff
feat: Allow creating a basic survey from a flag (#17358) 2023-09-13 13:32:16 +00:00
Marius Andra
8316edc87d
feat(hogvm): save bytecode for actions (#16932) 2023-08-10 11:13:03 +02:00
Paul D'Ambra
32b0552a27
fix: posthog insight tests depend on ee code (#16447)
* fix: posthog insight tests depend on ee code

* Update query snapshots

* Update query snapshots

* Update query snapshots

* fuzzy the bear

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-09 14:06:10 +01:00
Neil Kakkar
b0932b3071
feat(experiments): Bring funnel options to the experiment (#16263) 2023-06-29 16:11:15 +00:00
Paul D'Ambra
5b268df29c
feat: allow verified property definitions (#15937)
Today it annoyed me I could verify an event but not a property

Changes
Adds property definition verification, which was mostly copy-pasta from existing code
2023-06-08 11:52:25 +01:00
Frank Hamand
941dedc7a9
feat: Add support for querying different clickhouse hosts per team (#15622)
* Add support for querying different clickhouse hosts per team

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Run formatting

* Fix typing issues

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Add missing argument type

* Fix bad merge

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-05 10:05:13 +01:00
Michael Matloka
39ad3cd68c
feat(actions): Support "Link target contains/matches regex" (#15535)
* Add `ActionStep.href_matching` + `ActionStep.text_matching`

* Use `href_matching` and `text_matching` in matching

* Show new matching options in the UI

* Update query snapshots

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (2)

* Add support in the API

* Fix `LemonLabel` overflow

* Add support in the toolbar

* Update plugin server tests

* Add Django support

* Update query snapshots

* Add Django test

* Don't italicize text input placeholder

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (1)

* Update query snapshots

* Fix typing

* Update query snapshots

* Fix typing more

* Update query snapshots

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (1)

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-25 16:35:02 -07:00
Marius Andra
bd8d4afa6e
feat(insights): trends hogql volume (#15672) 2023-05-25 16:31:35 +01:00
Michael Matloka
bfae851bfd
test(insights): Clean up User Paths tests + snapshot CH queries (#15631)
* Remove `paths_test_factory` layer

* Snapshot paths API ClickHouse queries

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Fix stability of `session_id in [...]`

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-22 11:21:29 +01:00
Yakko Majuri
226caf186e
chore(tests): run poe tests on v2 rather than v1 (#15511)
* chore(tests): run poe tests on v2 rather than v1

* Update query snapshots

* fix

* fix

* make foss tests work

* properly fix foss tests

* Update query snapshots

* final hogql tests fixed

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-16 19:55:32 +00:00
Michael Matloka
6daabb7b36
perf(persons): Prefilter person property conditions for reduced memory usage (#15507)
* perf: Prefilter rows in person search for reduced memory usage

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Better document `aggregate_by_person_version`

* Snapshot queries in more tests

* Use `DIRECT_ON_PERSONS` instead of new arg

* Explain `PersonPropertiesMode` options

* Streamline the various clauses

* Fix formatting

* Add comments and restore join optimization

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Fix comment typo

* Clarify persons-on-events v2

* Reduce parens

* Disambiguate prepends

* Update query snapshots

* Fix unmatched parens

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-15 17:54:51 +02:00
Yakko Majuri
a61087aa1b
fix(poe-v2): fix funnels with cohort breakdowns (#15457)
* fix(poe-v2): fix funnels with cohort breakdowns

* fix properly

* snapshots

* Update query snapshots

* Update query snapshots

* add also_test_with_person_on_events_v2 decorator to relevant tests

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-10 10:45:38 -03:00
Michael Matloka
3e9fd2e49e
refactor(api): Include team and organization in serializer context (#15294)
* refactor(api): Include `team` and `organization` in serializer context

* Optimize team/organization access

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update posthog/api/routing.py

Co-authored-by: Thomas Obermüller <thomas.obermueller@gmail.com>

* Rename `access_team/organization` to `get_*`

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Thomas Obermüller <thomas.obermueller@gmail.com>
2023-05-01 18:55:24 +02:00
Yakko Majuri
b8b132a847
fix(person-query): query cohorts correctly (#15288)
* fix(person-query): query cohorts correctly

* update

* Update query snapshots

* Update query snapshots

* black

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-01 10:25:06 +01:00
Yakko Majuri
016192c8bd
fix(person-query): don't query persons twice if we don't need to (#15265)
* fix(person-query): don't query persons twice if we don't need to

* Update query snapshots

* black

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-26 16:18:54 -03:00
Eric Duong
c85ed33739
fix(cohorts): number cohort version arguments (#15079)
* add indexed arg

* add test

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-13 12:16:51 -04:00
Eric Duong
be9c9c0119
chore(cohorts): directly filter on version of cohort (#15005)
* directly filter on version of cohort

* fix typing

* Update query snapshots

* Update query snapshots

* Update query snapshots

* type mismatch

* type mismatch

* Update query snapshots

* fix tests

* make sure count is calculating based on latest version

* Update query snapshots

* Update query snapshots

* Update query snapshots

* change count back

* Update query snapshots

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-12 11:58:37 -04:00
Eric Duong
3113d97a7a
fix(cohort-query): select materialized properties through the cohort query (#14794)
* propgate materialized properties through the cohort query

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-21 00:19:33 +01:00
Yakko Majuri
06d90c35f0
refactor(poe): using_person_on_events -> person_on_events_mode (#14792)
* initial team attr, PersonPropertiesMode refactor

* using_person_on_events -> person_on_events_mode

* fix person_properties_mode signatures, format

* add comment to team

* missing refs

* fix enum

* Update ee/clickhouse/queries/funnels/funnel_correlation.py

* Update ee/clickhouse/queries/funnels/funnel_correlation.py

* fix

* fix

* more fixes

* fix circular import

* add settings

* Update query snapshots

* Update query snapshots

* to enum or not to enum

* Update query snapshots

* Update query snapshots

* Update posthog/queries/trends/trends_event_query_base.py

* Update posthog/test/test_team.py

* Update posthog/queries/foss_cohort_query.py

* Update posthog/queries/foss_cohort_query.py

* Update posthog/queries/foss_cohort_query.py

* Update query snapshots

* Update query snapshots

* more and more fixes

* black

* code quality

* Update query snapshots

* Update query snapshots

* Update posthog/queries/session_recordings/session_recording_list.py

Co-authored-by: Tiina Turban <tiina303@gmail.com>

* Update posthog/queries/paths/paths_event_query.py

Co-authored-by: Tiina Turban <tiina303@gmail.com>

* fixes

* argh

* Update query snapshots

* fix test

* fix hogql

* Update posthog/queries/stickiness/stickiness_event_query.py

* fix breakdown

* Update query snapshots

* Update query snapshots

* Update query snapshots

* fix another test

* update base num queries due to extra instance config lookup for poe v2

* black

* sort

* assert num queries test

* Revert "assert num queries test"

This reverts commit c48c7fccf7.

* revert v2 enabled flag as theres no need for it now

* Update query snapshots

* Revert "update base num queries due to extra instance config lookup for poe v2"

This reverts commit 644e9b2658.

* Update query snapshots

* come on its friday lets get greeeeen

* the saga continues

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tiina Turban <tiina303@gmail.com>
2023-03-20 12:03:36 -03:00
Marius Andra
00f98214a6
feat(hogql): custom virtual database per team (#14740) 2023-03-17 10:49:17 +01:00
Tomás Farías Santana
315f47f57d
feat: person-overrides writes with Mapping to Persons (#14513)
* feat(person-override): Add a helper model to indirectly reference person overrides

This allows us to use an exclusion constraint on the person overrides table instead of directly using a FK on posthog_person.

* test(person-overrides): Update tests to match new constraint

* fix(migration): Add drop extension query to reverse migration

* fix(migration): Use correct table name

* refactor(person-overrides): Make team a regular bigint field without FK

* refactor(person-overrides): Rename Helper model to Mapping

* feat(person-override): Add a helper model to indirectly reference person overrides

This allows us to use an exclusion constraint on the person overrides table instead of directly using a FK on posthog_person.

* wip: add test for concurrent updates to posthog_personoverride table

* refactor

* Update snapshots

* fix(isort): Correctly sort imports

* fix(ee-cohort-test): Delete person after creating it

* fix: person constraint in person overrides table (#14319)

* nits

* fix migration tests

* chore(migration): Bump migration number to 0302

* Update snapshots

* feat: person-overrides writes

* test(person-overrides): Add concurrent tests to person-overrides model

* feat(person-merge): Update merge to use new helper table

* fix(tests): Pass poEEmbraceJoin to updatePersonState in test

* fix(person-state): Format person-overrides message for ClickHouse

* test(api): Add function to reload dictionary for person overrides

* fix: poe final test failure

* refactor(person-state): Make failed attempts a class variable to

This allows us to mock it during testing as some tests require
immediate failures.

* fix(postgres-utils): Apply some magic changes lost to time

* fix(person-state): Join with helper table to return UUIDs

* fix(person-state): Use single quotes for UUID queries

* test(person-overrides): Skip test that doesn't work without a merge command

* test(person-state): Add a very complicated query to get UUIDs in a test

* test(person-state): Try waiting longer, this is flaky

* fix(migrations): Remove unused migration

* fix(person): Undo unneeded person model changes

* chore: Clean-up artifacts from rebase on model branch

* refactor(person-state): Rename mergeAttempts and don't read from ENV

* chore: Better clarify oldest_event usage in comment

Co-authored-by: Tiina Turban <tiina303@gmail.com>

* refactor(person-state): Update version in queries

* fix(person-state): Use new mapping model instead of helper

* fix(migrations): Re-add constraint deleted on field drop

* revert: Re-enable test that was skipped

Test was originally skipped due to missing a $merge command, but now
$merge_dangerously is available, so the test should pass.

* test: Attempt to refresh dictionary in test

* Update query snapshots

* Update query snapshots

* test: Expect dictionaries to be refreshed before resuming test

* fix(test): Use alias property for $merge_dangerously in test

* fix(test): Expect any string like in all other tests

* test: Fix order of events to determine merged persons

* chore: Update comment regarding overrides mapping query

* chore: Remove out of date comment

* test: Set number of retries to 0 when updating persons

* test: Delete comment

* test: Assert clickhouse state after identify

* chore: Move comment

* chore: Delete TODO regarding oldest_event updates

* test: Assert events are still processed if merge fails

* test: Assert properties are processed if merge fails

* test: Don't expect to throw when failing merges

* fix: Indent RETURNING query clause

Co-authored-by: Harry Waye <harry@posthog.com>

* chore: Remove out of date comment

Co-authored-by: Tiina Turban <tiina303@gmail.com>

* test: Resume merges after test suite

* test: Run processPersonStep tests for both poEEmbraceJoin modes

---------

Co-authored-by: Harry Waye <harry@posthog.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tiina Turban <tiina303@gmail.com>
2023-03-13 11:52:08 +01:00
Paul D'Ambra
d03a1bd1c2
feat: allow editing property type when free (#14629)
* allow edit of property type in UI for all users

* allow free users to update property type

* Update query snapshots

* Update UI snapshots for `chromium` (1)

* extra test

* Update query snapshots

* Update UI snapshots for `chromium` (1)

* add an isProperty and use that

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-08 17:05:52 +00:00
Yakko Majuri
2318a4dc7e
feat(sampling): add sampling support to stickiness (#14512)
* feat(sampling): add sampling support to stickiness

* Update UI snapshots for `chromium` (1)

* Update query snapshots

* Update query snapshots

* update filters test

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-08 09:34:54 -03:00
Tiina Turban
c6b70c6c38
revert: "fix(person-overrides): add constraints to catch race conditions" (#14445) 2023-02-28 16:48:52 +01:00
Harry Waye
1535170b0a
fix(person-overrides): add constraints to catch race conditions (#14277)
Co-authored-by: Tomás Farías Santana <tomas@tomasfarias.dev>
Co-authored-by: Tiina Turban <tiina303@gmail.com>
2023-02-28 14:30:40 +01:00
Neil Kakkar
8d05dee1aa
feat(cohorts): Remove postgres calculations for flags (#14272) 2023-02-28 13:03:48 +00:00
Karl-Aksel Puulmann
983b071b25
feat(query-performance): Create minmax indexes for materialized columns (#14226)
* feat(perf): Add minmax indexes for materialized columns

* Add more cleanup code

* Make migration not required on boot

* Update snapshots

* alter_sync

* Try some other approach for tests

* Try not creating minmax indexes in tests

* Remove aged test

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-02-17 11:50:32 +02:00
Marius Andra
5b4a3bffb4
feat(data-exploration): HogQL filters again (#13830) 2023-01-31 14:57:10 +01:00
Yakko Majuri
7bd5574861
fix(queries): explicitly prepend table person_id comes from in cohort queries with pdi joins (#13781)
* fix(queries): explicitly prepend table person_id comes from in cohort queries with pdi joins

* Update snapshots

* another test

* Update snapshots

* Update snapshots

* Update snapshots

* another try

* fixes

* Update snapshots

* trigger new test run

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-20 11:25:18 -03:00
Neil Kakkar
faf6d1e7ea
fix(cohorts): Handle negations for behavioural filters (#13478) 2022-12-23 12:14:21 +00:00
Neil Kakkar
4d386f2445
fix(cohorts): Handle negated cohorts everywhere (#13468) 2022-12-22 16:52:12 +00:00
Michael Matloka
cd1eda0bc4
refactor: Make persons- and groups-on-events var names accurate (#13266) 2022-12-12 15:08:31 +02:00
Eric Duong
76500b87c4
fix: use version instead of _timestamp (#12739)
* use version instead of _timestamp

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-14 10:31:15 -05:00
Karl-Aksel Puulmann
6940882dcb
feat(person-on-events): track groups-on-events separately using instance setting (#12601)
* feat(person-on-events): track groups-on-events separately using instance setting

We want to release persons-on-events but we found groups-related issues
in incoming data that need to be fixed to release the feature for
groups.

Instead of delaying the release further, this change allows us to turn
persons-on-events on only for persons and handle groups separately

* Update CI

* fix ee/clickhouse/models/test/test_property.py tests

* add GROUPS_JOIN_QUERY if needed for breakdowns

* Excluse a breakdown test

* Skip some funnels breakdown tests with mat group columns

* Skip groups-related breakdown tests

* Skip a group property test

* Undo changes to breakdown_props.py

* Update test_property.py

* Update snapshots

* groups_on_events off by default

* Update snapshots

* Remove override_instance_config

* Add a docstring

* Make setting editable

* Fix breakdowns issue

* Update snapshots

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-07 09:24:29 +02:00
Ben White
f529f14c89
feat: Correctly sync available features (#12538) 2022-11-03 09:22:41 +00:00
Eric Duong
ef17c83089
feat(feature-flags): Auto rollback beta (#12485)
* api

* add performed_rollback

* add celery task and tests

* rollback test

* remove first and last

* add sentry stuff

* basic auto rollback UI

* fix errors

* testable

* add errors rollback ui

* clean up sentry keys

* clean up some ui stuff

* add some sentry context

* update ui

* fix celery

* Update posthog/api/feature_flag.py

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>

* add sentry instructions when not enabled

* add sentry context

* merge migration

* remove unnecessary field right now and update UI to 7 day trailing average

* fix migration

* fix frontend type

* activity

* reset migratioN'

* remove default

* update test

* add feature flag

* add view for conditions and make sure insight loads

* Update snapshots

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
Co-authored-by: Li Yi Yu <li@posthog.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-02 21:15:47 -04:00
Paul D'Ambra
c964d61ee5
chore: add missing test for URL query param matching in actions (#12527)
* fix: include query params in action url matching

* chore: add test for url query params in action matching

* Update snapshots

* don't care about ordering

* remove unexpected snapshot update

* remove unexpected snapshot update

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-11-01 16:17:25 +00:00
Tiina Turban
d4b4921e84
fix: Remove some old distinct_id table usage (#12300) 2022-10-27 14:02:29 +02:00
Ben White
d25ecd29d7
fix: Moved usage report out of ee (#12414) 2022-10-25 12:56:20 +02:00
Karl-Aksel Puulmann
b33347205c
fix: Revert "chore(tests): add pytest-randomly plugin to randomize test run order" (#12335)
* Revert "chore(tests): add pytest-randomly plugin to randomize test run order (#12307)"

This reverts commit 313de83cb8.

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-19 13:30:16 +03:00
zackelan
313de83cb8
chore(tests): add pytest-randomly plugin to randomize test run order (#12307)
* chore(tests): add pytest-randomly plugin to randomize test run order

* Update snapshots

* Update snapshots

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-18 09:34:34 -07:00
Michael Matloka
5d2ad6c7bb
chore(deps): Update black to 22.8.0 (#11596)
* chore(deps): Update `black` to `22.8.0`

* Format
2022-09-05 14:38:54 +02:00
Eric Duong
92ddf4072b
feat: materialize person and groups on events (#11363) 2022-08-30 12:31:32 +01:00
Eric Duong
b34e307082
fix: querying by adding extra clause to do greedy filtering (#11481)
* fix querying by adding extra clause to do greedy filtering

* Update snapshots

* Update snapshots

* Update snapshots

* select clause

* add extra checK'

* remove unnecessary args

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* adjust table naming

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* use subq pattern

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* conditional

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

Co-authored-by: EDsCODE <EDsCODE@users.noreply.github.com>
Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
2022-08-25 16:13:03 -04:00
Eric Duong
99db479c90
fix(cohort): make cohort recalculation simpler (#11335)
* fix: don't subquery when unnecessary

* fix test

* try replacing

* try simpler query

* replace for now

* use single query remove subquery changes

* remove test

* remove props

* fix return

* Update snapshots

* Update snapshots

* refactor

* Update snapshots

* Update snapshots

* fix unwrapping

* Update snapshots

* Update snapshots

* fix false condition

* Update snapshots

* Update snapshots

* restore _timestamp

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* update snapshot

* add snapshot test

* remove replace

* Update snapshots

Co-authored-by: EDsCODE <EDsCODE@users.noreply.github.com>
Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
2022-08-23 22:14:41 -04:00
Rick Marron
9f06e750cb
feat(session-analysis): breakdown by session duration (#10522)
* breakdown by session duration

* typings

* behind ff

* handle exact operator

* feature flag works

* add tests

* fix test for exact operator

* better test

* remove log

* Update snapshots

* add test for unique session breakdown

Co-authored-by: rcmarron <rcmarron@users.noreply.github.com>
2022-06-30 08:47:34 -07:00
Neil Kakkar
0ff4d7ed5d
fix(property-filters): Make value optional on the backend (#10560) 2022-06-29 16:28:48 +00:00
Guido Iaquinti
c51b08b946
fix(misc): remove variable allocation when not needed (part #3) (#10508)
* fix(misc): remove variable allocation when not needed (part #3)

* fix(misc): remove variable allocation when not needed (part #3)
2022-06-27 19:26:09 +02:00
Guido Iaquinti
698baf61db
fix(misc): remove variable allocation when not needed (part #2) (#10502) 2022-06-27 12:21:01 +02:00
Ben White
1484b846ce
feat(subscriptions): Add Slack Subscriptions (#10388)
* Added slack configuration options
* Added slack selection UI
2022-06-24 10:29:45 +02:00