Commit Graph

1918 Commits

Author SHA1 Message Date
dependabot[bot]
e71e3717b3
Bump @playwright/test from 1.31.1 to 1.31.2 in /tracker (#2721)
Bumps [@playwright/test](https://github.com/Microsoft/playwright) from 1.31.1 to 1.31.2.
- [Release notes](https://github.com/Microsoft/playwright/releases)
- [Commits](https://github.com/Microsoft/playwright/compare/v1.31.1...v1.31.2)

---
updated-dependencies:
- dependency-name: "@playwright/test"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-30 13:11:27 -03:00
Uku Taht
9a4c4f46bb
Remove empty filters from suggestions query (#2801) 2023-03-29 09:45:58 -03:00
Uku Taht
70f1c6538d
Fix open state in combobox (#2797)
* Fix open state in combobox

* Improve filter suggestions when using the `contains` filter

* Support contains filter type for utm filter group

* Remove console.log
2023-03-28 20:06:37 +02:00
ruslandoga
66be99b38a
update chto for missing source in telemetry fix (#2787) 2023-03-28 07:06:03 +02:00
hq1
e8509203a2
Update location dependency (faster startup) (#2793)
* Update location dependency (faster startup)

* Update with https://github.com/plausible/location/pull/6
2023-03-27 16:56:34 +02:00
RobertJoonas
bc835895a2
Rename dimensions script to pageview-props (#2786)
* rename dimensions script to pageview-props

* commit mix.lock change
2023-03-27 17:50:15 +03:00
Vini Brasil
5fe32b59cd
Control comparison datepicker using React state (#2784)
This commit improves the datepicker state management. Due to a bug, we
needed to use setTimeout to open Flatpickr. This change replaces the
setTimeout workaround by using a proper React state.
2023-03-27 11:03:14 -03:00
Uku Taht
46048e50f7
Support multiple filters - frontend (#2773)
* Wrap Plausible.Stats.Filters with unit tests

* Parse `member` filter type

* Support for `member` filter in `aggregate_time_on_page`

* Support `not_member` filter type

* Support `matches_member` and `not_matches_member` filters

* Extract util module for React filters

* Implement Combobox from scratch with no libs

* Support multple filter clauses in combobox

* Don't use browser / os in version label

* Show highlighted option in combobox

* WIP

* Fix location filters outside filter modal

* Align open/close behaviour with react-select

* Styling updates for combobox

* Add support for wildcards in Combobox

* Implement keybindings for combobox

* Allow free choice inputs in combobox

* Rename 'Save filter' -> Apply filter

* Remove TODO comment

* Clean up some rebase mistakes

* Rename `allowWildcard` -> `freeChoice`

* Dark mode fixes

* Remove hint from filter modal

* Escape pipe character in filter modal

* Do not allow selecting duplicate options in combobox

* Escape brackets in `page_regex/1`

* Fix disabled style in dark mode

* Add regex fallback for safari

* Show no matches found when visibleOptions is empty

* Disable enter key when no visible options

* Do not submit empty form fields

* Remove unnecessary setOpen(true)
2023-03-27 16:51:31 +03:00
hq1
d2f2c69387
Conditionally support switching between v1 and v2 clickhouse schemas (#2780)
* Remove ClickhouseSetup module

This has been an implicit point of contact to many
tests. From now on the goal is for each test to maintain
its own, isolated setup so that no accidental clashes
and implicit assumptions are relied upon.

* Implement v2 schema check

An environment variable V2_MIGRATION_DONE acts like
a feature flag, switching plausible from using old events/sessions
schemas to v2 schemas introduced by NumericIDs migration.

* Run both test suites sequentially

While the code for v1 and v2 schemas must be kept still,
we will from now on run tests against both code paths.
Secondary test run will set V2_MIGRATION_DONE=1 variable,
thus making all `Plausible.v2?()` checks return `true'.

* Remove unused function

This is a remnant from the short period when
we would check for existing events before allowing
creating a new site.

* Update test setups/factories with v2 migration check

* Make GateKeeper return site id along with :allow

* Make Billing module check for v2 schema

* Make ingestion aware of v2 schema

* Disable site transfers for when v2 is live

In a separate changeset we will implement simplified
site transfer for when v2 migration is complete.
The new transfer will only rename the site domain in postgres
and keep track of the original site prior to the transfer
so we keep an ingestion grace period until the customers
redeploy their scripting.

* Make Stats base queries aware of v2 schema switch

* Update breakdown with v2 conditionals

* Update pageview local start with v2 check

* Update current visitoris with v2 check

* Update stats controller with v2 checks

* Update external controller with v2 checks

* Update remaining tests with proper fixtures

* Rewrite redundant assignment

* Remove unused alias

* Mute credo, this is not the right time

* Add test_helper prompt

* Fetch priv dir so it works with a release

* Fetch distinct partitions only

* Don't limit inspect output for partitions

* Ensure SQL is printed to IO

* Remove redundant domain fixture
2023-03-27 13:52:42 +02:00
Uku Taht
a75d0b35b0
Fix Timex.total_offset blowing up during clock changes (#2788)
* Fix Timex.total_offset blowing up during clock changes

* Format large numbers with underscore in tests

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

---------

Co-authored-by: Adam <hq@mtod.org>
2023-03-24 10:41:01 -03:00
Adam
6637751a5e
Implement Numeric IDs migration (#2762)
* Implement Numeric IDs migration

* Fix typo

* Mute credo for now

* Improve configurability and add stop_t

* Adjust to Ch/Chto only

* Fix opts key for dictionary password

* Add regular ecto migration with numeric ids v2 schemas (#2768)

* Add regular ecto migration

* Fix typo

* Update priv/ingest_repo/migrations/20230320094327_create_v2_schemas.exs

Co-authored-by: Vini Brasil <vini@hey.com>

* Implement v2 events/sessions schema modules (#2777)

* Implement v2 events/sessions schema modules

* Clean up session schemas

---------

Co-authored-by: Vini Brasil <vini@hey.com>

* Update moduledocs

---------

Co-authored-by: Vini Brasil <vini@hey.com>
2023-03-23 09:47:41 +01:00
ruslandoga
a129bf82e0
use github: plausible/chto for chto (#2782)
* use github: plausible/chto for chto

* use chto with correct ch github reference (plausible/ch)
2023-03-22 14:56:57 +01:00
Vini Brasil
87a63fe28a
Custom comparison mode (#2753)
This commit implements the custom comparison mode using a date range.
2023-03-22 09:31:44 -03:00
Marko Saric
9f71bb3921
Updating password reset copy (#2775) 2023-03-22 11:38:30 +02:00
Adam
baa04be191
Remove obsolete migration config (#2769)
The compilation warning advises to use `Application.compile_env/3`
however there is no `:url` environment setting under `:plausible` key
anyway, so we might as well get rid of it completely.
2023-03-22 11:32:24 +02:00
Uku Taht
a154a4214b
Support multiple filters - backend (#2749)
* Wrap Plausible.Stats.Filters with unit tests

* Parse `member` filter type

* Support escaped | in member filter

* Support for `member` filter in `aggregate_time_on_page`

* Add support for `member` filter type on goals

* Disable Credo warning

* Support `not_member` filter type

* Disable credo for `query_sessions`

* Support `matches_member` and `not_matches_member` filters

* Disable Credo for `Filters.filter_value/2`

* Support `matches_member` and `not_matches_member` for goal filter

* Support for contains_member and friends

* Updates for new chto driver

* make top_stats_test.exs:203 pass (#2779)

---------

Co-authored-by: ruslandoga <rusl@n-do.ga>
2023-03-22 11:01:25 +02:00
Adam
6d79ca5093
Switch to new clickhouse adapter (ch/chto) (#2733)
* another clickhouse adapter

* don't restore stats_removal.ex

* fix events main-graph error (#2746)

* update ch, chto

* update chto again (#2759)

* Stop treating page filter as an entry_page filter (#2752)

* remove dead code

* stop treating page filter as entry page filter in breakdown queries

* stop treating page filter as entry page filter in aggregate queries

* stop treating page filter as entry page filter in timeseries queries

* mix format

* update changelog

* break code down to smaller functions to keep credo happy

* remove unused functions

* make CSV export return only conversions with goal filter (#2760)

* make CSV export return only conversions with goal filter

* update changelog

* update elixir version in mix.exs (#2742)

* revert admin.ex changes (#2776)

---------

Co-authored-by: ruslandoga <67764432+ruslandoga@users.noreply.github.com>
Co-authored-by: ruslandoga <rusl@n-do.ga>
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
2023-03-21 09:55:59 +01:00
Adam
736e6e385c
Capture no_cache sentry messages together (#2772) 2023-03-20 14:03:05 +01:00
ruslandoga
c245e3f824
update elixir version in mix.exs (#2742) 2023-03-20 11:15:08 +01:00
RobertJoonas
4175a7abae
make CSV export return only conversions with goal filter (#2760)
* make CSV export return only conversions with goal filter

* update changelog
2023-03-20 10:40:37 +02:00
RobertJoonas
d0895efbdd
Stop treating page filter as an entry_page filter (#2752)
* remove dead code

* stop treating page filter as entry page filter in breakdown queries

* stop treating page filter as entry page filter in aggregate queries

* stop treating page filter as entry page filter in timeseries queries

* mix format

* update changelog

* break code down to smaller functions to keep credo happy

* remove unused functions
2023-03-15 18:12:59 +02:00
Adam
4654a50365
Revert "Fail CI when tests are logging (#2748)" (#2758)
This reverts commit 05d14774be.
2023-03-15 13:13:46 +01:00
Marko Saric
2204d67260
Add a note that a subscription is not transferred alongside a site (#2750)
* Add a note that a subscription is not transfered alongside a site

* Update transfer_ownership_form.html.eex

* Format membership/transfer_ownership_form.html.eex

---------

Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-03-15 08:17:07 -03:00
Vini Brasil
49e4c2fb64
Improve comparisons navigation (#2736)
This pull request enhances the navigation for comparisons by implementing the following changes:

* Hides the comparison input behind the period picker, making the top bar less busy.
* Adds a key binding for the comparison input (assigned to x) alongside arrow navigation.
* Persists the selected comparison mode in Local Storage by domain, resulting in its persistence between refreshes.
2023-03-15 07:30:05 -03:00
Marko Saric
b17710a706
Removing the notes about the 48 hour deletion delay (#2735)
* Update site.ex

* Update settings_danger_zone.html.eex
2023-03-14 07:47:35 -03:00
Uku Taht
8c8cf23bf0
Embedded dashboard fixes (#2744)
* Add padding to embedded dashboards

* Changelog entry

* Do not check origin in iframe-resizer
2023-03-14 07:47:07 -03:00
Adam
05d14774be
Fail CI when tests are logging (#2748)
A re-iteration of a miserable attempt from #2694

Hi @dgvncsz0f, how you've been ;D
2023-03-14 07:45:41 -03:00
RobertJoonas
a490016f6e
fix test to make build green (#2747) 2023-03-14 09:25:18 +02:00
Adam
59a76dedf1
Revert "Fail the CI if tests emit log errors/warnings (#2694)" (#2745)
* Revert "Fail the CI if tests emit log errors/warnings (#2694)"

This reverts commit ef894b0546.

* Mute a test
2023-03-13 16:13:17 +01:00
Adam
3417b2dd0e
Disallow site creation with insufficient input (#2741) 2023-03-10 16:32:10 -03:00
RobertJoonas
ad3edbfb9a
Bug fix - show views_per_visit when stats include imported data (#2738)
* show views_per_visit with imported data

* use optional chaining instead
2023-03-10 10:28:01 +02:00
RobertJoonas
4eca1aef70
fix a bug in percent change calculation (#2731) 2023-03-08 08:45:04 -03:00
Adam
4b21b4e6d0
Remove Firewall plug; redundant at infra level (#2730)
* Remove Firewall plug; redundant at infra level

* Update changelog
2023-03-08 09:07:15 +01:00
Vini Brasil
8b0f0cabc2
Implement "Year over Year" comparison mode (#2704)
This pull request adds support for multiple comparison modes, changes the comparison checkbox to a combobox, and implements the year over year comparison mode. The feature is still behind a feature flag.

Co-authored-by: Uku Taht <uku.taht@gmail.com>
2023-03-07 12:52:26 -03:00
RobertJoonas
874d664521
Add the new Views per Visit metric to dashboard Top Stats and CSV export (#2728)
* globally rename 'pages_per_visit' to 'views_per_visit'

* change the order of top stats

* rename 'Visits' to 'Total visits' in the UI

* add views_per_visit to UI

* put the new metric under a feature flag

* add new metric to CSV export under feature flag

* mix format

* use only one feature flag
2023-03-07 13:58:36 +02:00
RobertJoonas
0d6c72d50f
Add new Pages / Visit metric to Stats API Aggregate and Timeseries (#2714)
* refactor metric validation

* link to the correct docs section

* add the new metric to aggregate API

* explicitly remove __internal_visits

The overall metric selection is well defined by
`Plausible.Stats.Timeseries.empty_row/2`. The only metric that needs
to be removed from the timeseries response is __internal_visits.

This commit also moves the `remove_internal_visits_metric` function to a
new Util module to be used by both breakdown and timeseries.

* add the new metric to timeseries API

* mix format

* add moduledoc to keep credo happy

* convert pages_per_visit to string straight away

* do rounding in db query

* query # of visits with sum(sign) instead

* stop converting pages_per_visit to string
2023-03-06 12:07:53 +02:00
Uku Taht
43bf7dd09f
Use user-agent instead of screen_width to get device type (#2711)
* Use user-agent instead of screen_width to get device type

Co-authored-by: eriknakata <erik.nakata5@gmail.com>

* Fix credo

* Log on unhandled UAInspector device type

* Make 'browser' the default tab in devices report

* Remove device tooltip

* Remove screen_width from ingestion completely

* Remove browserstack harness, run playwright directly

* Select meta key based on OS platform

* Run CI tests in parallel

* Improve device match readability

* Add changelog

---------

Co-authored-by: eriknakata <erik.nakata5@gmail.com>
2023-03-02 11:04:01 +01:00
Uku Taht
f26ca7da9f
Update native stats start date when transferring (#2719) 2023-03-02 11:01:57 +01:00
Adam
8f86036e57
Keep track of native stats start timestamp when retrieving data (#2715)
* Stats boundary/PoC?

* Delete stats removal

* Drop events check on site creation

* Update seeds script

* Use native_stats_start_at

* Don't rely on native stats pointer in imported stats queries

* Reset site

* Export reset/1

* Remove unnecessary inserted_at settings

* Update seeds

* Remove unnecessary inserted_at setting
2023-03-01 13:11:31 +01:00
Adam
05e7f93da2
Add a migration for native_stats_start_at (#2716) 2023-03-01 12:01:27 +01:00
Adam
de0f68a647
Pin merged deps after #2693 (#2710) 2023-02-27 15:23:05 +01:00
Adam Rutkowski
2d8775e5ef
Add extra error info + telemetry for AsyncInsertRepo (#2708)
* Add extra error info + telemetry for AsyncInsertRepo

* format
2023-02-25 13:39:24 +01:00
Adam Rutkowski
867dad6da7
Implement ingest counters (#2693)
* Clickhouse migration: add ingest_counters table

* Configure ingest counters per MIX_ENV

* Emit telemetry for ingest events with rich metadata

* Allow building Request.t() with fake now() - for testing purposes

* Use clickhousex branch where session_id is assigned to each connection

* Add helper function for getting site id via cache

* Add Ecto schema for `ingest_counters` table

* Implement metrics buffer

* Implement buffering handler for `Plausible.Ingestion.Event` telemetry

* Implement periodic metrics aggregation

* Update counters docs

* Add toStartOfMinute() to ordering key

* Reset the sync connection state in `after` clause

* Flush counters on app termination

* Use separate Repo with async settings enabled at config level

* Switch to clickhouse_settings repo root config key

* Add AsyncInsertRepo module
2023-02-23 14:34:24 +01:00
Adam Rutkowski
7dec454a23
Don't rely on Mix.env check in runtime (#2703) 2023-02-23 10:35:46 +01:00
Adam Rutkowski
043e3ed572
Clickhouse migration: add ingest_counters table (#2692)
* Clickhouse migration: add ingest_counters table

* Add toStartOfMinute() to ordering key

* Explicitly include column to be summarized
2023-02-23 09:34:44 +01:00
RobertJoonas
bc557b78fd
Add visits metric under a feature flag (#2687)
* Add visits metric and make it graphable

* include visits metric in csv export (visitors.csv)

* put visits under a feature flag (CSV export)

* feature flag for displaying visits on the dashboard

* fix formatting

* add visits metric to top stats (fix)

* fix imported_test to expect visits metric included

* fix formatting
2023-02-22 18:10:18 +02:00
Vini Brasil
858687c77b
Fix graph z-index property (#2699)
* Revert "Fix graph element z-index (#2698)"

This reverts commit 35ab26308d.

* Revert "Fix interval selector z-index (#2696)"

This reverts commit c307057386.

* Set graph z-index to zero

* Add as={Fragment} to Transition component
2023-02-22 15:54:24 +02:00
Vini Brasil
35ab26308d
Fix graph element z-index (#2698)
Previously, the graph element was overlapping with other UI elements
such as the period input. This commit fixes this issue by setting the
z-index of the graph element to 0, which moves it behind other elements
in the stacking order.
2023-02-22 09:23:38 -03:00
Adam Rutkowski
ecb552479f
Upgrade erlang/elixir/alpine stack (#2695)
* Dockerfile: pin elixir-1.14.3, erlang-25.2.3, alpine-3.17.0

* asdf: pin erlang 25.2.3, elixir 1.14.3-otp-25

* Remove nonsense

* Remove erlang dupe

* Remove erlang, it's in the base image already

* Remove empty file

* Truncate seconds in NaiveDateTime instances

* Bump cache key

* Mitigate Error:error:0308010C:digital envelope routines::unsupported

See: https://www.newline.co/@kchan/how-to-fix-the-error-errorerror0308010cdigital-envelope-routinesunsupported--0f8d3f17

* Upgrade to latest alpine image and pin to an exact digest

* Revert "Upgrade to latest alpine image and pin to an exact digest"

This reverts commit cdf6624efa.

* Pin alpine image to an exact digest

---------

Co-authored-by: Cenk Kücük <c@cenk.me>
2023-02-22 09:49:43 +01:00
Vini Brasil
c307057386
Fix interval selector z-index (#2696)
This commit fixes a bug where the interval selector was not clickable
because it was behind the graph.
2023-02-21 13:57:44 -03:00