* feat(trends): add moving average `smoothing_intervals` param
This will average over the preceding `smoothing_intervals` intervals.
The driver for this is to remove either weekly or monthly trends.
Limitations at the moment are that it only works for total volume
queries, as it relies on the results from clickhouse being from a single
timeline series.
* WIP UI for selecting smoothing
* WIP: Fix typing and appearce logic
* Made smoothing extensible beyond day
* Test now considers a non-trivial case
* chore(smoothing): use url params for state storage of smoothing value
This should allow for url navigation to work, although I haven't quite
figured out how we then use this to make the insights/trends POST
request
* Added further tests for smoothing intervals
* fix test_to_dict
* fix trend tests
* Added test to validate preceeding limit
* Fixed test for 2 interval
* clear django redis cache before each test
* add explicit ordering to dashboard items in refresh test
Otherwise the test is not deterministic.
* Revert "clear django redis cache before each test"
This is a good thing to do, but I don't want to open up a discussion on
this PR. It was not fix for the immediate intermittent
test_refresh_cache test
This reverts commit aa52f332f3.
* format
* clickhouse trends: SET allow_experimental_window_functions = 1
* fix setting of allow_experimental_window_functions
* add cache clears for requests
* Delete SmoothingFilterLogic.ts
Removed smoothing filter logic file
* Use `SMOOTHING_INTERVALS` instead of string literal
This should ensure that if we update the url param key somewhere, we don't have to remember to change it here as well.
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
* move test_trends to ee
* actually delete test_trends.py
* Transitioned smoothing logic to use Logic
* WIP: Moving away from url based logic
* WIP: Refactored logic on listeners
* fix storybook
* refactor
* set redis url
* remove keastory
* Move interval filter to setFilters insight logic
* update trend snapshots
* run prettier
* Add stickiness test deps that were in test_trends
* Fix storybook
* fix stickiness tests
* update snapshot
* fix cohort test
* only display smoothing on linear
* fix tests
* Add some tests
* added box to make dropdown consistent
* Floor
* fix tests
* fix tests
* fix test
* Add feature flag
Co-authored-by: Marcus Hyett <marcus@posthog.com>
Co-authored-by: Marcus Hyett (PostHog) <85295485+marcushyett-ph@users.noreply.github.com>
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
Co-authored-by: Tim Glaser <tim@glsr.nl>
* refactor(stickiness): refactor one stickiness test to use api
This change demonstrates how to migrate a `Query` object level test to
an api based test. It purely focuses on the method of action invocation
and not on any of the e.g. setup or assertions. The StickinessQuery
object is only used by the REST API (and benchmarking), where as the
REST stickiness API is used by external users including our own frontend
developers, so makes sense to test at this level.
* Migrate stickiness query tests to api
This doesn't touch the stickiness people API however
* Migrate clickhouse specific stickiness tests
* Migrate stickiness people query tests to http api level
NOTE! This isn't just a straight migration, but also makes one important
change to application code that would otherwise result in a test
failure. Specifically, when trying to find an action based on the
`entity_id` query param, we need to consider that the entity_id is a
string. This is fine for when trying to find events, as we are comparing
event ids which are strings, but for actions the id is an int, so we
need to ensure we cast the action id to a string before comparison.
* Move stickiness query tests to api tests location
* make stickiness tests stable across postgres/clickhouse
* Add comment regarding casting action ids to strings