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

1003 Commits

Author SHA1 Message Date
Yakko Majuri
5c0054c238
Dead letter queue initial metrics dashboard (#8347)
* dead letter queue metrics dahsboard

* basic dlq metrics dashboard redo (#8396)

* update single value ui

* address review

* remove useless comment
2022-02-03 14:56:18 -05:00
Neil Kakkar
b45f4267a4
Improve tooltip response, add FF at the end (#8417)
* improve tooltip response, add FF at the end

* add experiments test

* add confusing tooltip

* remove FF banner for now

* Update frontend/src/scenes/experiments/Experiment.tsx

* Update frontend/src/scenes/experiments/experimentLogic.tsx

Co-authored-by: Joe Martin <84011561+joethreepwood@users.noreply.github.com>
2022-02-03 14:34:03 -05:00
Harry Waye
3604c72e3a
feat(k8s): add kafka connection status to health check endpoint (#8258)
* feat(k8s): add kafka connection status to health check endpoint

This change adds a kafka check to the existing health check that uses
the underlying kafka python libs `bootstrap_connected` to check that we
are connected to kafka.

To accommodate the extra check in the response, I have updated to return
a JSON response with a lookup of `"check_name"` to it's status. We
return if any of the checks return `False`.

Something I didn't do was allow for checking each check in isolation,
e.g. we could expose for instance just the kafka_connected check at
`/_health/kafka`

* sort imports

* Remove unused requests arg, maybe useful later but not now.

* Add readyz and livez endpoint

* Add some docs

* link to k8s

* be specific about postgres

* some tests don't need postgres

* kubernetes -> process orchestration system

* update how we check kafka connection

* remove return
2022-02-03 15:15:48 +00:00
Neil Kakkar
c3b23d7981
Better visibility into significance results (#8403)
* Better visibility into significance results

* resolve open question, choose significance based on control
2022-02-03 11:01:09 +00:00
Michael Matloka
8b5ecc9f6f
Dashboard permissions base (#8394)
* Add models for dashboard permissions

* Update migrations

* Add basic API capabilities

* Add basic dashboard perms UI

* Update test_insight.ambr

* Fix typing

* Split RestrictionLevel into RestrictionLevel&PrivilegeLevel for clarity

* Update migrations post-merge
2022-02-02 17:16:35 +01:00
Alex Gyujin Kim
c12179b5ba
Give actions descriptions (#8272)
* add description to action

* update tests

* no limit to description and use pageheader

* add ee_action

* add description as global relationship:

* fix tests

* revert to using descriptions

* revert to using descriptions

* allow description to be null

* fix tests

* persist mode

* fix e2e

* Address review points, clean up some margins

* Clean up the way editing state is determined

* Restore default description value and improve typing

* Fix typing better

* Update sql.ts

Co-authored-by: Michael Matloka <dev@twixes.com>
2022-02-02 15:50:28 +01:00
Harry Waye
2baddd59fb
perf(events): limit select clause when getting ingest requirements (#8381)
* perf(events): limit select clause when getting ingest requirements

Previously we were pulling in all table columns for every event posted
to the `/e/` column. We actually only need the id, such that we can
associate an event with a `Team`, and a setting which says if we should
anonymize ip addresses.

There are still other optimizations to make, and some of the code paths
do several queries to the database, but I have limited the changes here
to just the most straight forward of them.

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

* Add a little comment

* Filter by team_id

* Avoid changing error messages

* Update import get_team -> get_ingest_context

* Fix typing

* fix types

* fix mocking

* fix type

* Rename InjestContext -> EventIngestContext

* Update ingestion context fetch methods

* Further rename fetch functions
2022-02-02 13:46:44 +00:00
Yakko Majuri
5ad87d18b1
add test for async migrations not being required on fresh installs (#8323)
* add test for async migrations not being required on fresh installs

* fix

* fix testing

* Update .flake8

* fix test?

* run tests

* fix test for good

* fixes

* attempt

* remove ee tag
2022-02-02 07:47:49 -05:00
Yakko Majuri
e1499b3a9e
system status number formatting (#8367)
* system status number formatting

* Update ee/clickhouse/system_status.py

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

* simplifications

* simplify more

* simplify

Co-authored-by: Tiina Turban <tiina303@gmail.com>
2022-02-02 07:41:49 -05:00
Paul D'Ambra
5db28bbec2
Allows date equality checking in property filters (#8352)
* allow datepicker in date only mode

* allow exact date matching in property filters

* marks is_date_after as a date operator

* the date picker needs to work with null/undefined as well as string

* remove unused relative date parsing and fix date only is_date_exact property filters

* default to dates without times matching exactly

* make datetime filters by second work on date values that include milliseconds

* fix TS error

* correct insight url cypress test

* replace useMemo with useEffect

* be more specific in regex date match

* spacing under the quick choices

* when checking after a date for a date only filter check against that day at 23:59:59

* remove redundant text

* add test case and fix is_date_after query
2022-02-02 12:29:59 +01:00
Karl-Aksel Puulmann
2e6aae702d
Allow disabling protobuf with CLICKHOUSE_DISABLE_EXTERNAL_SCHEMAS env (#8333)
* Allow disabling protobuf with CLICKHOUSE_DISABLE_EXTERNAL_SCHEMAS env var

This makes integrating with external clickhouse providers (like altinity
cloud) much easier as users don't need to use undocumented APIs to
upload the schemas.

* Keep underscores in protobuf. This allows using this payload for json ingestion

* Timestamp format
2022-02-02 00:30:11 +02:00
Eric Duong
15f5f1754d
cleanup(cohort) (#8371)
* move cohort viewset

* remove unused
2022-02-01 14:58:20 -05:00
Eric Duong
a7e792c3fc
cleanup(persons) (#8365)
* combine viewsets

* move tests

* import correctly

* change naming

* add mixin
2022-02-01 11:16:49 -05:00
Eric Duong
097a95da98
yeet(events): move event viewset (#8177)
* move event viewsets

* restore original serializer for now

* restore legacy
2022-02-01 11:00:10 -05:00
Eric Duong
5f4dfb906b
cleanup(element) (#8370)
* move element viewset

* typing

* make sure tests run

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2022-02-01 10:40:59 -05:00
Paul D'Ambra
5f7d3c566d
Deprecates property_type_format (#8292)
* remove property_type_format concept

* remove nulls from tests

* deprecate not remove (and see what tests fail)

* plugin server tests care about property_type_format

* fix tests
2022-02-01 14:08:55 +00:00
Yakko Majuri
09e37663f4
Add dead letter queue metrics to system status (#8294)
* add dead letter queue metrics to system status

* today -> last 24h

* fix test
2022-01-31 15:10:10 -03:00
Neil Kakkar
da846464e4
Secondary Experiment Metrics frontend (#8115)
* wip secondary experiments

* clean up

* tweak initialiser

* Add basic frontend for secondary metrics

* small style updates

* prettier

* dayjs pleaseee

* type check

* feature flag it

* prettier

* typescript

Co-authored-by: Li Yi Yu <li@posthog.com>
2022-01-31 16:50:12 +00:00
Karl-Aksel Puulmann
53998c45cd
Allow overriding kafka host for clickhouse via KAFKA_URL_CLICKHOUSE env var (#8332)
* Allow overriding kafka host for clickhouse via KAFKA_URL_CLICKHOUSE env var

This is needed when using an external clickhouse which doesn't have the
same access to kafka as in-cluster traffic does.

Note that long-term we might need to also provide better auth mechanisms
here as well.

* Rename env variable
2022-01-31 10:21:08 +02:00
Karl-Aksel Puulmann
cb6839fe21
Revert "Adds reserved properties for filtering property definitions (#8291)" (#8340)
This reverts commit a6ff568d11.
2022-01-28 15:51:54 +02:00
Paul D'Ambra
a6ff568d11
Adds reserved properties for filtering property definitions (#8291)
* wip

* wip

* wip

* can filter events by reserved words - distinct_id, created_at, and timestamp - in the backend

* add reserved properties when showing property definitions

* capitalise name of property

* properties not reserved words

* get cypress working and make search work with reserved properties

* update event/values endpoint to use property_string_expr and so work with reserved properties

* remove created at from reserved words

* test fix

* fix test

* loosen cypress assertion

* exclude specific properties from the taxonomic property filter

* remove FE property definition fangling

* exclude $time and $timestamp property definitions from the backend

* add reserved properties in the API not the FE using a CTE

* use SQL comments in SQL strings

* remove mypy error

* fix enterprise property definitions

* fix tests and improve comment

* exclude materialised column rows with no values when getting event property definitions

* fix cypress test setup

* clean up dead code

* un-remove some not actually dead code

* correct cypress assertion

* try and fix a cypress test
2022-01-28 12:19:17 +00:00
Tim Glaser
7a3091150f
Warn when dashboard is available (#8262)
* Don't allow user to set current team that they don't have access to

* Warn when dashboard is available in different project

* update exceptionshog

* fix tests

* fix failing

* fix typing

* tests
2022-01-27 18:49:29 +00:00
Eric Duong
b25ab232f9
yeet(insights): move insight viewset (#8173)
* remove insights and move tests

* update snapshots

* stickiness snapshots

* bring back ee available for ee specific features

* remove endpoint from posthog insightviewset

* fix snapshot

* remove repeat
2022-01-26 17:28:40 -05:00
Tim Glaser
0b4af4413e
Don't allow user to set current team that they don't have access to (#8256)
* Don't allow user to set current team that they don't have access to

* fix tests

* fix failing

* Fix and add test for teams from current organization
2022-01-26 16:35:49 +00:00
Michael Matloka
eb0d289e97
Insight last modification shown (#8273)
* Add Insight `last_modified_at` and `last_modified_by`

* Add "Last modified" to InsightCard

* Use `updated_at` as default `last_modified_at`

* Add `test_created_updated_and_last_modified`

* Fix comments style

* Fix `InsightMeta__modification` alignment

* Run `black`

* Run `black`

* Add `LastModified` to insight page

* Tune `LastModified` margin

* Update test_clickhouse_insights.ambr
2022-01-26 12:04:14 +01:00
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
Eric Duong
cdf4164c97
Remove paths viewset (#8175)
* remove-paths-viewset

* don't try to import
2022-01-25 11:14:48 -05:00
Paul D'Ambra
5d2a041851
Make backend not care about DateTime format (#8230)
* switch backend datetime filtering so it does not need property types and formats

* stop populating and using the property_type_format field (without yet removing it)
2022-01-25 10:01:08 +01:00
Li Yi Yu
bd1f20c30f
Archive and delete experiments (#8129)
* add archive experiment button and table for archived experiments and non-archived

(cherry picked from commit 7323835705)

* return response instead of reloading experiment again

* delete button

* prettier

* python black

* typescript fix

* delete without undo and fix get results

* experiments backend test

* fix backend test

* prettier

* fix get queryset archived experiments request

* fixes

* prettier

* typescript fixes
2022-01-24 14:11:15 -05: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
Neil Kakkar
840781871b
Update experiments model (#8189)
* update experiments model

* fix typings

* fix bugs

* rename latest
2022-01-24 14:59:14 +00:00
Paolo D'Amico
96a64f9fbb
Skip test on multi-tenancy (#8226) 2022-01-24 14:04:56 +00:00
Karl-Aksel Puulmann
fda07665e5
Update test snapshots and test code (#8220) 2022-01-24 14:18:34 +02:00
Tiina Turban
d5fce14cea
async migrations separate errors table (#8152) 2022-01-21 19:54:47 +01:00
Paolo D'Amico
7fa779bbc6
Experimentation API pay gate (#8172) 2022-01-21 09:55:22 -06:00
Paolo D'Amico
df49e7ae77
Experimentation pay gate (#8169) 2022-01-21 09:54:48 -06: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
Karl-Aksel Puulmann
153b58d9f9
Use structlog over logging (#8155) 2022-01-20 10:48:06 +02: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
Eric Duong
6b6de16826
fix(cohorts): don't substitute params (#8124)
* don't substitute

* add test
2022-01-19 09:28:44 -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
Eric Duong
dc0fa2dc6d
fix(retention): actor bug (#8079)
* add team param

* move test

* restore
2022-01-18 12:05:47 -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
Alex Gyujin Kim
204ca1bc92
Add verified properties to event definitions (#8081)
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2022-01-18 08:38:55 -06:00
Karl-Aksel Puulmann
cae9b59779
Fix lifecycle rounding logic (#8057) 2022-01-18 09:52:49 +02:00
Paolo D'Amico
eafa0225ce
More pre-instrumentation for collaboration (#8049) 2022-01-17 13:23:45 -08:00
Paul D'Ambra
ac72b61eb0
Auto detect property types when ingesting events (#7923)
* stores numeric type for property definitions

* writes property definition type for strings

* can write dates for simple string cases as property definition type

* simplify property definition types

* can detect unix timestamps

* rewmove a little more from the test duplication

* some more timestamp thinking

* clearer comment

* rename refactor in tests

* more test correction

* address test failure

* another test fix

* property type as enum

* simplify type detection

* apply typing suggestion

* allow property definition type and format to be set if property is present but they are null

* add more date types for property_type_formats

* add more datetime formats that the backend can accept and filter events with

* delete conflicting migration

* add migration for backend datetime formats

* plugin server can auto detect all the types the backend knows about. And the tests are collapsed from twenty five almost identical tests to two different parameterised blocks

* iso 8601 strings can have fractional seconds

* add link to the RFC 822 regex pattern

* capitalise SQL

* capitalise the SQL the mock looks for too

* remove the under-eager cache change that allowed updating existing property definitions

* convert property type formats to enum

* fix test

* try detecting a property type for existing property definitions but don't keep retrying

* use symbols to make cache state clearer

* fix idiocy

* speculative LRU cache usage with measurement

* tag the statsd guages instead of having team id in the name

* don't pre-emptively optimise the cache

* rename migration

* remove spaces from query strings

* separate property definition code from the team manager

* a little tidying

* correct type definition

* correct test params setup
2022-01-14 15:48:20 +00: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
Paul D'Ambra
1974cbb3d2
Remove hard-coded DateTime knowledge from Property Filter UI (#7892)
* wip

* display known unix timestamps as date strings in property filter select box

* show selected unix timestamp property as a datetime string in the property filter

* remove console.log

* update test to construct property definition correctly

* correct another test

* dates have different operators

* format property filter values for display in Select boxes and the PropertyValue component

* fix typescript error

* it _is_ a type, I don't need to say it is

* don't have before and after for unmatched types of operators

* separate the current applicable operators and the operator to display mapping, and add cypress tests for before and after operator visibility

* correct cypress test

* remove unused method

* remove dangling comment

* why does test fail in CI but not locally

* why does test fail in CI but not locally

* why does test fail in CI but not locally

* log values of operator options, why does this fail in CI but not locally

* why does test fail in CI but not locally

* intercept more decide calls to try and set feature flags from cypress test

* why does test fail in CI but not locally

* Remove cypress install

* add a readme for how to test feature flags so it isn't lost if there are no tests currently testing feature flags
2022-01-13 20:10:39 +00: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
Marius Andra
066c172c81
Case insensitive property searching (#8020)
* case insensitive searching

* select direct match, even if case is different
2022-01-13 15:16:28 +01:00
Li Yi Yu
c1cd3280e4
Fix experimentation updating (#7986)
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2022-01-13 13:53:43 +00:00
Karl-Aksel Puulmann
d459dc4ca8
Benchmarks: trends breakdown and lifecycle with filtering (#8018)
* Add benchmarks for trends breakdown

* Add lifecycle benchmarks
2022-01-13 11:53:00 +02:00
Eric Duong
836d5609f3
Fix element chain on autocapture (#7992) 2022-01-12 13:38:57 -06: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
Karl-Aksel Puulmann
1ccb45f678
Allow renaming group types (#7974)
* Migration to add name_singular and name_plural to groups

* Allow modifying group type names

* Use name_plural and name_singular through the app

* Update tab names

* fixup

* Update snapshots
2022-01-12 09:31:43 +00: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
83c1e4c41c
Ensure deleting an experiment deletes the associated FF (#7981)
* ensure deleting an experiment deletes the associated FF

* address comment

* use FF serializer

* ensure FF variants are distributed correctly
2022-01-11 16:39:24 +00:00
Yakko Majuri
7479f141b3
fix tests (#7984) 2022-01-11 12:18:00 -03:00
Yakko Majuri
fb22989e02
show last event ingested timestamp in system status (#7979)
* show last event ingested timestamp in system status

* fix tests
2022-01-11 14:17:10 +00:00
Neil Kakkar
bed26c1c8f
reduce precision on trend experiment result tests (#7982) 2022-01-11 13:51:26 +00:00
Michael Matloka
54716379c3
Clarify PostHog person deletion quirk (#7977)
* Don't delete events from Postgres since we don't do it on CH

* Update frontend for accuracy

* Update test_person.py

* Don't display "ID-less user" as a link
2022-01-11 13:26:46 +00:00
Yakko Majuri
10d8c59146
auto complete non required async migrations at migrate step (#7942) 2022-01-10 15:34:07 -03:00
Guido Iaquinti
b7235282e9
Remove references to 'CLICKHOUSE_INITIAL_MIGRATIONS' (#7960) 2022-01-10 12:14:50 +02: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
Paolo D'Amico
7ecdade38d
Remove recording retention policy for Postgres (#7925) 2022-01-06 11:12:21 -06: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
Paolo D'Amico
a714528c3f
Exception when kafka is down (#7905) 2022-01-06 07:21:37 -06: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
Li Yi Yu
5d12386970
Experiments multivariate support FE (#7865)
* add experiment group variant options

* move integration instructions to view page

* redo experiment group multivariate flags frontend

* spacing

* typing

* move variants under parameters, allow variant deletion, and disable editing for control group variant

* rename control_group

* fix start_date keyerror

* update text

* temporary change

* fix variants limit

* fix start_date conditional again
2022-01-05 11:27:28 -05: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
2b58fc3f79
Proposal: Fix performance issues caused by actions page (#7855)
* Remove flipsort related logic

* Only load events from the last 6 months in events table

* Disable customization in actions tab

* Rename prop

* Dont poll events in actions page

* Show a different header above events table in actions page

* Update tests with frozen time

* Decouple months of actions tab with other months

* Calculate action count over 3 months

* Update tests
2022-01-05 13:57:20 +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
2139a6e204
Add measure.sh helper script to repo (#7877) 2022-01-05 12:46:08 +02:00
Neil Kakkar
8d7614bc7c
Multivariate Experiment backend creation flow (#7884)
* enable creating multivariate experiments
2022-01-04 15:55:58 +00:00
Harry Waye
a819069128
chore(pdi): add data migration for pdi to pdi2 (#7792)
* chore(pdi): add data migration for pdi to pdi2

This adds an async migration to copy the latest non-deleted
`(team_id, person_id, distinct_id)` tuples from `pdi` to `pdi2`.

Note that this has already be performed for tead_id = 2 on posthog,
cloud so we ensure we're maintaining parity with however this
migration was performed. I've done this by running:

```
SELECT * FROM <old_query>
FULL JOIN <new_query> new
    ON old.distinct_id = new.distinct_id
WHERE old.person_id <> new.person_id
```

specifically for team_id = 2.

* Rename migration

* Skip 0003_fill_person_distinct_id2 on fresh installs

* Clarify version requirements

* Run async migrations using a while-loop instead of tail recursion

Python has a stack limit of 1000, which we might easily run into for
0003 migration

* Use built-in progress tracking

* Make description fit into database 400 char limit

* Add correctness test for new async migration

* Migrate person_distinct_id2 team-by-team

* Remove dead code

* Update migration notes

* Fix foss tests

Co-authored-by: Karl-Aksel Puulmann <oxymaccy@gmail.com>
2022-01-04 15:34:12 +02:00
Karl-Aksel Puulmann
3d8bcdfae0
Kill a dead filter type (#7850) 2021-12-29 08:45:37 +02:00
Karl-Aksel Puulmann
f3fc669cda
Add benchmark for earliest timestamp sql (#7848) 2021-12-28 15:16:47 +02:00
Karl-Aksel Puulmann
f7d9c21dcf
Respect person_distinct_id2 in split_person (#7815)
* Keep person_distinct_id2 in sync on split_person

Follow-up to https://github.com/PostHog/posthog/pull/7671, covering a
new corner case.

* Deprecate some methods

* Handle versioning in split_person

* Select for update
2021-12-27 16:25:20 +02:00
Paul D'Ambra
30ba578ea3
Query events by date for properties known to be dates (#7608)
* query events by date for properties known to be dates

* can't currently import journeys_for helper outside of ee folder

* actually remove the EE import

* even though no values of the specified property were not parseable account for unparseable values

* move tests into EE folder cos they're clickhouse only

* remove new line to take this file out of the PR diff

* use more forgiving ClickHouse datetime function

* wip

* add more tests and rename filters

* Adds a broken date picker behind a feature flag

* Revert "wip"

This reverts commit 6ec1da8744.

* add working basic UI for date selection in taxonomic property filter

* add a failing test by writing a unix timestamp the way the SDK does

* obey mypy

* add awareness of type and format so we can query our $time property as a DateTime in the events api

* hard code property definition in the eventsTableLogic

* Revert "obey mypy"

This reverts commit f09ae4369a.

* hold taxonomic property filter open - but with possible kludge in cohortsModel

* remove my edits to settings

* put back materialization of columns that test snapshots are expecting

* let the datepicker hold the taxonomic pop up open

* update snapshot

* simpler datepicker visibility in filter row

* simplify property type format for unix timestamps

* remove the datepicker now button

* Actually delete all of the drop down held open tests

* Remove leftover `console.log`s

Co-authored-by: Michael Matloka <dev@twixes.com>
2021-12-22 13:58:59 +00:00
Paul D'Ambra
bdfe09a06b
Add type and format to property definition (#7804)
* add property type and format and set them for

* add a failing test

* with passing tests on the ee property definition model

* Add a migration to set  as a DateTime

* Clarify in failing test that it's only list lookup failing

* add empty property definition fields to assertions

* fix merge error

* clarify tests

* add more supported types
2021-12-22 10:48:15 +00:00
Marius Andra
51b2940ddd
Event properties in filter (#7718)
* create event property model

* add null

* rename cache vars

* update event properties table on ingestion

* match date formats

* match date formats

* better string handling

* property type can be null too

* pass event timestamp

* update property type later

* perform all updates through a buffer object

* move to EventPropertyCounter

* fix migration

* improve flush last seen at job

* flush job periodically + env

* upsert all event properties in 1 query

* log to statsd

* enable property counter only if experimental mode enabled

* use now() instead of event timestamp

* fix seconds

* add user/pass for default postgres

* add tests

* use big integers

* make query work with 50k props

* processing events saves event properties

* fix script

* test date format detection

* default enabled

* only enable event property counter for specific teams

* eslint fixes

* fix logs double-sync noise in tests

* fix bigint test

* don't do tasks that make no sense

* remove dead code

* proof of concept

* remove old <PropertyFilter> component

* change import paths

* event properties sorted by event names

* get event names from actions if used

* scope event property filters by event names

* fix eslint

* simpler test setup

* different contraint name

* refactor team manager

* greatly simplify the system

* fetch cached event properties

* fix team manager and timestamps

* add cached entry

* also don't cache event properties for teams that have it disabled

* remove indexes that are not going to be used

* remove unused imports

* blacked

* remember event properties with a LRU cache

* fix eslint

* clean up the last bits

* remove fields we no longer have

* add some instrumentation to figure out what services we can connect to (helps debug errors locally with kafka)

* Update frontend/src/types.ts

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* merge duplicate code

* use the right prop for event names

* mute unseen events, add info icon

* use the event-property tracker also for non-EE clients

* simplify duplicates

* add test for event properties

* add test for non-EE event properties

* add flag

* revert the label and unmute the text

* change the flag to UNSEEN_EVENT_PROPERTIES

* sort by query_usage_30_day again

* Update frontend/src/types.ts

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>

* use None if no event_names

* fix type

* improve pagination test

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-12-21 16:27:12 +00: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
Yakko Majuri
3f6b4ecb76
fix migration details changed but name is the same (#7783) 2021-12-17 10:51:25 -08:00
Yakko Majuri
27ac13bb81
0002_events_sample_by (#7778)
* 0002_events_sample_by

* fix order by

* fix test

* update comment

* fix types

* fix test

* fix snapshot tests
2021-12-17 10:41:15 -08: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