You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/test/plausible
Adrian Gruntkowski f8b4d5066a
Add multiple imports per site (#3724)
* Clean up references to no longer active `google_analytics_imports` Oban queue

* Stub CSV importer

* Add SiteImport schema

* Rename `Plausible.Imported` module file to match module name

* Add `import_id` column to `Imported.*` CH schemas

* Implement Importer behavior and manage imports state using new entities

* Implement importer callbacks and maintain site.imported_data for UA

* Keep imports in sync when forgetting all imports

* Scope imported data queries to completed import IDs

* Mark newly imported data with respective import ID

* Clean up Importer implementation a bit

* Test querying legacy and new imported data

* Send Oban notifications on import worker failure too

* Fix checking for forgettable imports and remove redundant function

* Fix UA integration test

* Change site import source to atom enum and add source label

* Add typespecs and reduce repetition in `Plausible.Imported`

* Improve documentation and typespecs

* Add test for purging particular import

* Switch email notification templates depending on import source

* Document running import synchronously

* Fix UA importer args parsing and ensure it's covered by tests

* Clear `site.stats_start_date` on complete import to force recalculation

* Test Oban notifications (h/t @ruslandoga)

* Purge stats on import failure right away to reduce a chance of leaving debris behind

* Fix typos

Co-authored-by: hq1 <hq@mtod.org>

* Fix another typo

* Refactor fetching earliest import and earliest stats start date

* Use `Date.after?` instead of `Timex.after?`

* Cache import data in site virtual fields and limit queried imports to 5

* Ensure always current `stats_start_date` is used

* Work around broken typespec in Timex

* Make `SiteController.forget_imported` action idempotent

* Discard irrecoverably failed import tasks

* Use macros for site import statuses

There's also a fix ensuring only complete imports are considered
where relevant - couldn't isolate it as it was in a common hunk

* Use `import_id` as worker job uniqueness criterion

* Do not load imported stats data in plugins API context

---------

Co-authored-by: hq1 <hq@mtod.org>
3 years ago
..
auth Bugfix: available features for expired trials, no subscriptions (#3740) 3 years ago
billing Bugfix: available features for expired trials, no subscriptions (#3740) 3 years ago
google Add multiple imports per site (#3724) 3 years ago
imported Add multiple imports per site (#3724) 3 years ago
ingestion IP Block List (#3761) 3 years ago
plugins/api Remove custom domains support + update build options (#3559) 3 years ago
session Flush Clickhouse buffers faster by encoding early (#3623) 3 years ago
shield IP Block List (#3761) 3 years ago
site Generalize Cache/Warmers - extract only specifics to `Site.Cache` (#3716) 3 years ago
stats Add multiple imports per site (#3724) 3 years ago
cache_test.exs IP Block List (#3761) 3 years ago
config_test.exs add LOG_FAILED_LOGIN_ATTEMPTS (#2936) 4 years ago
debug_replay_info_test.exs Upgrade Erlang/Elixir stack (#3454) 3 years ago
funnels_test.exs Add small build option (#3536) 3 years ago
goals_test.exs Small build updates (#3546) 3 years ago
http_client_test.exs Upgrade stack (deps, elixir 1.16, OTP 26.2.1) (#3678) 3 years ago
mailer_test.exs add MAILER_NAME (#2937) 4 years ago
pagination_test.exs Generalize Cache/Warmers - extract only specifics to `Site.Cache` (#3716) 3 years ago
props_test.exs Update plans_v4.json with new plans IDs (#3436) 3 years ago
purge_test.exs Add multiple imports per site (#3724) 3 years ago
rate_limit_test.exs Fix flaky test: wait till ets is emptied (#3755) 3 years ago
release_test.exs Remove custom domains support + update build options (#3559) 3 years ago
sentry_filter_test.exs derive jason encoder for request (#3182) 3 years ago
shields_test.exs IP Block List (#3761) 3 years ago
timezones_test.exs Fix timezone list when time changes (#2268) 4 years ago