Commit graph

575 commits

Author SHA1 Message Date
Pēteris Caune
b2c5e91c70
Implement legacy -> canonical timezone conversion
There are three related changes:

* Removed legacy timezones from hc.lib.tz.all_timezones
* Added data migration to update existing Check.tz values
* For backwards compatibility, added code to automatically
  replace a legacy timezone with a canonical timezone when a
  legacy timezone is passed to an API call

I used the timezone mapping on
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
2024-06-14 12:55:57 +03:00
Pēteris Caune
52f2b534a6
Fix API to accept Europe/Kiev but save it as Europe/Kyiv 2024-06-13 15:23:27 +03:00
Pēteris Caune
4ec7a48082
Update the Discord integration to disable channel on HTTP 404 responses 2024-04-26 09:25:42 +03:00
Pēteris Caune
6fb46aee32
Fix integrations to include oncalendar schedules in notifications 2024-04-24 16:08:55 +03:00
Pēteris Caune
4181399659
Fix Spike integration to not disclose check's code in incident data 2024-04-22 13:01:38 +03:00
Pēteris Caune
ddae6a04bf
Fix VictorOps integration to not disclose check's code in incident data 2024-04-22 12:57:10 +03:00
Pēteris Caune
c08ba1d872
Fix PagerTree integration to not disclose check's code in incident data 2024-04-22 12:46:18 +03:00
Pēteris Caune
994bc10857
Update PagerDuty integration to use ping.formatted_kind_created 2024-04-22 12:31:03 +03:00
Pēteris Caune
18bd44a68b
Fix PagerDuty integration to not disclose check's code in incident data 2024-04-22 12:12:22 +03:00
Pēteris Caune
5c73556050
Include ping's kind in Opsgenie notification's "Last ping" field 2024-04-19 12:19:26 +03:00
Pēteris Caune
7f03a9e738
Improve Opsgenie notifications (include description, schedule, link...) 2024-04-19 11:58:35 +03:00
Pēteris Caune
577602ae21
Fix Opsgenie integration to not disclose check's code in incident data 2024-04-19 11:24:12 +03:00
Pēteris Caune
82ed392361
Update transport classes to use regular spaces instead of non-breaking 2024-04-17 16:35:43 +03:00
Pēteris Caune
83f161d657
Update transport classes to use Transport.last_ping() consistently
* Instead of check.n_pings (int) use last_ping().n
* Instead of check.last_ping (datetime) use last_ping().created

There is a time gap from creating a flip object to processing
it (sending out an alert). We want the notification to reflect
the check's state at the moment the flip was created. To do this,
we use the Transport.last_ping() helper method which retrieves
the last ping *that is not newer than the flip*.

This commit updates transport classes and templates to use
Transport.last_ping() consistently everywhere.
2024-04-15 15:09:17 +03:00
Pēteris Caune
d8a46349a8
Update Transport.last_ping() to ignore pings newer than the flip 2024-04-15 12:47:11 +03:00
Pēteris Caune
5bdb01baf9
Fix the Zulip integration to use Flip.new_status 2024-04-12 15:43:06 +03:00
Pēteris Caune
6631a5f76a
Fix the WhatsApp integration to use Flip.new_status 2024-04-12 15:40:19 +03:00
Pēteris Caune
3301cce251
Fix the Splunk On-Call integration to use Flip.new_status 2024-04-12 15:37:43 +03:00
Pēteris Caune
6e27d88ec9
Fix the Trello integration to use Flip.new_status 2024-04-12 15:34:54 +03:00
Pēteris Caune
bcecf058c2
Fix the Telegram integration to use Flip.new_status 2024-04-12 15:33:03 +03:00
Pēteris Caune
17e9f33bb9
Fix the Spike integration to use Flip.new_status 2024-04-12 15:30:26 +03:00
Pēteris Caune
2913b8faf5
Fix the Signal integration to use Flip.new_status 2024-04-12 15:27:13 +03:00
Pēteris Caune
f673f599c5
Fix the RocketChat integration to use Flip.new_status 2024-04-12 15:18:56 +03:00
Pēteris Caune
af36078f10
Fix the Pushover integration to use Flip.new_status 2024-04-12 15:14:19 +03:00
Pēteris Caune
a485bea2b2
Fix the Pushullet integration to use Flip.new_status 2024-04-12 15:08:25 +03:00
Pēteris Caune
f24a1dbc25
Fix the PagerDuty integration to use Flip.new_status 2024-04-12 15:03:31 +03:00
Pēteris Caune
f060874be5
Fix the PagerTree integration to use Flip.new_status 2024-04-12 15:00:53 +03:00
Pēteris Caune
e5018b1195
Fix the Opsgenie integration to use Flip.new_status 2024-04-12 14:57:21 +03:00
Pēteris Caune
4da32b9214
Fix the ntfy integration to use Flip.new_status 2024-04-12 14:53:29 +03:00
Pēteris Caune
462d4776d8
Fix the MS Teams integration to use Flip.new_status 2024-04-12 14:48:19 +03:00
Pēteris Caune
b3dad4ac57
Fix the Matrix integration to use Flip.new_status 2024-04-12 14:45:13 +03:00
Pēteris Caune
1e51d0d177
Fix the LINE Notify integration to use Flip.new_status 2024-04-12 14:42:57 +03:00
Pēteris Caune
1aa068553d
Fix the Gotify integration to use Flip.new_status 2024-04-12 14:39:08 +03:00
Pēteris Caune
5b6dfb9101
Fix Slack, Discord, Mattermost integrations to use Flip.new_status 2024-04-12 14:34:55 +03:00
Pēteris Caune
2fd50312c4
Update the Call integration to take a Flip argument 2024-04-12 14:25:19 +03:00
Pēteris Caune
fe9bb0d1e5
Fix the Apprise integration to use Flip.new_status 2024-04-12 14:17:12 +03:00
Pēteris Caune
a6b8f4c71e
Fix the shell integration to use Flip.new_status 2024-04-12 14:10:34 +03:00
Pēteris Caune
8372abf019
Fix the email integration to use Flip.new_status 2024-04-12 14:05:44 +03:00
Pēteris Caune
28fdfd1362
Change Channel.notify() signature to take Flip object as an argument
... and pass it to Transport.notify_flip().

This allows us to pass flip-specific information (the flip timestamp,
the new status) to transport classes.
2024-04-12 13:54:16 +03:00
Pēteris Caune
aaa8681fec
Update Check.prune() to also delete flip objects.
Check.prune() now deletes flips older than the oldest
retained ping *and* older than 3*31=93 days.
2024-04-11 12:56:28 +03:00
Pēteris Caune
a0545b875e
Add "Last ping subject" field in email notifications 2024-03-13 15:45:27 +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
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
1322bb1123
Add support for per-check status badges
Fixes: #853
2024-02-27 12:55:51 +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
4ef470730f
Fix tests 2024-02-16 12:45:10 +02:00