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

18 Commits

Author SHA1 Message Date
Karl-Aksel Puulmann
fa79f8ea67
BE (Groups/Trends): Allow aggregating by groups (#6894)
* Type math in Entity

* Allow passing group_type_index from FE to BE

* Get a initial query running

* Add group value filter if aggregating by groups

* Add snapshot testing for trends queries

* isort

* Update tests

* Add test for column_optimizer

* Update ee/clickhouse/queries/trends/util.py

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>

Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-11-05 13:08:32 +02:00
Tim Glaser
0f7de25f33
Fix cohort creation from trends (#6636)
* Fix cohort creation from trends

* REVERT debug issue

* fix nit

* Revert "REVERT debug issue"

This reverts commit ea50db28ce.

* REVERT try debugging issue

* REVERT Try final

* Don't insert into clickhouse twice

* remove unused var

* debug

* fix and revert

* test mixin

* fix black

* fix

* Update ee/tasks/test/test_calculate_cohort.py

Co-authored-by: Michael Matloka <dev@twixes.com>

Co-authored-by: Michael Matloka <dev@twixes.com>
2021-11-04 11:46:08 +01:00
Michael Matloka
b0aa8f0c91
Migrate cohort-related logics to be project-based (#6683)
* Migrate cohort-related logics to be project-based

* Fix `cohortsDetail`

* Remove `teamId` param from `determineEndpoint` methods
2021-10-28 13:29:53 +02:00
Sam Winslow
62cc72684e
Capture exception if organization user is not found (#6528) 2021-10-20 01:18:51 +01:00
Sam Winslow
95746b9bce
Send event for license usage by organization (#6333) 2021-10-14 12:42:14 -04:00
Michael Matloka
e97c20ad33
Purge PLUGIN_SERVER_ACTION_MATCHING flag (#6358)
* Remove `PLUGIN_SERVER_ACTION_MATCHING` flag

* Fix action bug

* Try to fix mocking
2021-10-11 21:33:48 +02:00
Tim Glaser
e31d166d74
Don't count internal metrics for billing purposes (#6228) 2021-10-05 15:05:51 +03:00
Tim Glaser
3402ba4ee7
Fix status reports (#6194)
* Fix status reports

* remove active in period

* types

* mypy
2021-10-01 18:56:29 +02:00
Alex Gyujin Kim
6d6202317a
Add custom_name to entity model (#6090)
* add custom_name to entity model

* fix test and add custom name to funnel

* fix more tests

* remaining broken tests
2021-09-24 08:31:16 -07:00
Tim Glaser
eba29d85f6
Send license usage (#6060)
* Send license usage

* type errors

* Update posthog/celery.py

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

* Use correct URL

Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
2021-09-22 14:17:38 +02:00
Eric Duong
63c57dc5b4
comment out test (#5364) 2021-07-28 23:24:32 +00:00
Eric Duong
562e3bacfc
Funnel persons per step and dropoff (#4883)
* wip: pagination for persons on clickhouse funnels

* wip: added offset support for getting a list of persons; added support for conversion window;

* fixed mypy exception

* helper function to insert data for local testing

* moved generate code into separate class for more functionality later

* corrected person_distinct_id to use the person id from postgres

* minor corrections to generate local class along with addition of data cleanup via destroy() method

* reduce the number of persons who make it to each step

* moved funnel queries to a new folder for better organization; separated funnel_persons and funnel_trends_persons into individual classes;

* funnel persons and tests

* initial implementation

* invoke the funnel or funnel trends class respectively

* add a test

* add breakdown handling and first test

* add test stubs

* remove repeats

* mypy corrections and PR feedback

* run funnel test suite on new query implementation

* remove imports

* corrected tests

* minor test updates

* correct func name

* fix types

* func name change

* move builder functions to funnel base

* add test classe for new funnel

* Handle multiple same events in the funnel (#4863)

* dedup + tests

* deep equality. Tests to come

* write test for entity equality

* finish testing funnels

* clean up comments

* add ability to specify per step or dropoff persons

* remove defaults

* remove funnel_window parameter unless it's needed

* add param to filters

* test api

* remove print

* fix tests

* change distribution

* add none condition for funnel step

* add order by

* remove funnel window days

Co-authored-by: Buddy Williams <buddy@posthog.com>
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
2021-06-29 12:22:42 -04:00
Buddy Williams
7d045c86f3
Refactoring funnel trends (#4419)
* checkpoint: refactoring funnel trends so that they work correctly

* wip: refactoring funnel trends query to return the results we actually need

* wip: added in new query for testing

* wip: moved sql into a separate file, converted list to dictionary, and added several tests to check data quality

* wip: with a better understaning of funnel trends I've refactored the query so that I can write a data transformer in python

* moved code into funnel_trends for both logic and tests to isolate the concern

* reordered methods for readability

* wip: refactoring funnel trends to support filters

* wip: added updated SQL which will replace the existing FUNNEL_TREND_SQL

* correct column name so that it's clearer

* added substitution variables to new query

* fixed missing substitution variable

* wip: integrating new query with correct params, added mixins for funnel_window, and working toward working test

* several query corrections

* summarize funnel trends

* moved method down

* removed unused code

* added data quality checks

* corrected cohort size for tests

* test window size and incomplete status

* corrected a few names

* removed unnecessary comment

* commented out old funnel trends tests

* removed print statement

* removed old funnel trend code

* made funnel trends response match existing data structure layout

* removed unused imports

* removed more unused imports

* fixed mypy errors

* Added ClickhouseFunnelBase to extract common methods for both ClickhouseFunnelTrends and ClickhouseFunnel; this also fixes issues with tests;

* removed unused type comment

* corrected test to account for new funnel_window_days mixin

* fixed clickhouse funnel tests

* fixes for automated tests

* changed team_id to use client substitution to avoid sql injection attempts in the future but since it's not user supplied it's not currently an issue

* corrections prompted by PR review

* corrected test to dict test with funnel_window_days
2021-06-03 17:06:08 -04:00
Eric Duong
9514e290a2
Static cohort on person modal (#2952)
* Upload static cohort using CSV, closes #2868

* fix tests

* Fix tests

* Fix e2e test

* Avoid double inserts

* Speed up query

* Move to params

* fix tests

* initial cleanup

* initial scaffold for cohort static logic

* intiial frontend changes

* initial working

* fix error on iterable

* stickiness people func refactor

* Use JSON instead of protobuf

* stickiness working

* clickhouse route

* unused import

* move button

* make interface easier to user

* clickhouse support

* restore cache decorator

* endpoint adjustment

* adjust how clickhouse handles inserting for static cohorts

* split out processing into pg

* use worker for clickhouse querying too

* add pg test

* ee test

* add input for cohort naming

* add stickiness test

* condition for when to show save cohort

* fix types

* minor fix

* remove repeats

* remove hardcoded id

* add date handling to trends cohort func

* remove print

* add link on success creation

* cohort working

* fix backend test

* fix cohort typescript

* remove unnecessary kafka topic

* remove brackets

* shift default

* raise exceptions when debug or test is true

* remove test flag

* move trends insight related components to different folder

* change get_earliest_timestamp

* remove extraneous condition

* fix test call

* put behind ff

* fix test x2

* fix tests

* restore exceptions hog

* fix tests

* restore exceptions hog

* fix test x20

Co-authored-by: Tim Glaser <tim@glsr.nl>
2021-02-24 09:59:13 -05:00
Karl-Aksel Puulmann
259a2290b4
Serialize/deserialize elements_chain on webhooks_ee (#3262)
Solves https://sentry.io/organizations/posthog/issues/2207757069/?project=1899813&query=is%3Aunassigned+is%3Aunresolved
2021-02-09 13:54:02 +01:00
Michael Matloka
96e4ee8512
Nest endpoints of project-based models under /api/project/ – LITE (#2485)
* Nest endpoints under /project/ with StructuredViewSetMixin

* Rewrite URLs

* isort

* Update utils.py

* Fix errors

* Fix almoast all the errors

Last left to do: shared dashboards and permission classes.

* isort

* Adjust for master

* Add compatbility with shared dashboards

* Debug ClickHouse

* Remove some # type: ignores

* Simplify CursorPagination

* Move test base from posthog.api.test to posthog.test

* Improve API structure

* Bring back legacy endpoints

* Fix legacy compatibility

* Fix bugs and typing

* isort

* Fix hooks test

* Try fixing errors

* Fix oversight

* isort

* Fix problems

* isort

* Be more tolerant

* Fix naming and remove redundant code

* Fix imports

* Update deleteWithUndo

* Roll back

* Roll back more

* Update .gitignore

* Rollll back

* Rollllllll

* back

* Betterify

* Address feedback
2020-11-24 23:26:28 +01:00
Eric Duong
fae9fe5238
Fix doubled up slack hook (#2340)
* fix doubled up and change name

* Fix test

Co-authored-by: Tim Glaser <tim@glsr.nl>
2020-11-12 08:31:32 -05:00
Eric Duong
7a5bcab99e
Restore slack hook (#2186)
* add back hook

* add back hook

* filter event matcher

* create artificial event to query for actions

* fix test

* possible solution

* remove printer

* reformat

* remove test_event temp

* comment out tests

* comment out

* uncomment

* patch another

* reduce var

* fix timestamp
2020-11-05 14:40:30 +01:00