oncall-engine/engine
Nick Moore cf589d45c6
feat: add timedeltaparse function to the jinja template (#5142)
# What this PR does
If an OnCall template needs to contain a date relative to a date in the
alert response, currently there is no way for the template to add or
subtract time from a parsed date.

This PR adds a function that allows a time-window (e.g., 1s, 5m, 6h, 7d,
2w) to be converted into a Python timedelta, which can then be added or
subtracted from a datetime. An example usage might be:

```
{% set delta = alert.timeWindow | timedeltaparse %}
{% set time = alert.startsAt | iso8601_to_time - delta | datetimeformat('%s') %}
```

## Checklist

- [X] Unit, integration, and e2e (if applicable) tests updated
- [X] Documentation added (or `pr:no public docs` PR label added if not
required)
- [X] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will show up in the
autogenerated release notes.
2024-10-09 18:27:48 +00:00
..
apps Skip user notification if alert group is already resolved (#5145) 2024-10-09 18:10:39 +00:00
common feat: add timedeltaparse function to the jinja template (#5142) 2024-10-09 18:27:48 +00:00
config_integrations Check for invalid urls in slack (#5055) 2024-09-23 08:45:32 +00:00
engine Address deprecation warnings in tests (#4681) 2024-08-13 20:51:18 +00:00
settings LOG_REQUEST_HEADERS (#5143) 2024-10-09 16:33:59 +00:00
static/images Update resolution note message shortcut instruction (#4482) 2024-06-07 13:54:45 +00:00
type_stubs/icalendar continue addressing mypy violations (#2170) 2023-06-27 10:23:08 +00:00
.dockerignore One startup command to rule them all (#760) 2022-11-07 16:34:43 +01:00
.gitignore modify push notification settings + use fcm-django library (#998) 2022-12-20 12:41:34 +01:00
celery_with_exporter.sh Add flag to debug logs (#912) 2022-11-29 11:16:42 +08:00
conftest.py Reworked declare incident escalation step (#5130) 2024-10-07 19:26:10 +00:00
Dockerfile Bump base image version (#5033) 2024-09-17 23:19:43 +00:00
grpcio-1.64.1-cp312-cp312-linux_aarch64.whl bump uwsgi to 2.0.26 + Python to 3.12.3 (#4495) 2024-06-10 15:33:37 -04:00
manage.py Instrument requests lib (#4008) 2024-03-05 05:22:34 +00:00
pyproject.toml Add doc references to regex_search jinja filter (#4973) 2024-09-04 17:47:09 +00:00
requirements-dev.in bump uwsgi to 2.0.26 + Python to 3.12.3 (#4495) 2024-06-10 15:33:37 -04:00
requirements-dev.txt address outstanding CVEs + remove plop from grafana-plugin/ (#4871) 2024-08-20 10:29:01 -04:00
requirements.in Add doc references to regex_search jinja filter (#4973) 2024-09-04 17:47:09 +00:00
requirements.txt Add doc references to regex_search jinja filter (#4973) 2024-09-04 17:47:09 +00:00
tox.ini Address deprecation warnings in tests (#4681) 2024-08-13 20:51:18 +00:00
uwsgi.ini Remove explicit request size limits (#3878) 2024-02-22 15:00:33 +00:00
wait_for_test_mysql_start.sh Revert "Revert "speed up ci builds from 15 to <7 minutes"" (#1643) 2023-03-28 09:34:03 +02:00