0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
Commit Graph

974 Commits

Author SHA1 Message Date
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
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