Commit graph

719 commits

Author SHA1 Message Date
Matias Bordese
5d383c7d1d
Trigger slack shift notifications on current shift change (#2080)
Before this change, a diff ical check (which happens with frequency with
imported ical), particularly with overrides in an API/terraform schedule
would trigger unexpected slack notifications because the prev vs current
ical comparison will flag a diff, but when comparing current and
previous shifts, `current_shifts` will have the shift in progress while
the `prev_shifts` calculated from the overrides-only diff will most of
the time be empty (unless you set/change an override at current time).

Simplified the checks to always compare previous current shifts (ie. the
ones in the schedule from the DB) vs the recalculated ones using the
(refreshed) ical data from the schedule.
2023-06-01 16:27:14 +00:00
Dieter Plaetinck
44b105343a
Better english (#1959)
Not sure if this breaks anything. it probably breaks backwards compat.

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-06-01 12:37:37 +00:00
Vadim Stepanov
d1373b58d2
Fix orphaned messages in Slack (#2023)
# What this PR does
Reworks Slack handlers for buttons and select menus for AG Slack
messages.

<img width="602" alt="Screenshot 2023-05-31 at 19 34 05"
src="https://github.com/grafana/oncall/assets/20116910/857bf096-7bdd-427b-94b6-15aad873a8ac">


## Current implementation

- It's possible to end up with orphaned Slack messages that are posted
to Slack but have no `SlackMessage` instance in the DB. For such
messages, clicking buttons will result in an exception and HTTP 500. See
private repo
[issue](https://github.com/grafana/oncall-private/issues/1841) for more
info.
- Bug in authorization system, which effectively bypasses any permission
checks. For example, it's possible to resolve an alert group while being
a Viewer.
- No tests covering most buttons.

## Changes in this PR

- Make the system more robust, don't use `SlackMessage` model to figure
out the alert group being interacted on, instead embed `alert_group_pk`
to every button and use it when receiving interaction requests from
Slack.
- Existing orphaned Slack messages will be repaired. Clicking buttons
under orphaned messages will work (and missing `SlackMessage` instance
will be created on interaction). This is possible because some buttons
already have `alert_group_pk` embedded, and it's possible to get this
data on button clicks (even if the clicked button itself doesn't have
`alert_group_pk` embedded).
- Fix authorization. Show warning window when unauthorized:
<img width="511" alt="Screenshot 2023-05-31 at 19 40 02"
src="https://github.com/grafana/oncall/assets/20116910/5abeeaa7-1b61-4a47-b3af-0e21d5cd1907">

- Added tests for all the buttons under AG message. Add tests checking
authorization, actual execution of scenario steps, orphan message
repairing, backward compatibility, etc. Also add tests on
`AlertGroupSlackRenderer` checking that correct data is embedded into
buttons.
- Cosmetic changes such as renaming `incident`  to `Alert Group`.

## Which issue(s) this PR fixes
Related to https://github.com/grafana/oncall-private/issues/1841

## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-01 10:21:30 +00:00
Matias Bordese
62a42438e5
Add extra shift changed logging (#2071) 2023-05-31 20:23:29 +00:00
Michael Derynck
61d456ce3c
Limit on Attach To action in Slack (#2049)
# What this PR does
Reduce number of alert groups returned for grouping on slack request to
20 to avoid event trigger expiry.

## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/1835

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-05-31 13:49:40 +00:00
Michael Derynck
9169eeb9df
Change email message on_delete to not block organization delete (#2060)
Change email message on delete so that email messages do not need to be
deleted before deleting an organization/user.
2023-05-31 13:44:55 +00:00
Ildar Iskhakov
5975b9dd8c
Change integrations page wording and add more guidance (#1986)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-05-31 11:26:36 +00:00
Innokentii Konstantinov
528529de23
Fix 500 on templates when slack or tg integration is disabled (#2064)
# What this PR does
Continue the work, started in
https://github.com/grafana/oncall/pull/2061.
Check if slack or telegram integration is enabled to include related
templates in the response
## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/1889

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
2023-05-31 08:22:58 +00:00
Matias Bordese
835d267fc5
Revert slack org does not exist changes breaking escalate command (#2057) 2023-05-30 15:13:48 +00:00
Matias Bordese
bd142927b5
Update find contact point name, receiver could be missing key (#2046)
Fixes issue when syncing contact points and there are receiver configs
with no `grafana_managed_receiver_configs` key.
(eg. `{"name": "autogen-contact-point-default"}`)
2023-05-29 18:52:24 +00:00
Joey Orlando
4ebc7231c9
Properly address Organization.DoesNotExist resulting in HTTP 500 on Slack interactive_api_endpoint (#2040)
# Which issue(s) this PR fixes

Closes https://github.com/grafana/oncall-private/issues/1836

## TODO:
- [ ] add unit tests for this scenario

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-29 17:06:19 +00:00
Matias Bordese
e8c9d08301
Enable selecting active days for every shift freq (#2037)
Make it possible to select "by day" active periods for every shift
frequency (ie. enable it for hourly and monthly recurrent rotations).
2023-05-29 13:33:45 +00:00
Joey Orlando
28c4cbd19d
update slack interactive_api_endpoint logging
from debug to info
2023-05-26 14:17:00 -04:00
Salvatore Giordano
20a1964936
changed notification title and subtitle; removed body (#2027)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-05-26 12:52:09 +00:00
Innokentii Konstantinov
056b0ddc7e
Add ratelimit for AmazonSNS (#2032)
Adds a ratelimit for AmazonSNS. 
AlertChannelDefining mixin is now injecting alert_receive_channel only
in request, not in kwargs to not to break AmazonSNS.
2023-05-26 09:57:26 +00:00
Michael Derynck
ae7561a84f
Map country code to different Twilio resources (#1976)
Many countries are introducing different requirements for SMS senders to
register and/or use alpha numeric ids, short codes or regional numbers
or face being blocked. The changes in this PR will give us more
flexibility by allowing us to map to different resources in Twilio based
on the phone number we are trying to reach. For this first
implementation the selection is made based on country code of the
recipient. Verification and phone calls were given the same treatment
although the immediate need is for SMS. Senders with no country code set
can be used as catch-all defaults. This also falls back to the
configured live settings/environment variables if not configured.

Possible future additions:
- Move through list of trying multiple senders before failing
notification
- Easily expanded to allow per-organization or per-user resources to let
users and tenants configure their own Twilio
- Add UI + replace live settings so users can configure their own
settings
- More selection criteria if needed

TODO:

- [x] Add+Fix Tests
- [x] Verify changes are compatible with #1713
2023-05-25 21:56:44 +00:00
Joey Orlando
7f9717fe9e
update logging for slack interactive_api_endpoint (#2022)
# What this PR does

In trying to solve
https://github.com/grafana/oncall-private/issues/1836, it is very
difficult to understand the root cause without seeing the event payload.
This PR will log this out.

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required) (N/A)
2023-05-25 15:17:42 -04:00
Yulya Artyukhina
15ef692009
OnCall prometheus metrics exporter (#1605)
# What this PR does
Add OnCall prometheus metrics exporter

## Which issue(s) this PR fixes

## Checklist

- [x] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
2023-05-25 18:26:13 +00:00
Matias Bordese
64521e721d
Handle date values coming from ical in final schedule caching (#2025) 2023-05-25 18:17:09 +00:00
Michael Derynck
6540454e58
Remove spammy log message for device not setup 2 (#2028)
This log should line should have been removed as part of #2006
2023-05-25 17:30:19 +00:00
Matias Bordese
79432bc3bc
Handle slack payload metadata limit in paging command (#2007)
Fixes https://github.com/grafana/oncall-private/issues/1838
2023-05-25 13:42:59 +00:00
Matias Bordese
a536af95f4
Refresh final schedule after cached icals are dropped (#2004)
Make sure the final schedule is refreshed after dropping the cached ical
representations (sometimes the refresh final task was completed before
the cached ical files were refreshed).
2023-05-25 12:01:52 +00:00
Joey Orlando
e69062cd73
update engine log format + log out device type when sending push notifications (#2021)
# What this PR does

- update engine log format to include `org_slug` + `user_agent`
```bash
2023-05-25 11:28:22 source=engine:app google_trace_id=none logger=root inbound latency=0.33164 status=200 method=GET path=/api/internal/v1/alertgroups/stats user_agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 content-length=0 slow=0 user_id=1 org_id=1 org_slug=self_hosted_org
2023-05-25 11:28:23 source=engine:app google_trace_id=none logger=root inbound latency=0.402866 status=200 method=GET path=/api/internal/v1/alertgroups user_agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 content-length=0 slow=0 user_id=1 org_id=1 org_slug=self_hosted_org
```
- log out device type when sending push notifications ([possible values
are `web`, `ios`, or
`android`](https://github.com/xtrinch/fcm-django/blob/master/fcm_django/models.py#L264-L266))

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required) (N/A)
2023-05-25 07:49:12 -04:00
Vadim Stepanov
12061a2a58
Handle error when updating closed modal window in Slack (#2019)
# What this PR does
Handle HTTP 500 error when attempting to update resolution note modal
window that was already closed by user.

## Which issue(s) this PR fixes
Related to https://github.com/grafana/oncall-private/issues/1834

## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-25 10:48:41 +00:00
Innokentii Konstantinov
2601d52c29
Fix status callbacks (#2014) 2023-05-25 13:53:58 +08:00
Joey Orlando
2e79c2301d
fix import issue which affected going oncall push notification (#2009)
# Which issue(s) this PR fixes
when running the mobile app (emulator) + OnCall locally and trying to
trigger "You're Going OnCall" push notifications, I was seeing this in
the `celery` logs:
```bash
2023-05-24 21:39:54,032 source=engine:celery worker=ForkPoolWorker-3 task_id=cf9e5b52-a213-430a-8e3c-d6c3bed53318 task_name=apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule name=celery.app.trace level=INFO Task apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule[cf9e5b52-a213-430a-8e3c-d6c3bed53318] retry: Retry in 2s: NameError("name 'MobileAppUserSettings' is not defined")
```

This PR patches that by adding the import (inside the relevant function,
to avoid circular imports). After adding this import, I am seeing push
notifications being sent successfully:
```bash
2023-05-24 21:44:08,910 source=engine:celery worker=ForkPoolWorker-3 task_id=71a708b5-9982-4b71-b719-17ed5867dfe1 task_name=apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule name=apps.mobile_app.tasks level=INFO Evaluating if we should send push notification for schedule 1 for user UWZ6FR5T2KG7U
2023-05-24 21:44:08,912 source=engine:celery worker=ForkPoolWorker-3 task_id=71a708b5-9982-4b71-b719-17ed5867dfe1 task_name=apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule name=apps.mobile_app.tasks level=INFO timing is right to send going oncall push notification
seconds_until_shift_starts: 476
user_notification_timing_preference: 43200
timing_window_lower: 42780
timing_window_upper: 43620
shift_starts_within_users_notification_timing_preference: False
shift_starts_within_fifteen_minutes: True
2023-05-24 21:44:08,916 source=engine:celery worker=ForkPoolWorker-3 task_id=71a708b5-9982-4b71-b719-17ed5867dfe1 task_name=apps.mobile_app.tasks.conditionally_send_going_oncall_push_notifications_for_schedule name=apps.mobile_app.tasks level=DEBUG Sending push notification with message: {"android": {"priority": "high"}, "apns": {"headers": {"apns-priority": "10"}, "payload": {"aps": {"alert": {"title": "You are going on call in 7 minutes for schedule joey test"}, "interruption-level": "time-sensitive", "sound": {"name": "default_sound.aiff"}, "thread-id": "SZM7GDPI2VI3F:UWZ6FR5T2KG7U:going-oncall"}}}, "data": {"info_notification_sound_name": "default_sound.mp3", "info_notification_volume": "0.8", "info_notification_volume_override": "false", "info_notification_volume_type": "constant", "thread_id": "SZM7GDPI2VI3F:UWZ6FR5T2KG7U:going-oncall", "title": "You are going on call in 7 minutes for schedule joey test", "type": "oncall.info"}, "token": "dqWWqPS8SvOno1TEE_ZBlX:APA91bHW3hB2sXfKHxxrZ6BITyju3gzBfOHyh1drqndc1U8_b-F89JIfPEsaZvXL-uQd0vpJA8LHifEUCZKb_frk-wbTAwbgk92_0a1DvUKdgNcntK-O85MUDRuf6bWhE9NRGIv58tt5"}
```

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-24 17:56:20 -04:00
Michael Derynck
db00528c75
Remove spammy log message for device not setup (#2006)
This message appears very frequently in our logs and does not seem to be
useful. Please comment and close if this message is useful to you.
2023-05-24 20:49:08 +00:00
Innokentii Konstantinov
bb4c817a33 Correct flags of twilio phone provider 2023-05-24 19:18:09 +08:00
Ildar Iskhakov
d139fcc7e8
Remove user defined time period from "you're going oncall" mobile push (#2001)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-24 16:14:48 +08:00
Innokentii Konstantinov
dca0b1e5df
Improve twilio callback logging (#1998)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-24 07:28:14 +00:00
Innokentii Konstantinov
1f786e8d2a
Phone provider refactoring (#1713)
# What this PR does
This PR moves phone notification logic into separate object PhoneBackend
and introduces PhoneProvider interface to hide actual implementation of
external phone services provider. It should allow add new phone
providers just by implementing one class (See SimplePhoneProvider for
example).
# Why 
[Asterisk PR](https://github.com/grafana/oncall/pull/1282) showed that
our phone notification system is not flexible. However this is one of
the most frequent community questions - how to add "X" phone provider.
Also, this refactoring move us one step closer to unifying all
notification backends, since with PhoneBackend all phone notification
logic is collected in one place and independent from concrete
realisation.
# Highligts
1. PhoneBackend object - contains all phone notifications business
logic.
2. PhoneProvider - interface to  external phone services provider.
3. TwilioPhoneProvider and SimplePhoneProvider - two examples of
PhoneProvider implementation.
4. PhoneCallRecord and SMSRecord models. I introduced these models to
keep phone notification limits logic decoupled from external providers.
Existing TwilioPhoneCall and TwilioSMS objects will be migrated to the
new table to not to reset limits counter. To be able to receive status
callbacks and gather from Twilio TwilioPhoneCall and TwilioSMS still
exists, but they are linked to PhoneCallRecord and SMSRecord via fk, to
not to leat twilio logic into core code.

---------

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-05-24 06:27:48 +00:00
Vadim Stepanov
06bd0454f6
Fix MultipleObjectsReturned error on webhook endpoints (#1996)
# What this PR does
Sometimes `CustomButtonView` returns HTTP 500 with the following error:

```
apps.alerts.models.custom_button.CustomButton.MultipleObjectsReturned: get() returned more than one CustomButton -- it returned 3!
```

This PR fixes it by adding `.distinct()` to the `CustomButton` queryset
when retrieving an instance + does the same for `WebhooksView`.

## Which issue(s) this PR fixes
Related to https://github.com/grafana/oncall-private/issues/1828

## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-23 16:23:06 +00:00
Vadim Stepanov
c921674471
Improve plugin authentication (#1995)
# What this PR does
Handle different failing authentication scenarios (e.g. when token is
invalid or instance context is not a valid JSON) so endpoints return
appropriate response code (401 instead of 500).

## Which issue(s) this PR fixes
Related to https://github.com/grafana/oncall-private/issues/1633

## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-23 16:13:25 +00:00
Vadim Stepanov
53d34164ef
Fix SQLite permission issue (#1984)
# What this PR does
Fixes https://github.com/grafana/oncall/issues/1960.

## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-22 19:16:31 +00:00
Vadim Stepanov
0078dd6f61
Fix inbound email bug when attaching files (#1970)
# What this PR does
Fix inbound email endpoint bug when attaching files to email leads to
HTTP 500.

## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-18 17:35:36 +00:00
Innokentii Konstantinov
ac2f6edd9b
Mobile push dynamic setting (#1967) 2023-05-18 19:45:31 +08:00
Innokentii Konstantinov
f51e6fff5e
Test mobile push (#1933)
# What this PR does
Adds ability to send test push notification

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
2023-05-18 15:52:42 +08:00
Michael Derynck
397f961486
Fix organizations not being deleted by start_cleanup_deleted_organizations (#1950)
Organizations that have been deleted outside OnCall were not being
cleaned up by this task as expected.

- Use PluginAuthToken instead of GCOM token == None to determine if the
oncall organization should be matched in GCOM
- Fix how delete was being checked for the instance, the previous method
does not work.
2023-05-17 12:56:57 +00:00
Ildar Iskhakov
e97826df94
Allow null for short description in integrations api (#1952)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-17 18:43:01 +08:00
Vadim Stepanov
64fd124e41
Slack: use user_profile_changed event instead of user_change (#1938)
# What this PR does
Adds a handler for
[user_profile_changed](https://api.slack.com/events/user_profile_changed)
Slack event + updates the Slack app manifest.

This is needed to replace
[user_change](https://api.slack.com/events/user_change) event with
[user_profile_changed](https://api.slack.com/events/user_profile_changed)
event, since using `user_change` can cause a lot of excessive requests
from Slack.

## Which issue(s) this PR fixes
Might be related to
https://github.com/grafana/oncall-private/issues/1803

## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-15 16:32:06 +00:00
Ildar Iskhakov
f18858882e
Remove prints (#1924)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-15 09:28:01 +08:00
Yulya Artyukhina
62412076a2
Disable "You're going OnCall soon" push notification (#1927)
Disable "You're going OnCall soon" push notification for current user
settings
2023-05-12 11:56:12 +00:00
Salvatore Giordano
c2ac74faa3
add user settings for info notifications (#1926)
# What this PR does

## Which issue(s) this PR fixes

## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-12 10:23:42 +00:00
Vadim Stepanov
b8f54f1c53
Add docs & logo for AppDynamics integration (#1916)
# What this PR does
Adds docs & logo for AppDynamics integration. 
Main PR in private repo:
https://github.com/grafana/oncall-private/pull/1790.

## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/1621

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- No changelog (AppDynamics integration will be only available in cloud)
2023-05-11 16:41:51 +00:00
Joey Orlando
395dfd37d0
fix bug in the "you're going oncall" push notification copy (#1922)
# What this PR does

## Which issue(s) this PR fixes

User reported receiving a push notification that they were going oncall
~12mins before the shift started but the notification copy instead
showed this:

![Screenshot_20230511-105817](https://github.com/grafana/oncall/assets/9406895/a9851c5f-97e1-4e2d-9f3a-fd3a3272ad08)

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-11 15:48:05 +00:00
Joey Orlando
014a9c2ec2
allow the POST incoming alert endpoints to queue create_alert tasks independent of the database status (#1896)
# What this PR does

https://www.loom.com/share/18cc445117de4895a10892d56c7d3699

In preparation to upgrade our cloud databases, this PR makes some minor
changes which, after testing locally, allowed the `POST
/<integration_type>/<alert_channel_key>` endpoints to successfully
receive incoming alerts and queue the celery tasks.

I've tested all of the defined `POST
/integrations/v1/<integration_type>/<alert_channel_key>` endpoints by
sending `POST` requests to an integrations' URL while the MySQL database
was down, bringing the database back up, and ensuring the alerts were
created.

## Some other findings
- the integration heartbeat endpoints will not work as we interact w/
the database to persist the incoming heartbeat instance
- if the integration was created in the last 180 seconds, incoming
alerts will fail due to the way we cache the integration IDs
([code](https://github.com/grafana/oncall/blob/dev/engine/apps/integrations/mixins/alert_channel_defining_mixin.py#L47-L50))
- The `create_alert` celery task is set to `max_retries=None` and
`retry_backoff=True`. This means that the queued tasks will continue
retrying forever w/ an exponential backoff, until the alerts can be
created in the database (ie. when the database is back online).

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required) (N/A)
2023-05-10 12:36:23 +00:00
Michael Derynck
5992fc3cdc
Merge hotfix to dev (#1911)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
Co-authored-by: Matvey Kukuy <Matvey-Kuk@users.noreply.github.com>
Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
2023-05-09 11:17:27 -06:00
Joey Orlando
49d2f477c7
add important_notification_volume_override to mobile app user settings model (#1893)
# What this PR does

add `important_notification_volume_override` to mobile app user settings
model

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-09 14:28:47 +00:00
Michael Derynck
135159124e
Webhook response check content length instead of header for length limit (#1900) 2023-05-09 13:55:05 +00:00
Michael Derynck
1ff316b00f
Fix team blocking webhook execution (#1898)
Fix issue where the team of the alert receive channel was being used to
filter webhooks.
2023-05-09 12:59:01 +00:00