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

367 Commits

Author SHA1 Message Date
Karl-Aksel Puulmann
c775a5305c
Add --plan and --fake flags to migrate_clickhouse (#4160)
This can be used to bring a production environment up to date.

Related issue: #4090
2021-04-29 15:40:12 +03:00
James Greenhill
1849223296
Remove logging to WAL, no longer used and duplicate of events_plugin_ingestion (#4132)
* Remove logging to WAL, no longer used and duplicate of events_plugin_ingestion

* Simplify log_event

Co-authored-by: Michael Matloka <dev@twixes.com>
2021-04-27 19:15:56 +00:00
Michael Matloka
ef50005b0d
Don't pin posthog/plugin-server version in dev CH docker-compose (#4102) 2021-04-26 10:15:25 +00:00
Michael Matloka
7f960c0bc3
Remove process_event_ee (#4063)
* Remove non-PLUGIN_SERVER_INGESTION code

* Improve calculate_event_action_mappings condition

* Replace EE available with EE enabled condition

* Fix import

* Fix EE import on FOSS

* Revert "Improve calculate_event_action_mappings condition"

This reverts commit 8de8d70aca.

* Improve import diff
2021-04-23 14:10:28 +02:00
Karl-Aksel Puulmann
2b42909591
Show clickhouse disk and system.stats on /instance/status (#4042)
* Show clickhouse disk and system.stats on /instance/status

Part of https://github.com/PostHog/vpc/issues/45

* Show stats on clickhouse table sizes, remove postgres table size stats

* Add metric for whether clickhouse is alive

* Move clickhouse stats above redis
2021-04-22 08:46:29 +03:00
Paolo D'Amico
fc0b1a8934
Fix StructuredViewsetMixin permissions (#4075) 2021-04-21 18:20:31 -07:00
Eric Duong
0ecf0da079
#3765 Show cohort for bar chart (Insights > Trends) v2 (#4054)
* Revert "Revert "#3765 Show cohort for bar chart (Insights > Trends) (#3825)" (#4052)"

This reverts commit 593679c033.

* patch all time arg

* add missing params

* fix type

* wrong line

* more type safety
2021-04-20 20:24:04 -04:00
Eric Duong
593679c033
Revert "#3765 Show cohort for bar chart (Insights > Trends) (#3825)" (#4052)
This reverts commit 03dc30c4e4.
2021-04-20 15:51:54 -04:00
Buddy Williams
03dc30c4e4
#3765 Show cohort for bar chart (Insights > Trends) (#3825)
* #3765 refactored day to date_from and date_to so that the bar chart may query a date range; the end goal is to show a cohort modal for the graph;

* Removed date from modal label for bar chart since it does not apply

* Added onHover and onClick to ActionsPie charts; Added onClick to ActionsPie to see the people included in Trends > Pie

* date fix

* add time range helper

* add test

* add assertions

Co-authored-by: Eric <eeoneric@gmail.com>
2021-04-20 12:52:51 -04:00
Paolo D'Amico
7ea9eb692c
Update Django to 3.1.8 (and related) (#4007) 2021-04-19 12:59:10 -07:00
James Greenhill
9639361efc
Defer event fields on team model to make grabbing fields a bit more lazy (#4028)
* Defer event fields on team model to make grabbing fields a bit more lazy

* update testing bin for ee

* remove testing change for ee
2021-04-18 16:22:59 -07:00
Eric Duong
5f1094c3f9
Patch 3638 (#4022)
* missing format params for actions

* fix test
2021-04-16 20:36:16 -04:00
Eric Duong
d615cba0b1
3638 trailing wau mau (#3929)
* add query and remove unnecessary functions

* add param function for active user querying

* remove unused import

* fix formatting

* add comment

* add test and complete clickhouse implementation

* add preilim postgres query

* implemented postgres query

* add breakdown test

* breakdown for ch

* working breakdown for clickhouse

* ui

* remove line break

* people for clickhouse

* clickhouse only

* add entity math to payload

* move test

* change dau to null

* fix type

* remove unnecessary imports

* add flags
2021-04-16 15:50:12 -04:00
Karl-Aksel Puulmann
5a19ed293f
Don't catch all exceptions for migrating clickhouse (#4016)
This is making it hard to wait until clickhouse has been set up for VPC
deployments.

It was introduced in
https://github.com/PostHog/posthog/pull/2034/files#diff-ea7b79cfe0fd591ead9add4372dab5f31aa4f6155f304bc0d63ef667c9e8ac95L16
for an unknown reason
2021-04-16 15:08:01 +03:00
Tim Glaser
5cfbc49cc3
Add clickhouse and max users to license (#3918)
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-04-14 08:45:39 -07:00
Tim Glaser
69ba0b1d90
Fix rounding for weekly and monthly intervals (#3665)
* Fix rounding for weekly interval

* fix monthly rounding too

* more monthly fixes

* fix tests

* fix formula test

* fix tests

* Remove unused var
2021-04-05 12:44:32 +02:00
Adrien Brault
89ed4ce864
Fix docker dev environment (#3861)
* Fix docker dev environment

- Use postgres 12 to fix a failing test
- Leverage a yaml anchor to share worker/web services configuration
- Add psql
- Configure psql

* Don't use :cached

* Use Postgres 12 in docker-compose everywhere

* Use postgresql-client-12

* Remove extraneous whitespace

* Clean up dev.Dockerfile

* Clean up EE dev/test docker-compose

* Simplify docker-compose.ch.test.yml

Co-authored-by: Michael Matloka <dev@twixes.com>
2021-04-03 20:41:47 +02:00
Paolo D'Amico
360445b6e0
Display when actions were last calculated (#3796) 2021-04-02 18:40:09 -05:00
Michael Matloka
1fd8678734
Update plugin server in ee/docker-compose.* to 0.15.4 (#3863) 2021-04-02 17:16:10 +02:00
Eric Duong
da6a955a94
3589 breakdown (#3782)
* initial api update

* make api work

* frontend changes

* hello

* adjust trend payload

* prelim working

* fix bugs

* use offset in filters to_dict

* use different pagination check

* use offset in filters to_dict

* test

* extend range for pg

* update test

* remove print

* update test

* match limits

* add api test

* center button

* nits

* UI adjustment

* update comment

* fix type error

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-04-01 13:54:09 -04:00
Eric Duong
954069b00d
Swap out person_distinct_id in queries with subquery (#3828)
* swap out distinct_id table in queries with a subquery that will only consider latest distinct_ids

* wrong import

* fix missin params

* more missing params
2021-04-01 12:56:42 -04:00
Michael Matloka
286287e8e1
Remove IS_DOCKER env var (#3843) 2021-04-01 17:10:00 +02:00
Paolo D'Amico
29bf59cc2b
Backend tests refactor (#3774) 2021-03-31 19:00:58 -07:00
Eric Duong
1768b89ea8
change created_at to _timestamp (#3820)
* change created_at to _timestamp

* remove test
2021-03-30 17:37:53 -04:00
Eric Duong
8ed52b5543
add test account filter to people endpoints (#3815) 2021-03-30 14:27:50 -04:00
Marius Andra
90d16b24a7
Support multiple entries for selector and tag_name filter for EE (#3766)
* support multiple entries for selector and tag_name filter for EE

* improve support for multiple selector matches

* test for multiple selectors and tag names
2021-03-30 10:56:22 +02:00
Eric Duong
c40a0716ce
Insight session entities (#3582)
* Fix session tests

* fix sesisons test

* add postgres functionality

* clickhouse logic

* fix test

* fix pg test

* fix type

* add default condition

* change prompt

* make prompt better

* fix test

* add or tag

Co-authored-by: Tim Glaser <tim@glsr.nl>
2021-03-29 16:03:20 -04:00
Tim Glaser
80216306a7
Fix multiple people same distinct id (#3768) 2021-03-29 11:56:12 +02:00
Paolo D'Amico
da61c55666
Description & tagging on dashboards (#3756) 2021-03-26 17:38:13 -07:00
Eric Duong
1176913061
make sure the proper math is applied when calculating top elements (#3771) 2021-03-26 14:11:20 -07:00
Eric Duong
c59f8b7739
Add element matching for multiple values on text/href (#3739)
* fix element matching for multiple values on text/href

* pg implementation

* use diff solution

* fix smell

* none check

* move function

* remove circular import
2021-03-25 11:00:49 -04:00
Paolo D'Amico
6cc09eaef7
Support custom identifier for person name (#3581) 2021-03-23 15:40:37 -07:00
Tim Glaser
9f57b33e6f
Fix filtering breakdown queries (#3727)
* Fix filtering breakdown queries

* fix tests
2021-03-23 15:42:28 +01:00
Karl-Aksel Puulmann
1adaa8abb7
Chunk session recording events (#3705)
* Chunk session recording events

Closes https://github.com/PostHog/posthog/issues/3632 and replaces https://github.com/PostHog/posthog/pull/3566/files

This should make it possible to ingest large full snapshot events

Base64 is used to compress the data for serialization purposes.

pytest.mock is used for clean patching methods

* Mock time.time for py3.7 compatibility

* Group captured $snapshot events by $session_id

* Don't chunk already chunked payloads
2021-03-23 11:39:13 +01:00
Karl-Aksel Puulmann
e234b8dbd5
Speed up filtering by events in sessions (#3707)
* restructure the code

* Clean up complicated function using namedtuple

* Speed up action/event filtering in clickhouse

For very rare events, filtering by them in sessions previously was slow.
This was because the the distinct_id query contained a lot of users who
hadn't done the action, resulting in more looping.

This commit speeds things up by querying users who have done any events matching the
event/action filter.
2021-03-19 20:16:27 +02:00
Michael Matloka
3c571f1312
Different async action mapping approach (#3678)
* Disable useless InsecureRequestWarning

* Disallow ASYNC_EVENT_ACTION_MAPPING on CH and make it default otherwise

* Return early from calculate_actions_from_last_calculation if CH

* Optimize Action.calculate_events and fire hooks from it

* Run calculate_event_action_mappings every 30 s instead of 5 min

* Optimize post_event_to_webhook thanks to new actions approach

* Add Event.site_url field for reworked Postgres webhooks

* Adjust tests by using sync calls to actions calculation

* Update calculate_action.py

* Use assertEntityResponseEqual more

* Update test_capture_new_person for Cloud

* Don't async calculate actions that haven't finished last calculation

* Fix is_calculating condition place

* Improve calculate_actions_from_last_calculation logging

* Clean up event_query, params

* Fix .only usage

* Update migration
2021-03-18 12:30:21 +01:00
Michael Matloka
3c0737f0fd
Plugins access control (#3486)
* Add Organization.PluginsAccess

* Rename PluginsAccess to PluginsAccessLevel

* Use Organization.plugins_access_level in can_…_plugins_via_api

* Add migration for Organization.plugins_access_level

* Remove unused PLUGINS_CLOUD_WHITELISTED_ORG_IDS

* Update access.py

* Add OrganizationPluginsAccessLevel TS enum

* Fix merge

* Disable LocalPlugin UI on Cloud

* Move away from PluginAccess interface

* Extend PluginsAccessLevel range

* Refactor PluginsAccessLevel for brevity

* Remove PluginAccess interface completely

* Add plugins managed globally

* Update migration

* Show managing org name in "Managed" plugin tag

* Smoothen some rough edges

* Smoothen more edges

* Restore correct MULTI_TENANCY default

* All the edges

* Fix most existing tests

* Remove PLUGINS_*_VIA_API env var support

* Update pluginsNeedingUpdates

* Remove can_*_plugins_via_api from instance status page

* Add tests and polish permissioning

* Update migration

* Fix typing

* Make plugin drawer UI less intrusive

* Update migration

* Fix Uninstall button condition

* Use unified _preflight status endpoint instead of the custom plugins one

* Fix plugin update label condition

* Fix "Check for updates" button condition

* Explain PluginsAccessLevel choices with comments

* Hide global plugin installation option on self-hosted

* Don't actions.loadRepository() as install org

* Improve permissioning with tests

* Satisfy mypy

* Add plugins access level to admin and fix org admin

* Check plugins access level more

* Rename endWithPeriod

* Refactor FE access control checks to accessControl.ts

* Deduplicate permissioning

* Add exception message

* Align backend and frontend plugins access level helpers

* Add plugins access level helper tests

* Fix ChartFilter
2021-03-17 15:01:55 +01:00
Tim Glaser
bf2c4429b5
Auto filter test accounts (#3492)
* WIP auto filter test accounts

* finish off

* Fix tests

* Non generic emails

* add list of generic emails

* Move location to below property filters

* Fix typescript errors

* as any

* fix tests

* filters

* fix tests

* Featureflag doesn't really makes sense for this feature

* fix tests

* fix test

* Add clickhouse + tests for each insight

* Fix lifecycle and paths

* Fix sessions

* Fix session tests

* fix sesisons test

* fix migrations

* fix migration chain

* refactor path & remove stale console.log

* adjust useAnchor & minor copy

* rename to avoid confusion with inline component

* test account filter tweaks

* fix filters

* hardcode

* Add tests for funnel trends

* Make generic emails super fast

* Fix migrations

* Default to false for now

* Default to false, remember a user's preference

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-03-11 18:16:38 +01:00
Michael Matloka
e50d5912e5
Add organization settings (#3324)
* Add organization settings

* Update test_organization.py

* Fix TS issues

* Improve permissioning frontend

* Fix an import

* minor typos

* fix cypress

* Make use of AnalyticsDestroyModelMixin

* Solve nits

* Rework Invites empty state

* Update organization test

* Improve organization tests and permissioning

* Polish Organization Settings frontend

* Improve Members UX

* Use RestrictedArea in Project Settings

* Fix APITestMixin._create_user

* some minor copy adjustments

* Use email initial in ProfilePicture

* Clean up org deletion tests

* Improve org/project deletion UX and reliability

* Enhance org deletion test

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-03-10 13:09:35 +01:00
Michael Matloka
819a2413b9
Handle webhooks better (#3605)
* Don't fire webhooks for soft-deleted actions

* Handle regex errors in webhook firing gracefully
2021-03-09 16:37:42 +01:00
Tim Glaser
268d9929dc
Fix session tests (#3580)
* Fix session tests

* fix sesisons test
2021-03-05 12:26:54 +01:00
Eric Duong
fcf7c98311
remove unnecessary group bys in query (#3562) 2021-03-03 10:14:09 -05:00
PostHog bot
1df3f7d927
Update posthog-js to 1.9.0 and @posthog/plugin-server to 0.11.3 (#3565)
* Update posthog-js to 1.9.0

* Update @posthog/plugin-server to 0.11.2

* Update @posthog/plugin-server to 0.11.3

Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
Co-authored-by: Michael Matloka <dev@twixes.com>
2021-03-03 12:27:44 +01:00
Michael Matloka
bb6d4b4358
docker-compose.ch(.test).yml files for plugin server (#3552) 2021-03-02 11:57:19 +01:00
Michael Matloka
dbbb113428
Make PLUGIN_SERVER_INGESTION True by default (#3485)
* Make PLUGIN_SERVER_INGESTION True by default

* Disable plugin server ingestion in tests by default

This is so that ingestion tests in here, which rely on old ingestion, don't fail. Plugin server ingestion itself is covered well in the plugin server repo.
2021-03-01 22:34:40 +01:00
Michael Matloka
6fb295ed51
Use plugin-server container in containerized deploys (#3515) 2021-03-01 12:56:33 +01:00
James Greenhill
cd7ccc779e
Run all connections through clickhouse connection pooler (#3495)
* Use clickhouse connection pooler to avoid connections from stepping on eachother

* build reqs
2021-02-26 12:54:35 -08:00
Michael Matloka
43c9105c17
Fix limit of events in CSV export (#3503)
* Fix limit of events in CSV export

* Limit to 100 instead of 101

* Optimize listing events

* Fix typing error

* Limit events to 100 better

* Fix len condition for using broader events queryset

* Add regression test

* Adjust ClickhouseEventsViewSet

* Fix CH events limit in CSV export

* Fix typing and missing +1

* Use limit in _query_events_list
2021-02-26 18:20:05 +01:00
Karl-Aksel Puulmann
a96d682ca1
Fix getting earliest timestamp on EE with no events (#3501)
Sentry error: https://sentry.io/organizations/posthog/issues/2236839278/?project=1899813&query=is%3Aunassigned+is%3Aunresolved
2021-02-26 15:31:22 +02:00
Karl-Aksel Puulmann
828c301299
Fix filtering sessions by action with property filters (#3500)
Fixes #3499
2021-02-26 11:24:31 +02:00