Commit graph

3019 commits

Author SHA1 Message Date
Vadim Stepanov
8b2212c7dc
Improve Slack error handling (#3000)
# What this PR does

- Rename `SlackClientWithErrorHandling` to just `SlackClient`
- Add more error classes + improve the way errors are raised based on
the Slack error code
- Add API call retries on Slack server errors (e.g. when Slack returns
`5xx` errors)
- Refactor some methods working with Slack API + add tests

## Which issue(s) this PR fixes

- https://github.com/grafana/oncall-private/issues/1837
- https://github.com/grafana/oncall-private/issues/1840
- https://github.com/grafana/oncall-private/issues/1842

## 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-09-12 09:49:16 +00:00
Matias Bordese
14c32a74bf
Trigger alert group signal after transaction commit (#3001)
See
https://docs.djangoproject.com/en/4.2/topics/db/transactions/#performing-actions-after-commit

Related to https://github.com/grafana/oncall-private/issues/2015
2023-09-11 14:28:37 +00:00
Matias Bordese
9c3979a712
Update escalation policies public API to handle new webhooks (#2999)
Support new webhooks when creating or updating.
Return existing information if still using previous custom button
actions.

Fixed  #2998
2023-09-11 10:50:18 -03:00
Matias Bordese
971384b50e
Update internal alert group details API docs (#2995)
Related to https://github.com/grafana/oncall/issues/2982
2023-09-11 13:25:00 +00:00
Joey Orlando
4b0bb86ce4
Notify user when their shift swap request is taken (#2992)
# What this PR does

Closes #2868

**Slack thread message**
<img width="442" alt="Screenshot 2023-09-07 at 15 47 30"
src="https://github.com/grafana/oncall/assets/9406895/f8f39341-4d18-4a43-88be-066993275fcd">

**Push notification**
Clicking on the push notification goes to the SSR detail view

<img width="423" alt="Screenshot 2023-09-07 at 15 48 59"
src="https://github.com/grafana/oncall/assets/9406895/5bb0fbf3-3e55-47e3-bf24-9cb5690dc17c">


## 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-09-07 14:59:54 +00:00
Vadim Stepanov
b944a2206f
v1.3.36 changelog 2023-09-07 14:07:05 +01:00
Matias Bordese
bf4d948449
Update slack schedule shift change notification (#2949)
Related to https://github.com/grafana/oncall/issues/2916

Updated notification:

![slack-shift-notification](https://github.com/grafana/oncall/assets/260710/825fda59-6636-44c1-9740-8976e7c109a7)
2023-09-07 13:00:12 +00:00
Matias Bordese
afc3b193f6
Update insight logs for shift swaps requests (#2987) 2023-09-07 11:49:33 +00:00
Bob Cotton
6c8344a82d
Use Tilt for local development (#1396)
# What this PR does

PR adds Tilt for local development

## Which issue(s) this PR fixes

## Checklist

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

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-09-07 19:38:19 +08:00
Vadim Stepanov
0d7352a17b
Fix handling Slack rate limits (#2991)
## Which issue(s) this PR fixes

https://github.com/grafana/oncall-private/issues/2156

## 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-09-07 11:25:29 +00:00
Vadim Stepanov
d90cf0f593
Fix Slack integration leftovers after disconnecting (#2986)
# What this PR does

Improve Slack disconnect cleanup:
- Reset Slack user group for schedules
- Reset Slack user identity for deleted users

## Which issue(s) this PR fixes

https://github.com/grafana/oncall-private/issues/1962

## 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-09-07 08:42:30 +00:00
Vadim Stepanov
31759fdf80
Don't update Slack user groups for deleted organizations (#2985)
# What this PR does

Make sure that Slack user groups are not getting updated for deleted
orgs.
Without this change, there could be issues with backends in multiple
clusters trying to update a single Slack user group after migrating an
org to another cluster (organizations get soft deleted from the original
cluster after migration).

## Which issue(s) this PR fixes

https://github.com/grafana/support-escalations/issues/6936

## 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-09-06 16:02:01 +00:00
Vadim Stepanov
017b22b905
Enable email notification step by default on Helm (#2975)
# What this PR does

Set `oncall.smtp.enabled` to `true` by default to enable email
notifications on Helm deployments.
Email notifications are enabled by default on docker-compose deployments
already: see [this feature
flag](df6f6183ec/engine/settings/base.py (L63)).

## Which issue(s) this PR fixes

https://github.com/grafana/oncall/issues/2917

## 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-09-06 15:23:53 +01:00
Matias Bordese
5b052afb36
Handle slack resolution note errors consistently (#2976) 2023-09-06 12:15:28 +00:00
Rares Mardare
cc8d6ad0e2
Allow creation of contact points for existing integrations (#2959)
## Which issue(s) this PR fixes

#2909
2023-09-05 17:32:02 +03:00
Joey Orlando
415e25c8c1
Update CHANGELOG.md 2023-09-05 14:34:08 +02:00
Joey Orlando
0d30a9ee67
Merge branch 'dev' of github.com:grafana/oncall into dev 2023-09-05 14:32:34 +02:00
Joey Orlando
3f9d392be9
address another slack-sdk issue 2023-09-05 14:32:28 +02:00
Joey Orlando
293eff2325
fix slack-sdk issue (#2969)
<img width="1488" alt="Screenshot 2023-09-05 at 12 59 16"
src="https://github.com/grafana/oncall/assets/9406895/61518425-da47-4363-8400-fc46b043f64f">


[logs](https://ops.grafana-ops.net/explore?panes=%7B%22FZ0%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bcluster%3D~%5C%22%28prod-us-central-0%7Cprod-eu-west-0%7Cops-us-east-0%29%5C%22,%20namespace%3D~%5C%22amixr-%28staging%7Cprod%29%5C%22%7D%20%7C%3D%20%60KeyError%28%27cursor%27%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22000000193%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%22now-6h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1)
2023-09-05 13:06:22 +02:00
Yulya Artyukhina
6ff61ad172
Fix escalation step "Notify if num alerts in time window" (#2965)
# What this PR does
Fix escalation step "Notify if num alerts in time window" when
escalation policy was deleted during the escalation

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

## 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-09-05 10:32:59 +00:00
Joey Orlando
395977d934
fix issue with slack_sdk call update (#2966)
# What this PR does

## 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-09-05 12:25:11 +02:00
Joey Orlando
8e1962e89a
Update CHANGELOG.md 2023-09-05 11:32:24 +02:00
Joey Orlando
a9155130df
update slack_sdk dependency to latest version (#2947)
# What this PR does

- update `slackclient` dependency to latest version. The version we were
using was 5 years old 😲
- first followed the v2 migration guide
[here](https://github.com/slackapi/python-slack-sdk/wiki/Migrating-to-2.x)
followed by the v3 migration guide
[here](https://slack.dev/python-slack-sdk/v3-migration/). The main
changes were:
    - The PyPI project was renamed from `slackclient` to `slack_sdk`
- it is discouraged/harder to call `api_call` and encouraged to call the
helper methods (ex. `chat_postMessage`;
[note](https://github.com/slackapi/python-slack-sdk/wiki/Migrating-to-2.x#web-client-api-changes)
in migration guide docs)
- In 1.x, a failed api call would return the error payload to you and
have you handle the error. In 2.x, a failed api call will throw an
exception. To handle this in your code, you will have to wrap api calls
with a try except block. Since we overload `WebClient.api_call` this was
an easy change and only required a one line change
- remove `apps.slack.slack_client.slack_server.SlackClientServer` class.
The new version of `slack_sdk` handles the case that we needed to
overload for in the first place.
- merged `apps/slack/slack_client/slack_client.py` and
`apps/slack/slack_client/exceptions.py` into `apps/slack/client.py`

## 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-09-05 11:31:59 +02:00
Matias Bordese
0dea5661c4
Reject file uploads when posting to an integration endpoint (#2958)
Related to https://github.com/grafana/oncall-private/issues/2145

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-09-05 10:01:50 +02:00
Yulya Artyukhina
ecb4ba0057
Add endpoint for getting schedules events for current user (#2928)
# What this PR does

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

## 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-09-05 07:22:08 +00:00
Vadim Stepanov
a2851d3f81
Refactor AlertGroup.slack_message (#2957)
# What this PR does

Refactors the foreign key relationship between `AlertGroup` and
`SlackMessage` models (see
https://github.com/grafana/oncall-private/issues/1867 for more info).

## Which issue(s) this PR fixes

https://github.com/grafana/oncall-private/issues/1867

## 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-09-04 18:03:18 +00:00
Matias Bordese
38a3326c56
Remove IRM plan references from plugin (#2848)
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-09-04 12:15:13 +00:00
Yulya Artyukhina
44edd50551
Update CHANGELOG.md 2023-09-04 14:07:38 +02:00
github-actions[bot]
4a53df0c9b
Update make docs procedure (#2952)
Co-authored-by: grafanabot <bot@grafana.com>
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
2023-09-04 11:47:17 +00:00
Yulya Artyukhina
cc92c53f84
Fix build escalation snapshot (#2954)
# What this PR does
Fix escalation snapshot building if last notified user in escalation
step "Notify users one by one (round-robin)" was deleted
 
## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/2148

## 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-09-04 11:10:28 +00:00
Vadim Stepanov
f7bdcf3d36
Fix SlackMessage._alert_group issue (#2945)
# What this PR does

Fixes  https://github.com/grafana/oncall-private/issues/2091

## 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-09-01 14:47:10 +00:00
Rares Mardare
88c5338ea1
Fix cloud plugin install not refreshing (#2932)
# What this PR does

## Which issue(s) this PR fixes

#2874

## 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-09-01 17:40:31 +03:00
Joey Orlando
5c189c8059
add create_slack_connector_async_v2 celery task to CELERY_TASK_ROUTES + remove deprecated celery tasks (#2946)
# What this PR does
- add `common.oncall_gateway.tasks.create_slack_connector_async_v2`
celery task to `CELERY_TASK_ROUTES`
- remove two deprecated tasks in `common.oncall_gateway.tasks`

## 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-09-01 13:40:58 +00:00
Yulya Artyukhina
e472b03e1d
Remove deprecated alerting integration tasks (#2944)
# What this PR does
These celery tasks have not been used for more than one week (since
[v1.3.25](https://github.com/grafana/oncall/releases/tag/v1.3.25) which
released an improvement for Grafana Alerting integration)

## 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)
2023-09-01 13:11:02 +00:00
Joey Orlando
619cb42a3a
Remove apps.mobile_app.tasks.notify_user_async celery task (#2942)
# What this PR does

This task was renamed in a v1.3.30. It is no longer referenced and there
are no pending tasks in production queues:
![Screenshot 2023-09-01 at 09 35
45](https://github.com/grafana/oncall/assets/9406895/0f7149bd-efe3-401e-ac94-a664af67472a)



## 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)
2023-09-01 11:54:37 +00:00
Yulya Artyukhina
361d45dd02
Clean up check escalation finished task (#2943)
# What this PR does
Clean up check escalation finished task, update description

## 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)
2023-09-01 10:48:47 +00:00
Maxim Mordasov
585bbe486a
Add swift swaps requests visualisation to schedule (#2881)
# What this PR does

Add swift swaps requests visualisation to schedule

## Which issue(s) this PR fixes

https://github.com/grafana/oncall/issues/2844

## 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-09-01 10:18:16 +00:00
Joey Orlando
1d089aa7a3
fix IntegrityErrors occuring when creating ResolutionNoteSlackMessage objects (#2933)
# What this PR does

## Which issue(s) this PR fixes

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

## 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-09-01 08:14:59 +00:00
Joey Orlando
73da83274a
Update Shift Swap Request Slack message formatting (#2918)
# What this PR does

Updates Shift Swap Request Slack message formatting to be consistent
with UI mockups:

**New Request**
![Screenshot 2023-08-30 at 12 18
54](https://github.com/grafana/oncall/assets/9406895/712a13e2-b768-4be6-b066-c5daa98446eb)

**Accepted**
![Screenshot 2023-08-30 at 12 19
41](https://github.com/grafana/oncall/assets/9406895/84d14adf-bb48-4ba8-bee2-eb7931ef2d55)


**Deleted**
![Screenshot 2023-08-30 at 12 19
01](https://github.com/grafana/oncall/assets/9406895/9bda06c8-5ce7-405b-9303-b160eac4d635)


## 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-09-01 07:53:27 +02:00
Simon Crute
15e02c7f30
Remove duplicate line (#2934)
remove duplicate line in first example.

# 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-08-31 13:15:27 -06:00
Michael Derynck
56c0c023ad
Test celery tasks have queue assignment (#2922)
# What this PR does

- Add a test to ensure celery tasks are assigned to a queue
- Move CELERY_TASK_ROUTES out of settings into its own file for easier
reuse and reference.

## 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-08-31 18:42:08 +00:00
Matias Bordese
6b8c1ac94e
Truncate exported final shifts to match the requested period (#2924)
When calculating on-call load, if an involved shift extends outside the
requested time span you can get unexpected results. Truncate the
returned events times to keep the details for the specified start/end
dates.
2023-08-31 15:40:31 +00:00
Joey Orlando
1ac9a2c0e3
Update CHANGELOG.md 2023-08-31 17:40:41 +02:00
Matias Bordese
9b9ca52b61
Add optional param to return shift swaps detailed user information (#2923) 2023-08-31 14:46:45 +00:00
Yulya Artyukhina
a1a5adf891
Fix silence for paused escalations or alert groups with empty escalation chain (#2929)
# What this PR does
Fix silence for paused escalations or alert groups with empty escalation
chain

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

## 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-08-31 11:47:13 +00:00
Rares Mardare
898523895a
Rares/fix npe on migration (#2930)
# What this PR does

Fixes the issue described at #2908 

## Which issue(s) this PR fixes

https://github.com/grafana/oncall/issues/2908

## 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-08-31 14:21:05 +03:00
github-actions[bot]
8bfe690b23
Update make docs procedure (#2925)
Co-authored-by: grafanabot <bot@grafana.com>
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
2023-08-31 09:20:01 +00:00
Joey Orlando
26747bcd75
fix broker.type in helm values 2023-08-31 11:15:01 +02:00
Joey Orlando
4cdcc25e24
patch helm broker env variable issue (#2927)
## Which issue(s) this PR fixes

#2885 

## 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-08-31 09:24:14 +02:00
Matias Bordese
939188e4a3
Expand users details in filter swaps endpoint (#2921)
Include additional information about beneficiary/benefactor users to
avoid extra requests when listing swap requests details.
2023-08-30 14:28:49 +00:00