Commit graph

2004 commits

Author SHA1 Message Date
Pēteris Caune
3026162a85
Fix date bounds check in log_events
log_events was using Check.created as the lower bound.
If a check has many pings, we need to use the oldest
visible ping's date as the lower bound, otherwise
we may return notifications older than the oldest visible
ping.
2024-03-21 11:37:46 +02:00
Pēteris Caune
855fac0973
Implement filtering by event type in the Log page
Fixes: #873
2024-03-21 11:04:45 +02:00
Pēteris Caune
df6895ed1f
Fix regression in log auto-updating code
Also switch back to using integers for the slider min and max
values, and for the hc.front.forms.LogFilterForm.
2024-03-19 19:11:46 +02:00
Pēteris Caune
47894f6add
Rearrange the log page to make room for more filters
* Switch from nouislider to simpler <input type="range">
* Move it to a sidebar

Also, fix a bug in _get_events where the "start" local variable
got clobbered, and made the date range for the Notification
query wrong.
2024-03-19 18:47:13 +02:00
Pēteris Caune
22325565b5
Remove unused import 2024-03-18 13:02:46 +02:00
Pēteris Caune
3615d26aea
Remove debug statement 2024-03-18 12:56:18 +02:00
Pēteris Caune
274a59956a
Make statsd metrics collection optional
To enable, set STATSD_HOST env var (or set STATSD_HOST in
local_settings.py):

STATSD_HOST=localhost:1234

