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

373 Commits

Author SHA1 Message Date
Marius Andra
96a596274a
fix(insights): breakdown with special properties (#19597) 2024-01-04 16:35:33 +01:00
Michael Matloka
1792ce7f0d
fix(permissioning): Fix restricted projects being visible (#19218)
* Add tests to diagnose the issue

* Add THE test

* Implement the fix

* Update query snapshots

* Update query snapshots

* Ignore mypy's ignorance

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-12-12 13:52:39 +01:00
Raquel Smith
4c87ff9a33
feat: add membership level to user / person data (#18332)
* add member level to user analytics metadata

* send event when level changed

* fix mypy

* remove org id from properties

* Update query snapshots

* Update query snapshots

* fix tests

* fix tests

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-21 14:58:33 -08:00
Neil Kakkar
f34d89ca1b
fix(flags): Alter constraints to not delete flags and experiments (#18514) 2023-11-21 13:44:16 +00:00
Neil Kakkar
aa6bac9c84
fix(flags): Do the expected for numeric comparisons - FINAL FINAL edition (#18443) 2023-11-08 10:14:01 +00:00
Neil Kakkar
0bdbd253ed
revert: "revert: "revert: "fix(flags): Do the expected for numeric comparisons""" (#18441)
Revert "revert: "revert: "fix(flags): Do the expected for numeric comparisons"" (#18415)"

This reverts commit 7148f03130.
2023-11-07 12:27:26 +00:00
Neil Kakkar
7148f03130
revert: "revert: "fix(flags): Do the expected for numeric comparisons"" (#18415) 2023-11-07 12:07:11 +00:00
Neil Kakkar
30789e6e86
revert: "fix(flags): Do the expected for numeric comparisons" (#18413)
Revert "fix(flags): Do the expected for numeric comparisons (#18359)"

This reverts commit 3847340bb3.
2023-11-06 13:18:49 +00:00
Neil Kakkar
3847340bb3
fix(flags): Do the expected for numeric comparisons (#18359) 2023-11-06 12:55:16 +00:00
Ellie Huxtable
0257b2bcb9
chore: Use ruff formatter (#18207)
* Use ruff formatter

Ruff is now also a formatter! And it runs in a fraction of a second
across our whole codebase vs "I waited more than 30s and cancelled it
because I got bored".

* Config and command -> ruff

* Run 'ruff format .'

* Update query snapshots

* Run 'ruff format .'

* Fix format after commit hook

* Update query snapshots

* Fix type error - ignore comment moved

* Exclude hogql grammar from formatting and reverted grammar

* Run format

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tom Owers <tom@paace.co>
2023-10-31 13:41:57 +00:00
Tom Owers
5513be7731
chore: upgraded Ruff linter (#18188)
* Upgraded Ruff linter

* Formatted whole codebase with new ruff rules

* Revert import removal

* Fixed mypi issues or added ignores

* Fixed schema formatting

* Fixed hogvm failing tests

* Remove duplicate key in list
2023-10-26 12:38:15 +02:00
timgl
476d102411
perf(Persons): Use optimize_aggregation_in_order for person queries (#17817)
* perf(Persons): Use optimize_aggregation_in_order for person queries

* 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-10-05 18:47:06 +01:00
Paul D'Ambra
a87b247cd3
feat: step towards feature folders for replay backend (#17484)
* feat: step towards feature folders for replay backend

* Update query snapshots

* Update query snapshots

* that got mypy very excited

* fix

* fix

* fix

* dnagling snapshot

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-18 13:35:59 +01:00
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