Commit graph

575 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
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
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
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
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
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
Yulya Artyukhina
44edd50551
Update CHANGELOG.md 2023-09-04 14:07:38 +02: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
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
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
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
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
Rares Mardare
26dee30cfa
Tweaks for integrations (#2869)
# What this PR does

This PR adds a few tweaks to the integrations page

- prevent calling `/counters` on the integration page, instead call it
with `counters/[id]`
- call to `/counters` will be done only once when we load all the
integrations and prevent calling it again once we switch pages. Prior to
this change every page resulted in a call to `/counters`, and due to the
fact the request took on average `3-5s` it was being stalled by the
browser on subsequent calls.
- Call to `/connected_contact_points` is now conditioned by the
integration type
- No more page flicking when going back from integration page to the
list of integrations
- No more page flickering when switching pages in table view if there's
more requests ongoing
- Prevent discarding filters when going back from Integration view to
the table view
- Fixed routes not moving up/down
- Fixed routes flickering when adding/removing a route

These changes should result in slightly loader times because `/counters`
was time-consuming request, and less UX issues.

## Which issue(s) this PR fixes

- described at https://github.com/grafana/oncall/issues/2843 but
incompletely

## 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-30 11:06:22 +00:00
Matias Bordese
77fe1c5e60
Update CHANGELOG.md 2023-08-29 13:07:33 -03:00
Matias Bordese
0e75be96df
Fix slack schedule notification settings dialog (#2902)
Fixes https://github.com/grafana/oncall/issues/2647
2023-08-29 15:07:02 +00:00
Yulya Artyukhina
4a8d0f3ad3
Fix metrics and dashboard (#2895)
# What this PR does

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

## 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-29 13:52:24 +00:00
Ildar Iskhakov
d5248534eb
Update CHANGELOG.md 2023-08-29 15:48:04 +08:00
Ildar Iskhakov
69661f1986
Switch to alpine base image (#2872)
# 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-29 15:03:32 +08:00
Michael Derynck
5d4f96ec96
Alerting integration use get for receiver key (#2894)
# What this PR does
Fixes an issue where OnCall could not parse Alerting configuration if
there was a route created without a receiver. The case where this comes
up is a notification policy matcher is defined for the purpose of
ignoring certain label values before continuing on to other matching
rules.

## 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)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-08-29 02:01:45 +00:00
Joey Orlando
c811a2ad15
Address bug when taking a Shift Swap Request and the Slack message is not updated (#2886)
# What this PR does

Address bug when a Shift Swap Request is accepted either via the web or
mobile UI, and the Slack message is not
updated to reflect the latest state.

## 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-28 11:55:17 +02:00
Joey Orlando
463c84dad6
Update CHANGELOG.md 2023-08-25 08:04:25 +02:00
Yulya Artyukhina
26cc044390
Correct escalation policies public api documentation (#2830)
# What this PR does
Corrects escalation_policies public api docs

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

## 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)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-08-25 07:59:20 +02:00
Matias Bordese
a17569c49c
Update ical export to track primary/overrides calendar using priority (#2871)
Related to https://github.com/grafana/oncall/issues/2778
2023-08-24 15:36:42 +00:00
Alexander Cherepanov
ec028eb9d9
Telegram long polling (#2250)
# What this PR does

Runs Telegram long polling to get updates. 
It's enabled by setting `FEATURE_TELEGRAM_LONG_POLLING_ENABLED=True`.
That will disable webhook and run separate deployment for telegram long
polling.

Telegram long polling is not very HA mode, but it does not need to
expose webhook url to internet and simplifies telegram integration.

## Which issue(s) this PR fixes

closes #561 

## 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-24 09:12:24 +02:00
Matias Bordese
2c2497e2d1
Enable shifts export endpoint for all schedule types (#2863)
Related to https://github.com/grafana/oncall/issues/2799
2023-08-23 11:07:06 -03:00
Michael Derynck
7440a836da
Webhooks Public API (#2790)
# What this PR does
- Add public API for Webhooks CRUD, and GET webhook responses
- Add insight resource logs for internal and public webhook API calls
- Change public actions API to wrap Webhooks to maintain compatibility
with existing callers
 

## Which issue(s) this PR fixes

#2792 
#2793 

## 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-22 14:05:52 -06:00
Michael Derynck
0dfa882a06
Return API URL as part of status (#2791)
# What this PR does
- Provide API URL when returning status to inform plugin or mobile app
if it should be talking to a different backend in case of migration.
- Add MobileAppAuthTokenAuthentication to status endpoint so that the
app can use it.
- Split PluginAuthentication (Checks user) and BasePluginAuthentication
(Does not check user) and use BasePluginAuthentication in grafana-plugin
app when getting status.
- Removed PluginTokenVerified since it can be handled by
BasePluginAuthentication.
- Removed deprecated endpoints from grafana-plugin app. 

## 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-22 17:17:26 +00:00
Joey Orlando
6fa2b0136c
Update CHANGELOG.md 2023-08-22 17:17:10 +02:00
Joey Orlando
dd338372ab
increase mobile app verification token TTL from 1 minute to 5 minutes (#2859)
# What this PR does

Trying to connect a mobile app emulator, following the instructions
[here](https://github.com/grafana/oncall-mobile-app#getting-started), to
a cloud stack is incredibly difficult given the 1 minute token TTL. You
need to retrieve the token from the HTTP response in your browser's
inspect panel, plug that token into the `make run` command and cross
your fingers that the emulator starts up in < 45 seconds before the
token expires.

This PR increases the verification token TTL from 1 minute to 5 minutes.

## 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-22 17:09:59 +02:00