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

981 Commits

Author SHA1 Message Date
Rick Marron
52a9054900
Materialize the window_id and session_id on the events table (#8532)
* materialize columns

* update snapshots

* remove test_with_materialized_column

* update recording snapshot

* update new funnel tests

* update snapshots

* fix test

* update snapshots pt 2
2022-02-15 16:41:30 -08:00
Eric Duong
dd620e01cc
Fill postgres cohortpeople table only if related to feature flag (#8610)
* fill postgres only if cohort is used in feature flag

* update relevant cohorts when feature flag is updated or created

* move calls

* call count test ff

* add ff test

* snapshots

* update types

* get person cohorts

* api all working

* fix tests

* typing and frontend

* capitalize constant
2022-02-15 16:59:36 -05:00
Rick Marron
b2beccdb17
Recordings in funnels (#8180)
* first pass at adding recordings to funnels

* fix funnel trend sort orders

* cleanup

* fix spacing for ambr

* fix should_refresh

* fix potential missing funnel_step

* add test to normal + strict funnels

* update snapshots

* update snapshot pt 2

* remove support for unordered funnels

* update snapshot

* fix include recording filter

* add recordings to funnel correlation

* add final_event concept

* fix filter

* fix snapshot

* tests for strict funnel correlation actors

* fix materialized property

* cleanup

* fix bug with any order funnel + correlation persons modal

* respond to feedback

* revert back

* snapshot update
2022-02-15 13:04:57 -08:00
Neil Kakkar
a3ae826059
Fix bug with exposure calculation in trends (#8600) 2022-02-15 12:46:25 +00:00
Harry Waye
3be0cda8ce
perf(cohorts): reduce select batch size, and sleep 1 between (#8598)
* perf(cohorts): reduce select batch size, and sleep 1 between

Previously we were hammering the database, see
https://github.com/PostHog/product-internal/issues/256 for details. Now
we:

 1. reduce the batch by 5 times
 2. have a little sleep(1) between batches

We also add a little bit of logging for instance in failure cases.

* include stack trace info in warning

* just reraise so we don't lose stack trace

* use monotonic for timings, not time

* update snapshots
2022-02-15 11:53:20 +00:00
Neil Kakkar
286d8844d7
Send Experiment variants used for calculations with API response (#8597) 2022-02-15 11:48:41 +00:00
Eric Duong
e1476dfaf4
Or property filtering API (#8012)
* add test

* update func

* add include and settings

* diff method

* some prelim changes to make backend work

* add tests and logic for handling groups

* setup basic mixin parsing

* add tests

* types and switchover

* adjustment

* update snapshots

* update more snapshots

* update more snapshots

* update more snapshots

* typing

* snapshots

* clean up TODOs and types

* separate to_dict

* another property dict fix

* use operator dependening on condition

* fix tests

* update tests

* remove dummy condition

* update tests

* change name to groups

* another label

* rename filter_group to property_group

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2022-02-14 13:39:48 -05:00
Eric Duong
3e7f0d37a4
fix(cohort): Add count field to cohort model (#8585)
* add count field to cohort model

* make count safe

* update version with count
2022-02-14 16:34:07 +00:00
Neil Kakkar
2d613d7d97
Fix trend breakdown duplicates (#8583)
* keep breakdown count consistent

* add constant back

* update test
2022-02-14 16:20:45 +00:00
Michael Matloka
db4111df8a
Finalize dashboard restrictions (#8527)
* Update test_insight.py

* Secure insight endpoint for dashboard restrictions

* Prohibit unauthorized deletion of restricted dashboard

* Update class name in snapshots

* Address feedback
2022-02-14 12:55:16 +00:00
Alex Gyujin Kim
459d304e95
Part 1: Make everything taggable Backend (starting with Actions) (#8528) 2022-02-13 22:19:53 -08:00
Harry Waye
bc43b8685e
feat(healthchecks): add clickhouse and redis health (#8497)
* feat(healthchecks): add clickhouse as a dependency

* feat(healthchecks): add celery broker healthcheck

* feat(healthchecks): add cache healthcheck, plus some misc updates

* add missing typing

* add missing typing

* add role cast

* Add logging for kafka connectivity check

* actually add healthcheck as middleware

* fix postgres failure check

* simplify postgres migration return value

* verboise -> verbose

Co-authored-by: Guido Iaquinti <4038041+guidoiaquinti@users.noreply.github.com>

* put interface validation at top of view

* remove unused imports

* show resp.content on status failures

* test(healthchecks): set log level to debug to pytest displays it

* restore logger level

* Bring up redis for backend ci tests

* up redis in non-cloud tests

Co-authored-by: Guido Iaquinti <4038041+guidoiaquinti@users.noreply.github.com>
2022-02-10 15:20:38 +00:00
Harry Waye
4f07fb7658
test(snapshots): update clickhouse snapshot comments (#8535)
* test(snapshots): update clickhouse snapshot comments

It looks like Clickhouse has been removed from clickhouse sql comments,
but the snapshots haven't been updated. Not sure how this got past CI.

* missed a couple
2022-02-10 12:07:09 +00:00
Michael Matloka
2207bbe84e Update snapshots 2022-02-09 21:14:53 +01:00
Tiina Turban
1abe9ef897
async mig check (#8503) 2022-02-09 20:45:59 +01:00
Tiina Turban
73e4f0db51
Add --check command to migrate_clickhouse (#8501) 2022-02-09 20:44:52 +01:00
Eric Duong
e4f65b1790
8356 versioning (#8449)
* version insights

* version and lock update

* make sure all tests work

* restore exception

* fix test

* fix test

* add specific id

* update plugin server test utils

* cleanup

* match filtering

* use timestamp comparison

* make tests work

* one more test field

* fix more tests

* more cleanup

* lock frontend when updating and restore refresh

* pass undefined

* add timestamp to background update

* use incrementer

* add field

* snapshot

* types

* more cleanup

* update tests

* remove crumbs

* use expressions

* make nullable

* batch delete

* fill null for static cohorts

* batch_delete

* typing

* remove queryset function
2022-02-09 12:19:00 -05:00
Marius Andra
ed25618236
Fetch person property values via Clickhouse (#8414)
* fetch person properties via clickhouse

* cleaner queries

* fix some types

* parse up to 100k persons with this prop, add back counts

* ignore something that's bound to error anyway

* no point making it too flat now

* revert flattening of lists

* add statsd

* ignore type

* add back conversion

* mypy

* better mypy

* refactor
2022-02-09 17:17:37 +01:00
Tim Glaser
1aea20c683
reintroduce assertNumQueries (#8487)
* reintroduce assertNumQueries

* Remove and speed up

* fix two more
2022-02-09 16:15:17 +00:00
Neil Kakkar
d5a48fbd06
Add support for Groups in Experiments (#8463)
* add support for Experiment groups

* update styling

* incl groups in property selection

* set participant type and respect FF group type on backend

* remove aggregation select
2022-02-09 15:32:54 +00:00
Michael Matloka
3a678e7261
Dashboard privilege API and collaborators UI (#8424)
* Add basic `/api/projects/:id/dashboard/:id/collaborators`

* Handle more collaboration cases and add base tests

* Add some collaborators UI to share modal

* Improve Python typing

* Improve TS typing

* Allow addition and deletion of collaborators from UI

* Add upsell prototype

* Improve upsell button

* Add `effective_restriction_level` to `DashboardSerializer`

* Improve `LemonSelect` value handling

* Improve `LemonSelect` behavior when selecting existing value

* Refactor the way privilege level name is determined

* Don't destroy `ShareModal` on close to avoid logic remounting

* Split out upsell into own PR

* Fix TS

* Fix typing

* Increase security with more tests

* Inline `parents_query_dict`

* Dashboard collaborator bubbles (#8450)

* Add collaborator bubbles to restricted dashboard headers

* Rename `index.tsx` to `ProfilePicture.tsx` for readability

* Improve tooltip handling

* Create ProfileBubbles.stories.tsx

* Make collaborator bubbles tooltip dashboard-level

* Always show collaborator bubbles

* Dashboard restrictions (#8462)

* Add frontend-side restrictions editing restrictions to dashboards

* Restrict `InsightCard`

* Align info message margin

* Disallow locking yourself out of the dashboard

* Handle dashboard restrictions in the insight page

* Allow disabling `InsightsTable` series checkbox

* Fix minor issues

* Align .page-title-row height

* Fix typing

* Fix arg name

* Address review feedback

* Fix n+1 queries issue
2022-02-08 16:22:09 +00:00
Paolo D'Amico
5ac9ecd985
Track invite signups (#8446)
Co-authored-by: Michael Matloka <dev@twixes.com>
2022-02-08 15:37:07 +01:00
Paolo D'Amico
e4e89a8da8
Configure recordings TTL setting from UI (#8139) 2022-02-08 15:08:23 +01:00
Tim Glaser
6d13d58cd6
Revert "Adds reserved properties for filtering property definitions (second attempt) (#8349)" (#8485)
This reverts commit 3491b161ad.
2022-02-08 13:49:11 +00:00
Paul D'Ambra
3491b161ad
Adds reserved properties for filtering property definitions (second attempt) (#8349)
* Revert "Revert "Adds reserved properties for filtering property definitions (#8291)" (#8340)"

This reverts commit cb6839fe21.

* limit reserved properties to events table, include this in unit tests

* add api level tests for datetime and reserved word filtering of trends

* remove unused constant

* make the cypress test even looser

* delete file that is no longer in master

* extract a query object

* implement reserved attribute querying for date filters

* update datetime cypress test

* separate and clarify tests and ensure date queries only use reserved attributes on event filters

* delete file that isn't in master
2022-02-08 14:25:39 +01:00
Yakko Majuri
fca0a46772
Add tags to dead letter queue table (#8345)
* add tags to dead letter queue table

* Update ee/clickhouse/migrations/0023_dead_letter_queue_tags.py

* fix typo

* fixes

* update snapshots

* fix tests

* fix test

* update snapshot

* send tags

* update

* Update ee/clickhouse/migrations/0023_dead_letter_queue_tags.py

* fix plugin server test?

* Update plugin-server/src/worker/ingestion/utils.ts

* Update plugin-server/src/types.ts

* Update plugin-server/src/worker/ingestion/utils.ts
2022-02-04 15:36:15 -05:00
Neil Kakkar
1fcf91fdfc
surface p value and loss from API, so frontend can display when needed. (#8434) 2022-02-04 12:12:26 +00:00
Neil Kakkar
4131d6a114
reduce precision for probabilities (#8427) 2022-02-03 21:04:07 +00:00
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