Commit graph

333 commits

Author SHA1 Message Date
Ildar Iskhakov
1bf75d601d
Merge pull request #646 from grafana/slack-resolution-note-formatting
Use markdown formatting for web based resolution notes
2022-10-24 19:22:12 +08:00
Matias Bordese
eb32fa7ba0 Handle scenario when multiple general team manual integrations are available 2022-10-21 14:23:45 -03:00
Matias Bordese
a4830c74b7 Update ical event/user email matching to be case-insensitive 2022-10-20 16:12:41 -03:00
Matias Bordese
6439752949
Rewrite fallback condition for num escalation chains
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2022-10-20 12:57:59 -03:00
Matias Bordese
3d171f20f7 Defer large unused queryset fields when listing schedules 2022-10-19 17:07:06 -03:00
Matias Bordese
e4a7a5a23d Rework schedule escalation chains/policies count as a subquery 2022-10-19 17:07:06 -03:00
Vadim Stepanov
e67d3519fe
Restore email notifications (#621)
* remove email verification related code

* remove email verification related code

* remove sendgrid callback

* remove sendgrid related code

* remove sendgrid related code

* rename sendgrid app to email

* remove email from built-in channels

* remove email from built-in channels

* remove email from built-in channels

* add email backend: https://github.com/grafana/oncall/pull/50

* add email templater

* add email templater

* convert md to html

* add email settings to live settings

* use task to send email, handle some exceptions to create logs

* remove ERROR_NOTIFICATION_MAIL_DELIVERY_FAILED usage

* add email limit logic

* fix tests

* add docs

* remove old email templates

* remove old email templates

* add template_fields to messaging backend

* add messaging backends templates to public api

* add comment for deprecated fields

* fix test

* fix tests

* disable email by default

* don't retry on SMTPException and TimeoutError

* add tests

* bring email back to public api docs

* return ERROR_NOTIFICATION_MAIL_LIMIT_EXCEEDED

* make template_fields tuple

* build_subject_and_title -> build_subject_and_message

* add one more comment about template deprecation

* use 8 as backend id

* add comment about gaierror and BadHeaderError

* add comment on importing in notify_user_async

* edit oss docs
2022-10-19 12:32:56 +01:00
Ben Sully
e36757b293
Allow non-JSON custom webhook templates, provided they render as valid JSON (#639)
* Allow non-JSON custom webhook templates, provided they render as valid JSON

Previously, both the provided template _and_ the rendered template had
to be valid JSON in order for validation to pass. This was unnecessarily
restrictive: really, only the rendered template needs to be valid JSON.
It also disallowed using templates such as:

    {
      "labels": {{ alert_payload.labels | tojson }}
    }

even though this would be valid JSON after rendering.

This commit relaxes the validation of custom webhook templates so that
they don't need to be valid JSON, provided that the rendered template
_is_ valid JSON. This is checked using a dummy dictionary of render
params, which use a constant string for the `alert_group_id` field
and a `defaultdict(dict)` for the `alert_payload` field. This should
permit templates like the one above, but still deny templates such as

    {
      "labels": {{ alert_payload.labels }}
    }

which would otherwise fail later if `labels` is not valid JSON.

This should resolve #638.

* Use defaultdict(str) instead of defaultdict(lambda: "")

* Add missing comment to resolution note validation code

* Update validation of resolution notes in public API, too

* Add extra test cases for JSON webhook templates endpoint of public API
2022-10-19 12:32:21 +01:00
Michael Derynck
8e48c441e8
Merge pull request #651 from grafana/mderynck/handle-channel-filter-exception
Catch exception for parsing regex during channel filtering
2022-10-18 09:43:08 -06:00
Michael Derynck
8ad593b36f
Merge pull request #650 from grafana/mderynck/suppress-integration-exception
Add middleware to catch exception for missing integration
2022-10-18 09:16:09 -06:00
Michael Derynck
4eb814798c Make return value explicit 2022-10-18 08:05:01 -06:00
David van der Spek
292849e782
fix relation already exists (#660)
Signed-off-by: DavidSpek <vanderspek.david@gmail.com>

Signed-off-by: DavidSpek <vanderspek.david@gmail.com>
2022-10-18 14:04:27 +01:00
Michael Derynck
c731b9b113 Catch exception for parsing regex during channel filtering 2022-10-13 18:34:04 -06:00
Michael Derynck
5f5f427c9f Add middleware to catch exception for missing integration, reduce spamminess of logs 2022-10-13 17:18:22 -06:00
Ben Sully
def8b35e74
Use markdown formatting for web based resolution notes
We would like to include some more sophisticated content in our
resolution notes (specifically URLs), so need the resolution notes to be
rendered as Markdown for this.

This PR changes _all_ resolution note text blocks to be markdown, but
perhaps it would be better to allow the caller to specify that they
would prefer markdown to plain text (this would also allow backwards
compatibility). Let me know if you'd prefer that and I can try and
figure it out!
2022-10-12 13:05:16 +01:00
Matias Bordese
f378eab7b7 Allow enabling schedules alpha per organization 2022-10-05 14:06:42 -03:00
Yulya Artyukhina
e695093c6c
Merge pull request #540 from grafana/web-schedule-fixes
Web schedule fixes
2022-10-04 17:01:00 +03:00
Ildar Iskhakov
5187dbf913
Merge pull request #595 from toro-ponz/fix/slack-format-alert-failure
Fix failure of "Format Alert" button on Slack.
2022-10-04 17:05:39 +08:00
Vadim Stepanov
b84b174e20
Allow multiple database and celery broker types (#582)
* add libs for celery + redis

* move redis & cache config to settings/base.py

* move rmq & celery config to settings/base.py

* BROKER -> BROKER_TYPE

* allow multiple database types

* flake8

* add sqlite db creation to dockerfile

* fix ci

* fix ci

* debug

* remove some defaults

* remove prints

* use local memory as cache on ci

* debug

* add DATABASE_DEFAULTS

* add ci test for sqlite + redis

* add ci test for sqlite + redis

* add ci test for sqlite + redis

* debug

* add redis healthcheck

* fix sqlite

* fix dev settings

* refactor dev settings

* tweak ci settings

* clear cache properly between tests

* move db and broker types to constants

* add librabbitmq deps

* use amqp instead of librabbitmq
2022-10-04 09:25:53 +01:00
Julia
461f284bb5 Merge branch 'dev' into web-schedule-fixes
# Conflicts:
#	engine/apps/schedules/ical_utils.py
#	engine/apps/schedules/models/custom_on_call_shift.py
2022-10-04 11:23:52 +03:00
Matias Bordese
2a3fc397db Clear users cache before schedule tests logic/asserts 2022-10-03 15:00:23 -03:00
Matias Bordese
f7c7803807 Fix related_users for no-shifts schedule 2022-10-03 14:27:22 -03:00
toro_ponz
afae3bc846 Merge remote-tracking branch 'upstream/dev' into fix/slack-format-alert-failure 2022-10-03 19:38:29 +09:00
Matias Bordese
f8314ef9c2
Fix timing issue with schedule tests reusing cached users (#592)
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2022-10-03 11:37:59 +01:00
Vadim Stepanov
5e272f8565
Fix failing tests due to bug in month calculations (#599) 2022-10-03 11:22:02 +01:00
toro_ponz
a8a88f5c00 remove wasted condition check. 2022-10-03 18:54:56 +09:00
toro_ponz
2355fa3a3c fix failure of "Format Alert" button on Slack. 2022-10-02 06:56:13 +09:00
Michael Derynck
2dda1e0a77
Merge pull request #587 from grafana/fix-resolution-note-missing-user
Catch exception for when oncall user is out of sync with slack user
2022-09-30 11:33:48 -06:00
Michael Derynck
a1c3ba330d Format 2022-09-30 10:26:47 -06:00
Michael Derynck
6dde87afde Message format 2022-09-30 10:16:03 -06:00
Michael Derynck
7d9d239452 Catch exception for when oncall user is out of sync with slack user 2022-09-30 10:14:39 -06:00
Matias Bordese
3e99b26022 Update slack lookup days when checking for next shift 2022-09-30 12:25:51 -03:00
Rares Mardare
81df9c4838
Merge pull request #520 from grafana/472-wrong-team
472 wrong team
2022-09-29 14:59:52 +03:00
Joey Orlando
9f3f691ea4
Feat 549 - add telegram permalink to alert groups http response (#551)
* rename AlertGroup.permalink to slack_permalink

* add telegram key to alert_groups permalinks object in public API response
2022-09-28 16:59:57 +02:00
Rares Mardare
ea54d21b76 Merge branch 'dev' into 472-wrong-team 2022-09-26 13:34:46 +03:00
Michael Derynck
accee4ebbe
Use create_engine_url to add prefix to previous/next links (#553)
* Use create_engine_url to add prefix to previous/next links

* Remove override of get_paginated_response since it is unchanged from parent

* More concise override

* Make both overrides behave the same

* add test for public API alert groups pagination

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2022-09-23 10:45:28 +01:00
Matias Bordese
4412ae52d2
Merge pull request #552 from grafana/matiasb/fix-outgoing-webhook-resolve-hostname
Fix outgoing webhook to resolve IP from parsed hostname
2022-09-22 20:22:29 -03:00
Matias Bordese
2988c10c92 Fix outgoing webhook to resolve IP from parsed hostname 2022-09-22 14:35:37 -03:00
Matias Bordese
8c3d5656a2
Merge pull request #548 from grafana/matiasb/rework-bulk-actions
Rework queries for alert groups bulk actions
2022-09-22 10:41:30 -03:00
Joey Orlando
e16064c6ba
#539 - add slack permalink to alert group public API response (#543)
* add .python-version to .gitignore

* add .nvmrc to frontend

Also update DEVELOPER.md to mention optionally using nvm

* update DEVELOPER.md to reflect running successfully locally

* markdown autoformatter styling changes

* add slack permalink to alertgroup public api http response

* update changelog

* address PR comments

- rename permalink to permalinks in alert group public api seralizer
- add permalinks property to AlertGroup model
- update public api alert groups test
- update alertgroups public documentation to include permalinks property

* add default DEBUG = True in dev.py settings
2022-09-22 15:17:17 +02:00
Matias Bordese
859a04e42a Add transaction blocks 2022-09-22 09:15:13 -03:00
Matias Bordese
8e7c6cf554 Rework queries for alert groups bulk actions 2022-09-21 15:50:31 -03:00
Michael Derynck
b6faf425fd Handle parse exception 2022-09-21 12:36:52 -06:00
Michael Derynck
edac2e334f Use phonenumbers package to validate live settings twilio number instead of regex to support EU number 2022-09-21 12:22:05 -06:00
Matias Bordese
1392994d26
Merge pull request #526 from grafana/matiasb/fix-all-day-filter-events
Fix support for all_day events in schedule filter_events
2022-09-21 08:58:06 -03:00
Maxim Mordasov
9330b89101
Schedules alpha fixes (#541)
* schedule alpha major fixes

* Fix shift update for web schedules

* Fix priority level regex, fix getting shifts without duration

* Fix shift update for web schedules

* Fix tests for shift update

* Fix priority level test

* schedule alpha fixes

* add final schedule click handler

* fix date time picker

* fix utc timzeonr time picker

* fix utc time data

* dont use user timezone on start

Co-authored-by: Julia <ferril.darkdiver@gmail.com>
2022-09-21 11:19:59 +01:00
Julia
996e6076ab Remove unnecessary variable 2022-09-20 16:42:58 +03:00
Julia
aeb8de96a2 Update comment for wrong_team_response in UserView 2022-09-20 14:47:42 +03:00
Julia
edba707b42 Fix priority level test 2022-09-20 14:19:32 +03:00
Julia
7571bfa625 Fix tests for shift update 2022-09-20 14:13:47 +03:00