0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 09:14:46 +01:00
Commit Graph

1304 Commits

Author SHA1 Message Date
Ben White
fea961e904
feat: Billing V2 support for enterprise billing (#12425) 2022-10-26 09:13:00 +00:00
Guido Iaquinti
78379f09c6
style(flake8): enable B007 (#12416) 2022-10-25 14:50:44 +02:00
Ben White
d25ecd29d7
fix: Moved usage report out of ee (#12414) 2022-10-25 12:56:20 +02:00
Ben White
70f47510ab
fix: Usage report persons query (#12408) 2022-10-24 18:30:20 +00:00
Ben White
4b7f04b026
feat: Added backup option for billing service reporting (#12405) 2022-10-24 16:38:40 +00:00
Ben White
77d7efc500
fix: Schedule usage reports as individual tasks (#12398) 2022-10-24 17:08:51 +02:00
Karl-Aksel Puulmann
441e1e376b
chore(ci): Fix master branch tests (#12399)
* fix test_usage_report tests

buggy tests shipped in https://github.com/PostHog/posthog/pull/12383

* Ignore problematic lines
2022-10-24 14:33:33 +03:00
Alex Gyujin Kim
759214b107
feat(recordings): [backend] interesting metadata in recordings list api (#12353) 2022-10-24 09:32:26 +02:00
Ben White
0fdd5363a2
fix: Usage reporting format (#12383) 2022-10-21 19:13:02 +02:00
Michael Matloka
af613a8e64
fix(trends): Revamp WAU/MAU query to work in all cases (#12302)
* fix(trends): Allow WAU/MAU aggregation with intervals other than day

* Update snapshots

* Rework active users query and add tests

* Clarify tests

* Update breakdown.py

* Update snapshots

* Update test_trends.py

* Update snapshots

* Update comment

* Improve timestamp condition

* Revert "Improve timestamp condition"

This reverts commit 9fd6a1af92.

* Use multiline comments

* Sprinkle some `@snapshot_clickhouse_queries`

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-21 13:19:15 +02:00
Ben White
9e9149eb50
feat: Additonal billing-v2 improvements (#12340) 2022-10-21 11:04:14 +02:00
Ben White
49da89080b
fix: Billing V2 cache key (#12341) 2022-10-19 12:57:46 +00:00
Ben White
732e68a459
fix: Reset cached is_cloud on each test (#12337) 2022-10-19 11:57:47 +00:00
Karl-Aksel Puulmann
b33347205c
fix: Revert "chore(tests): add pytest-randomly plugin to randomize test run order" (#12335)
* Revert "chore(tests): add pytest-randomly plugin to randomize test run order (#12307)"

This reverts commit 313de83cb8.

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-19 13:30:16 +03:00
Ben White
683a4aab1a
fix: Check for active subscription to determine billing version (#12330) 2022-10-19 10:28:26 +00:00
Ben White
b4a401d532
feat: Billing V2 (#11986) 2022-10-19 08:58:36 +02:00
Tiina Turban
658667417a
fix: update insight api docs about refreshing flag (2) (#12322)
should be true, related https://posthoghelp.zendesk.com/agent/tickets/653
2022-10-18 20:12:42 +01:00
zackelan
313de83cb8
chore(tests): add pytest-randomly plugin to randomize test run order (#12307)
* chore(tests): add pytest-randomly plugin to randomize test run order

* Update snapshots

* Update snapshots

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-18 09:34:34 -07:00
Neil Kakkar
a9e7537b7d
fix(experiments): Handle start and end dates appropriately (#12258) 2022-10-18 10:00:53 -04:00
Karl-Aksel Puulmann
20bc4cab01
fix: Revert "chore(api): meter rate limit on team" (#12316)
Revert "chore(api): meter rate limit on team (#12006)"

This reverts commit 258cd32f54.
2022-10-18 14:19:57 +03:00
Rick Marron
258cd32f54
chore(api): meter rate limit on team (#12006)
## Problem

Take 2 on [this PR](https://github.com/PostHog/posthog/pull/11993#event-7470261128). The problem is that our rate limits should be based on `team_id` instead of an API key, and the last PR didn't handle views that didn't have a `team_id`.

## Changes

* Moves the rate_limit to be based on the `team_id` when possible
* Handles views that don't have a team_id
* Ensures the enabling/disabling of rate limits applies to all rate_limit classes (it used to only apply to the default classes)

and

* moves enabling the rate limit to an instance setting
* and adds a team id allow list for bypassing the rate limit
* and a simple cache which I think stops us hammering the reading of the infrequently changing settings

👉 *Stay up-to-date with [PostHog coding conventions](https://posthog.com/docs/contribute/coding-conventions) for a smoother review.*

## How did you test this code?

Added tests for the new cases:
* Rate limit works across a team - not just on an individual user.
* Rate limits work on views without a `team_id`
* Disabling the rate limits works


Co-authored-by: Paul D'Ambra <paul@posthog.com>
2022-10-18 09:01:07 +01:00
zackelan
ed0dcc2d2c
fix: correct type hint for plugin activity logs (#12268)
* fix: correct type hint for plugin activity logs

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-14 12:51:07 -07:00
Neil Kakkar
c6728185e8
fix(experiments): Use serializer for feature flag updates as well (#12190) 2022-10-14 10:04:11 +01:00
Michael Matloka
5e9fb3e55b
feat(trends): Event count per user (#12173)
* Add event count per actor querying capabiilty

* TExpose "Event count per user" in the query editor

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Handle sum per actor gracefully

* Flag the feature

* Update snapshots

* Move new "should join persons" check to `TrendsEventQuery`

* Support non-time series insights

* Fix `start_of_week_fix` for new query

* Fix `VOLUME_PER_ACTOR_SQL`

* Add test for `start_of_week_fix`

* Don't join persons needlessly

Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
Co-authored-by: Marius Andra <marius.andra@gmail.com>
2022-10-13 14:40:00 +00:00
Neil Kakkar
cf59ea326d
fix(experiments): Clean up experiments table (#12193)
* fix(experiments): Clean up experiments table

* fix typing

* right align duration

* fix typing?

* Update snapshots

* rm obsolete test

Co-authored-by: neilkakkar <neilkakkar@users.noreply.github.com>
2022-10-12 23:00:58 -04:00
Eric Duong
106db8669b
fix: change timestamps to be timezone aware upon parsing (#11935)
* fix: change timestamps to be timezone aware upon parsing

* fix

* fix parsing

* patch

* fix default

* localize

* fixes

* Update snapshots

* update handling

* update snapshots

* Update snapshots

* update snapshot'

* Update snapshots

* Update snapshots

* Update snapshots

* handle boundary

* more fixes

* change rounding

* update snapshot

* Update snapshots

* revert previous attempt

* Update snapshots

* adjust hourly interval

* edit check

* edit condition

* Update snapshots

* remove conversion

* Update snapshots

* Update snapshots

* fix retention

* Update snapshots

* Update snapshots

* Update snapshots

* add timezone to remaining queries

* Update snapshots

* update snapshots

* Update snapshots

* add comment

* add fix

* Update snapshots

* trigger backend tests

* try

* Update snapshots

* add UTC annotation

* add comment

* Update snapshots

* Update snapshots

* Update snapshots

* fix localize

* Update snapshots

* move comment restore retention test

* Update snapshots

* Update snapshots

* add tests

* try

* Update snapshots

* Update snapshots

* Update snapshots

* convert system timestamp to utc then timezone

* more

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* more conversions

* restore"

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* last edit

* Update snapshots

* Update snapshots

* add changes

* restore changes from master

Co-authored-by: EDsCODE <EDsCODE@users.noreply.github.com>
Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-12 16:46:16 -04:00
Neil Kakkar
8e959e5002
fix(experiments): Use appropriate date ranges for implementation checks (#12216) 2022-10-12 15:06:54 +01:00
Karl-Aksel Puulmann
1c96763bf0
feat(app-metrics): Set up schema and data gathering of app metrics (#12143)
* Add new app_metrics feature available on scale and enterprise

* chore(ingestion): cache available_features for a longer period in OrganizationManager

This will come in handy for app metrics and is generally a performance win

* Add service to track app metrics

* refactor(historical-exports): Move retry limit handling code to same place as other error handling

* Track app metrics in processEvent/onEvent/exportEvents and historical exports

* Add mising app-metrics file

* Add missing __init__.py module

* Use correct topic + columns for app metrics

* Add a placeholder schema

* Set timestamp correctly

* Fix a typeerror in organization-manager.ts

* Schema fixup

* Add test showing read-own-writes logic

* Remove unneeded TODO

* Add missing constant

* Simplify flushing logic

* Stabilize VM tests

* Use correct sharding key

* Revert hooks changes
2022-10-12 11:30:58 +03:00
Eric Duong
1e4d9ddeda
fix: funnel group tests (#12198)
* trigger backend tests

* try

* Update snapshots

Co-authored-by: EDsCODE <EDsCODE@users.noreply.github.com>
2022-10-12 10:50:28 +03:00
timgl
3d9aac2804
fix(Funnels): unordered funnels labels (#12137)
* fix(Funnels): unordered funnels labels

* fix tests

* fix

* fix tests

* Update snapshots

* fix test

Co-authored-by: timgl <timgl@users.noreply.github.com>
2022-10-11 14:38:19 +02:00
Eric Duong
b3b660fc27
fix: Add drf wrappers to groups api (#12116)
* add drf wrappers to groups api

* add required
2022-10-10 21:56:54 +00:00
Eric Duong
ac009a34b7
fix: session math breakdown query (#12114)
* fix: session math breakdown query

* add, update test

* Update snapshots

* Update snapshots

* use alias

Co-authored-by: EDsCODE <EDsCODE@users.noreply.github.com>
Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
2022-10-10 21:04:34 +00:00
Neil Kakkar
99042f20a5
fix(experiments): Clean up warnings (#12108)
* fix(experiments): Clean up warnings

* fix
2022-10-10 11:27:25 -04:00
Paul D'Ambra
b5f07ae0ad
feat: add text cards to DB (#12110)
Problem
Stacked on top of #12067 so the commit history is weird :/

Changes
adds DB wiring to add text or insights to dashboard tiles

How did you test this code?
developer tests and running the site locally

 move insight to dashboard
 duplicate insight from insight view
 duplicate insight from card list view
 duplicate insight from list view
 duplicate insight from dashboard
 remove insight from dashboard
 add insight to dashboard
 delete dashboard
 duplicate dashboard
 set card color
🤔 set card layout - updating layout starts refresh loop for dashboards
I think these changes make it more obvious but this is the case in master too. -> It's fixed (or at least worked-around) in #12132
 update insight data updates dashboard view for that data
 rename insight from dashboard
2022-10-10 11:49:33 +01:00
timgl
db6a2d5304
chore(ci): Massively reduce # tests we run (#12139)
* chore(ci): Massively reduce # tests we run

* Update snapshots

* Update snapshots

* Update snapshots

* add tests back in

* Update snapshots

* Update snapshots

Co-authored-by: timgl <timgl@users.noreply.github.com>
Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
2022-10-08 02:09:57 +01:00
Neil Kakkar
fe62018aed
fix: Filter out invalid persons for person-on-events (#11803) 2022-10-06 10:40:18 +01:00
Michael Matloka
77251f5406
fix(auth): Upgrade personal API keys (#11902)
* fix(auth): Upgrade personal API keys

* Fix migration

* Fix Liskov violation

* Fix capture endpoint

* Allow dropping NOT NULL

* Fix tests

* Fix an E2E test

* Remove `type: ignore`s

* Use `SECRET_KEY` for salt

* Revert "Use `SECRET_KEY` for salt"

This reverts commit 3bc9f64dc5.

* Move comment

* Fix `BaseTestMigrations` typing

* Make mypy happy
2022-09-28 12:53:48 +02:00
timgl
24a2329879
perf(retention): Reduce retention mem usage (#11985)
* perf(retention): Reduce retention mem usage

* fix

* Update snapshots

* Update snapshots

Co-authored-by: timgl <timgl@users.noreply.github.com>
Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
2022-09-27 04:48:28 +01:00
Alex Gyujin Kim
e9047f868f
feat(recordings): add matching events to recordings list query (#11919)
Co-authored-by: alexkim205 <alexkim205@users.noreply.github.com>
2022-09-24 10:49:16 -04:00
Eric Duong
cc2db2e469
fix: formulas not working when multiple group or sessions are included (#11909)
* fix formulas not working when multiple

* Update snapshots

* Update snapshots

Co-authored-by: EDsCODE <EDsCODE@users.noreply.github.com>
Co-authored-by: posthog-bot <posthog-bot@users.noreply.github.com>
2022-09-22 10:58:24 -04:00
Neil Kakkar
fcdf313e63
fix(retention): Revamp persons modal (#11810)
* fix(retention): Revamp persons modal

* Update snapshots

* clean up & fix things

* Update snapshots

* fix tests, add modal fixes

Co-authored-by: neilkakkar <neilkakkar@users.noreply.github.com>
2022-09-22 10:32:41 -04:00
Marius Andra
91a43ea413
chore(actions): rename calculated events to actions, remove flag (#11864)
* chore(actions): rename calculated events to actions, remove flag

* remove even more action-event code

* remove deprecated tests

* fix cypress
2022-09-20 14:46:40 +02:00
Paul D'Ambra
cfee66b178
feat: use bulk update for calc event property usage (#11795)
* feat: switch calculate event property types to use bulk update

* remove snapshotting that changes based on clock in test

* update in batches since a few teams have very high numbers of definitions

* expect None not 0 in some tests

* needs to reset to zero every time the count runs

* count definitions from zero on each run

* use column optimizer to count properties

* allow for more thorough property discovery

* exclude person properties from event property calculation
2022-09-13 13:54:18 +01:00
Paul D'Ambra
41e4b3ffeb
fix: dashboard collaboration is required to change dashboard description (#11754)
* fix: dashboard collaboration is required to change dashboard description

* don't change description in tests

* listing dashboards is already nplus1

* check listing is not nplus1 when description is present

* remove nplus1 from sharing config when listing dashboards

* reduce diff

* Update snapshots

* handle optional features better

* Adds missing description test for creating a dashboard

Co-authored-by: pauldambra <pauldambra@users.noreply.github.com>
2022-09-13 10:23:05 +02:00
Guido Iaquinti
fa7c706af8
style(flake8): enable E402 (#11707) 2022-09-07 16:11:55 +02:00
Guido Iaquinti
6159137e60
fix(open): use utf-8 enconding and close fd (#11698) 2022-09-07 14:03:47 +02:00
Michael Matloka
5d2ad6c7bb
chore(deps): Update black to 22.8.0 (#11596)
* chore(deps): Update `black` to `22.8.0`

* Format
2022-09-05 14:38:54 +02:00
Michael Matloka
076f369c13
refactor: Remove obsolete Zapier hook code (#11614)
* refactor: Remove obsolete Zapier hook code

* Format code
2022-09-02 10:30:35 +00:00
Neil Kakkar
6cff7aef16
fix: snapshots on master (#11611) 2022-09-01 17:24:54 +01:00
Karl-Aksel Puulmann
38476aec71
fix(persons): un-ratelimit person destroy, use kafka producer for messages (#11594)
* fix(persons): Make delete_person use kafka producer

This allows these inserts _not_ to take us down

* Remove pdi deletion logic from split_person

This is not needed with the new pdi2 table

* Update create_person_distinct_id to accept is_deleted argument

* Refactor `delete_ch_distinct_ids` to avoid sync_execute

* Remove person#destroy rate limiting

This reverts https://github.com/PostHog/posthog/pull/11576

* Update splitting tests

* Skip tests when not on person-on-events
2022-09-01 14:54:49 +03:00