cc: #974
2024-03-18 12:55:36 +02:00
Pēteris Caune
33e58fa014
Change the signup flow to accept registered users
(and sign them in instead)
2024-03-15 17:30:06 +02:00
Pēteris Caune
49b496fc3f
Add a decimal place in the reported uptime percentage
(for example, instead of "uptime: 99.9%" report "uptime: 99.93%)
2024-03-14 10:25:53 +02:00
Pēteris Caune
a0545b875e
Add "Last ping subject" field in email notifications 2024-03-13 15:45:27 +02:00
Pēteris Caune
638d11c969
Improve type hints 2024-03-05 17:18:55 +02:00
Pēteris Caune
5715ac9f24
Simplify Signal response parsing 2024-03-04 12:31:18 +02:00
Pēteris Caune
5c82b2e9ac
Add handling for Signal messages with null recipient number
If the recipient has set up an username, the responses
from Signal will return "number": null.

Example scenario:

* Alice sets up a Signal integration
* Alice sets up an username for their Signal account
* Alice deletes their Signal account
* Healthchecks sends a message to Alice's Signal account
* Signal responds with UNREGISTERED_FAILURE, but the
  number field in the response is null

The fix is to:

* Allow null in the "number" field as a valid value
* Ignore the value of the "number" field when reading Signal responses
2024-03-04 12:26:56 +02:00
Pēteris Caune
d7b683e9d1
Update more notification templates to handle Check.last_ping == None 2024-03-01 16:25:05 +02:00
Pēteris Caune
4d2a3227f3
Update more notification templates to handle Check.last_ping == None 2024-03-01 16:07:13 +02:00
Pēteris Caune
b0c0c1d8c3
Fix top nav in the badges page 2024-03-01 12:36:29 +02:00
Pēteris Caune
4c97068776
Update notification templates to handle Check.last_ping == None 2024-02-29 14:38:35 +02:00
Pēteris Caune
8955c1d7cd
Remove "Last ping was <time interval> ago." from WhatsApp messages
In some rare cases the last ping can be None (i.e., there was no
last ping). In these cases we would need to omit the
"Last ping was <time interval> ago." part from the message.
To avoid creating a *third* WhatsApp content template, remove
the "Last ping was <time interval> ago." part from the message
altogether.

What are the cases when last ping could be None? Here's one:

* User creates a check
* User sends a "/start" signal
* The grace time passes, the check goes down. There's no
  previous "success" or "fail" signal, so the check's
  "last_ping" field will be None.
2024-02-29 11:42:44 +02:00
Pēteris Caune
af6731a24f
Fix code to use project.check_set instead of Check.objects.filter(...)
No functional difference, just cleaner.
2024-02-28 10:01:52 +02:00
Pēteris Caune
1322bb1123
Add support for per-check status badges
Fixes: #853
2024-02-27 12:55:51 +02:00
Pēteris Caune
4959856e58
Redesign the "Status Badges" page 2024-02-26 12:34:26 +02:00
Michael Boateng
9770bc1ea0
Add auto-refresh functionality to log page (#963)
Add auto-refresh functionality to log page

Fixes: #957

---------

Co-authored-by: Pēteris Caune <cuu508@gmail.com>
2024-02-23 11:36:31 +02:00
Pēteris Caune
f6378fc26b
Fix Gotify integration to handle Gotify server URLs with paths
Fixes: #964
2024-02-20 10:12:54 +02:00
Pēteris Caune
52a8df4dbf
Fix naturaltime usage in the WhatsApp integration
When preparing WhatsApp payload we call naturaltime() and
serialize its output as JSON. naturaltime can return a lazy object
which causes an exception during JSON serialization. The fix
is to wrap naturaltime in str() to force its output to be a string.
2024-02-17 10:05:59 +02:00
Pēteris Caune
12b5c36897
Add a system check that warns about WhatsApp misconfiguration 2024-02-16 12:58:48 +02:00
Pēteris Caune
4ef470730f
Fix tests 2024-02-16 12:45:10 +02:00
Pēteris Caune
ec0791b4ee
Update the WhatsApp integration to use Twilio Content Templates 2024-02-16 12:37:11 +02:00
Pēteris Caune
1250195e3e
Add support for $NAME_JSON and $BODY_JSON placeholders 2024-02-14 11:52:35 +02:00
Pēteris Caune
b1cd529532
Fix type annotation 2024-02-12 11:34:27 +02:00
Pēteris Caune
33284bd93f
Fix MariaDB version check
Naively comparing with string "10.7" does not quite work for
versions 10.10 and 10.11 :-)
2024-02-09 14:01:48 +02:00
Pēteris Caune
d881afa3f0
Add a system check to warn about a required MariaDB UUID migration
cc: #929
2024-02-09 11:32:30 +02:00
Michael Boateng
6bfd9c901c
Make grace time editable when job is created (#953)
Fixes: #945
2024-02-08 15:34:52 +02:00
Pēteris Caune
4d0cf7fb80
Remove @nolog decorator
The purpose of @nolog was to disable logging in certain
test cases to avoid console spam during tests. But with the
current logging configuration console is clean even without it.
2024-02-06 17:30:24 +02:00
Pēteris Caune
2923a39a46
Add logging for "signal-cli call failed (<error_code>)" errors 2024-02-06 17:20:29 +02:00
Pēteris Caune
79382ca82e
Fix systemd expression in a testcase to work after 2024-02-01 2024-02-02 13:00:29 +02:00
Pēteris Caune
7cb47188b9
Remove redundant cast 2024-01-22 16:09:20 +02:00
Pēteris Caune
16450a66c7
Add tooltips to tag buttons in the checks list screen
Fixes: #911
2024-01-22 15:20:09 +02:00
Pēteris Caune
42f88f4fb0
Add S3_SECURE setting
It controls whether to use secure (TLS) connection to S3 or not.
2024-01-10 12:19:45 +02:00
Pēteris Caune
ae94648efd
Fix minio-related mypy warnings
A few warnings remain, I think these should be fixed in minio-py:

https://github.com/minio/minio-py/pull/1389
2024-01-04 16:01:34 +02:00
Pēteris Caune
1284ee27a6
Fix the case where PING_BODY_LIMIT is None
cc: #931
2023-12-22 12:29:32 +02:00
Pēteris Caune
54ffe39143
Fix the handling of ping bodies > 2.5MB
Django has a DATA_UPLOAD_MAX_MEMORY_SIZE which controls the maximum
allowed request body size, and is 2.5MB by default.

We now bump up DATA_UPLOAD_MAX_MEMORY_SIZE to be no lower
than PING_BODY_LIMIT.

Fixes: #931
2023-12-22 12:05:16 +02:00
Pēteris Caune
7c5e3130fb
Hardcode a higher S3 operation timeout, add sorting by Check.code 2023-12-21 16:12:22 +02:00
Pēteris Caune
767c3ae702
Add a management command for pruning all checks 2023-12-21 14:55:05 +02:00
Pēteris Caune
b0f8c730f5
Change query in Check.prune() to work around pg index selection issue
In prune(), we need to look up the earliest ping in the database
for a given check. The old version did:

    ping = self.ping_set.earliest("id")

The new version does:

    ping = self.ping_set.earliest("created")

Both yield the same result, but in the first case Postgres may
decide to use the index for the api_ping.id column and scan
almost the entire table.

In the second case it uses the index for the api_ping.owner_id column,
and scans just the rows associated with the check.
2023-12-21 12:00:05 +02:00
Pēteris Caune
f0f2a9aed8
Add a system check which warns about missing SMTP credentials 2023-12-19 14:47:12 +02:00
Pēteris Caune
2a0b8f4e6f
Simplify datetime object initializations in tests 2023-12-19 14:20:04 +02:00
Pēteris Caune
c8897b7026
Improve the handling of StopIteration exceptions
Instead of returning a datetime in far future,
get_grace_start() now returns None which (meaning "never").
2023-12-19 14:05:10 +02:00
Pēteris Caune
1d6e7297be
Fix get_grace_start to handle StopIteration exceptions
These can happen with "one-shot" OnCalendar schedules,
for example: "2023-12-19 11:30"
2023-12-19 13:29:52 +02:00
Pēteris Caune
ce1d7bd4cb
Add a test for #930 2023-12-18 15:58:04 +02:00
Marlene Koh
2b318cab84
Fix crash when email host not configured (#930)
* Log exception when email host not configured instead of raising assertion error

* Fix tests

* Reset to master

* Check email host before sending email for project invites
2023-12-18 15:53:35 +02:00