* 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>
## 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>
* fix: correct type hint for plugin activity logs
* Update snapshots
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* 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>
* 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
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
* 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
* 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>
* 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