* fix subquery for sessions in base_event_query/2
As the 'sessions' table is using the CollapsingMergeTree engine, we have
to select session_id's distinctively. Otherwise we will get multiple rows
(with sign -1 and 1) as long as the background merge hasn't happened.
* update changelog
* use GROUP BY instead of SELECT DISTINCT
* remove comma
* Fingerprint DBConnection.ConnectionError in Sentry
* Check events before creating a site
* Enable sites limit screen
* Remove debugging remnant
* Fix buggy assertions
This wasn't doing what expected:
iex(1)> Repo.exists?(Plausible.Site, domain: "foo")
[debug] QUERY OK source="sites" db=0.6ms idle=1906.2ms
SELECT TRUE FROM "sites" AS s0 LIMIT 1 []
* Encapsulate check to satisfy credo
* Use less technically involved error message
* Bring back e-mail to the limit error message
This commit stops logging `{:invalid_address, "ip"}` errors. This
reduces noise on Sentry, that is capturing error logs. Other errors are
still logged.
* extract maybeUpdateMetric function
* reset graph metric after fetching top stats
* fix bug
Also make sure we do not allow 'metric' to become undefined anymore
* keep graph hidden when empty metric saved
* reset metric in setState callback
* pass function not call
This PR replaces geolix with locus to simplify self-hosted setup. locus can auto-update maxmind dbs which are recommended for self-hosters if they want city-level geolocation. locus is also a bit faster.
This PR also uses a test mmdb file from https://github.com/maxmind/MaxMind-DB for e2e geolocation tests without stubs.
* extract blinkingDot function
* position pulsating-circle with tailwind instead
* remove unused function
* extract renderStatName function
* display seconds since last realtime update
Adds a 'Last updated X seconds ago' label to the Current Visitors tooltip.
* small refactor: avoid duplication of this.props and this.state
* show the 'last updated ...' tooltip in historical
* changelog update
* use className utility function
* Filter DBConnection logs for clickhouse in Sentry
Removing the never matching clause btw
* Exclude Plug.CSRFProtection.InvalidCSRFTokenError from Sentry
* Turn common Sentry captures into logged warnings
* Exclude fonts from static conf and InvalidPathError from Sentry
* Add Checkly Terraform config
* add deployment workflow
* use pagerduty instead of email for notifications
* use terraform cloud backend
* update variable declaration
* rename checkly check group
* update syntax
* test trigger
* Revert "test trigger"
This reverts commit 333e82beac.
* run a single job at a time
Co-authored-by: Cenk Kücük <c@cenk.me>
* Consolidate task timeouts, incrase to 15s
* Use Task.async_stream for parallel Clickhouse queries
* Propagate Opentelemetry context to child Task process
* Fix breakdown API pagination when using event metrics
This commit fixes a bug where the subsequent breakdown API pages had
the same items as the first page. The fix sorts the underlying
ClickHouse query by timestamp, keeping the same order between requests,
as we use OFFSET/LIMIT pagination.
* Fix repeated results assertion
* Add different ORDER BY to each breakdown property
* Ignore XX and T1 countries
* Add fallback if country_code=nil
* Lookup city overrides directly in CityOverrides module
* Changelog
* Add empty moduledoc
* Remove redundant comment
* add a new realtime-update-timer module
* hook to the new 'tick' event in ListReport for auto-updates
This commit fixes the bug where all reports using the `ListReport` component did not
auto-update in realtime mode. Those reports are:
- Pages (Top / Entry / Exit)
- Locations (Countries / Regions / Cities)
- Devices (Screen Sizes / Browsers + versions / OS-s + versions)
* fetch data for ListReports only when scrolled into view
* refactor fetching data in ListReport
* refer to one source of truth for utm tags
* make the 'All' tab in Sources auto-update
* make all UTM tabs in Sources auto-update
* fetch UTM data only when scrolled into view
* auto-update Referrers with the new timer
* auto-update google search terms
* auto-update Conversions
* make countries map auto-update
* auto-update visitor-graph and top stats with new timer
* use new tick event for current visitors (in Historical)
* remove the old timer class
* update changelog
* Visual improvements to automatic realtime updates (#2532)
* minor consistency fix for text color in dark mode
* use FlipMove in goal conversions report
* use FlipMove in ListReports
* set main graph and top stats loading state correctly
* refactor isIntervalValid function
* enforce intervals are valid when set and stored
* remove duplicate data fetching on interval change
Fetching new data is handled by the `fetchGraphData` callback in `updateInterval`
* refactor updateMetric function
* make it clearer why 'metric' can be a faulty value
* extract 'query' and 'site' variables from 'this.props'
* reset interval state only when period is changed
The 'maybeRollbackInterval' function was also used to fetch data. This commit replaces
all those function calls with 'fetchGraphData' which better describes the actual behavior.
We should only worry about rolling back the interval if 'query.period' has changed.
This commit also stops the graph from flickering when it is updated in realtime.
* update names of two variables
* remove unnecessary negation
* make collapsed graph state more explicit
* consider stored invalid intervals when graph mounts
* fix not showing loading spinner regression
* remove interval state from VisitorGraph (#2540)
* Realtime prop breakdown (#2535)
* disable load more in realtime mode
* extract doFetch function
* separate fetchPropBreakdown and fetchNextPage functions
* subscribe for auto-updates in realtime
* improve readability with function name changes
* Cascade delete sent_renewal_notifications table when user is deleted
This commit fixes a bug when deleting a user would trigger a constraint
error.
* Update CHANGELOG.md
* Set pg pool size for MIX_ENV=test
* Include slow tests in CI run
* Exclude slow tests by default
* Mark tests slow/async where applicable
* Restructure captcha mocks
* Revert async where env is relied upon
* Add --max-failures=1 to CI run
* Set warnings as errors
* Disable async where various mocks are used
* Revert "Disable async where various mocks are used"
This reverts commit 2446b72a29.
* Disable async for test using vcr
* Return empty list when breaking down by event:page without events
This commit fixes a bug with pagination where breaking down by event:page
would always return results despite pagination.
Closes#2255
* Update CHANGELOG.md
* Remove show_noref behaviour
Removes query param show_noref which was used from React to control
whether to show Direct / None traffic or not. The show_noref behaviour
was untested previously.
Closes#2523
* Add changelog entry
* Fix tests
* Removed files I did not mean to check in :)
### Changes
Preparations for `v1.5.1` release.
### Tests
- [x] This PR does not require tests
### Changelog
- [x] Entry has been added to changelog
### Documentation
- [x] This change does not need a documentation update
### Dark mode
- [x] This PR does not change the UI
### Changes
This PR adds a fallback to empty build metadata when BUILD_METADATA
contains invalid JSON.
Example `warning` log for `BUILD_METADATA={...}`:
```
20:57:57.872 [warning] failed to parse $BUILD_METADATA, reason: ** (Jason.DecodeError) unexpected byte at position 1: 0x2E (".")
```
Fixes https://github.com/plausible/analytics/issues/2491
### Tests
- [x] This PR does not require tests
### Changelog
- [ ] Entry has been added to changelog
### Documentation
- [x] This change does not need a documentation update
### Dark mode
- [x] This PR does not change the UI
### Changes
Preparing for `v1.5.0` release.
### Tests
- [x] This PR does not require tests
### Changelog
- [x] Entry has been added to changelog
### Documentation
- [ ] [Docs](https://github.com/plausible/docs) have been updated
### Dark mode
- [x] This PR does not change the UI
### Changes
Hello friends, I'm trying to self-host plausible on my server and have
observed that if I add a file named (for example) `secrets/LISTEN_IP` to
configure the bind IP I'll get the following error:
```
Compiling 1 file (.ex)
** (RuntimeError) Invalid LISTEN_IP '172.19.130.83
' error: :einval
/home/serafeim/plausible/config/runtime.exs:20: (file)
```
(notice that I get the same error when configuring the DATABASE_URL or
whatever comes first)
It seems that for whatever reason the File.read! will insert a newline
at the end of the file. Notice that I have double checked the file with
vim and *it does not contain a newline at the end* or at least I don't
know *how* to make the file not have a newline at the end.
Thus I'm adding a `String.trim()` there to fix that thing; even if I am
doing something wrong and my files *do* contain a newline at the end,
adding a `String.trim()` there definite won't hurt :)
Below you'll find a checklist. For each item on the list, check one
option and delete the other.
### Tests
- [ ] Automated tests have been added
- [x] This PR does not require tests
### Changelog
- [ ] Entry has been added to changelog
- [x] This PR does not make a user-facing change
### Documentation
- [ ] [Docs](https://github.com/plausible/docs) have been updated
- [x] This change does not need a documentation update
### Dark mode
- [ ] The UI has been tested both in dark and light mode
- [x] This PR does not change the UI
This commit updates mix.exs to resolve bamboo_postmark to our fork. The
fork encodes names with quotes when building e-mails, adding support for
special names with commas and quotes. Related to
plausible/bamboo_postmark#1.
Closes#1885