Commit graph

266 commits

Author SHA1 Message Date
Joey Orlando
4967ce8208
update web UI, Slack, and Telegram to allow silencing an acknowledged alert group (#1831)
# What this PR does

https://www.loom.com/share/1a6ef0d00c3b46ca80c120579d512dcc

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [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-04-27 14:52:35 +00:00
Matias Bordese
06b6c856d7
Rework schedule related users, add endpoint (#1828)
Related to https://github.com/grafana/oncall/issues/1820.
2023-04-26 20:46:51 +00:00
Joey Orlando
52ff041066
Optimize duplicate queries occurring in AlertGroupFilter (#1809)
# What this PR does

In `AlertGroupFilter` we currently have 11 duplicate queries which add
~1-2secs of unecessary request latency to `GET
/api/internal/v1/alertgroups` calls.
![Screenshot 2023-04-20 at 17 57
49](https://user-images.githubusercontent.com/9406895/233589341-de5e53ca-f10b-4038-ad68-a857d1643bf2.png)



The queries originate from the `queryset` callable arguments on several
of the fields of the `AlertGroupFilter` class. These callables basically
filter down their respective querysets to include only objects that
belong to the currently authenticated user's organization.

The duplicate queries are
- 2 queries to fetch integrations
- 2 queries to fetch escalation chains
- 10 queries to fetch users

At the moment, this PR is still a draft and doesn't work as intended.
It's based off of [a suggestion from this
discussion](https://github.com/carltongibson/django-filter/discussions/1572#discussioncomment-5676042)
in the `django-filter` repo. See [this DjangoCon
talk](https://youtu.be/e52S1SjuUeM?t=841) for more context.

---------

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-04-26 06:16:29 +00:00
Tommy
23c7a6f682
Add 2, 3 and 6 hours silence options (#1822)
# What this PR does
This PR adds additional silence options in the UI. Currently we only
have 1 hour, 4 hours and 12 hours silence options. I think it's worth it
to have finer silence options.

## Which issue(s) this PR fixes
No issue ticket but I can create one.

## 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-04-26 02:22:18 +00:00
Matias Bordese
cdb62f2cf6
Enable final schedule exports (#1808)
Update iCal schedule and personal exports to use final schedule events.
2023-04-25 15:40:27 +00:00
Joey Orlando
a871fec0a3
Update CHANGELOG.md 2023-04-24 08:25:44 -04:00
Ildar Iskhakov
e6ebec1a17
Reuse web templates in other templates (#1786)
# 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-04-24 07:44:39 +00:00
Ildar Iskhakov
6e61643750
Limit number of alertmanager alerts in alert group to autoresolve (#1779)
# What this PR does

This PR set the limit so that workers won't attempt to autoresolve too
big alertmanager alert groups.

## 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-04-24 05:38:21 +00:00
Matias Bordese
e404d2f4b6
Update shift API to use a default for interval when missing (#1810)
Fixes #1527.
2023-04-21 19:13:09 +00:00
Matvey Kukuy
62d5fc3bf7
Update CHANGELOG.md 2023-04-21 17:23:58 +03:00
atownsend247
18fe390d44
Extend twilio secrets (#1435)
# What this PR does

This allows the use of existing secrets for the twilio configuration,
much like slack already does, as have used that to influence these
changes

## Which issue(s) this PR fixes

## Checklist

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

---------

Co-authored-by: Matvey Kukuy <Matvey-Kuk@users.noreply.github.com>
2023-04-21 17:21:06 +03:00
Joey Orlando
16502205be
add channel__team to internal api serializer select_related (#1805)
Locally I reproduced a slow `GET /api/internal/v1/alertgroups` query
(took 9s - 10s). After adding this line to the alert group serializer
for the internal api it:
- cut the response time in half
- cut the number of executed SQL queries from 52 to 30
2023-04-20 18:30:49 +02:00
Matthias Teich
1bd157f7f3
Fix helm hook for migration job (#1789)
# What this PR does
This PR fixes the migration job when using helm hooks.
## Which issue(s) this PR fixes
Currently when enabling the useHooks option in the helm chart there is a
deadlock as the hook is defined as "post-upgrade, post-install". In this
case the database migration will only be executed when all other pods
are ready. This will not happen as the pods are waiting for the database
migration. So we need to use "pre-install, preupgrade" instead of
"post-install,post-upgrade"

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

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-04-20 05:39:53 +00:00
Vadim Stepanov
afdf1dc837
v1.2.14 changelog (#1795) 2023-04-19 16:32:40 +01:00
Vadim Stepanov
eee9dcfcfa
Fix team update (#1794)
# What this PR does
Fixes team update endpoint for internal API + adds a unit test for this
scenario.

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

## 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-04-19 15:22:14 +00:00
Michael Derynck
aaff20239b
Update CHANGELOG.md 2023-04-18 20:16:50 -06:00
Matias Bordese
0895cdbb8f
Use shift tz for web-created events (#1785)
Fix issue when creating web overrides for TF schedules using a non-UTC
timezone (web UI assumes editable events are UTC-based).
2023-04-19 01:11:07 +00:00
Matias Bordese
017d98efad
Rework schedule ical export (#1783)
Related to #1501. Behind a feature flag, will migrate existing exports
to use the new ical export transparently.
2023-04-18 17:07:11 +00:00
Matias Bordese
4149c266bb
Add mine filter to schedules listing (#1743)
Related to #1741 .
2023-04-18 13:16:36 +00:00
Joey Orlando
5f9e79d50f
move alert_group.is_restricted to alert_receive_channel.restricted_at (#1770) 2023-04-18 12:02:56 +02:00
Ildar Iskhakov
cee0fdccd7
Add new field description_short to private and public api (#1698)
# What this PR does
Required for new Integrations page
<img width="674" alt="Screenshot 2023-04-04 at 20 32 03"
src="https://user-images.githubusercontent.com/2262529/229792240-60783f30-00ba-4dfc-bebd-75d6c2c232e3.png">


## 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-04-18 04:55:55 +00:00
Ildar Iskhakov
61dced5bd9
Add is_default fields to templates, remove WritableSerialiserMethodFi… (#1759)
…eld, refactor fields

# 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-04-18 04:44:51 +00:00
Ildar Iskhakov
5da5b8d430
Allow use of dynamic payloads in alert receive channels preview templ… (#1756)
…ate in private api

# 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-04-18 03:57:40 +00:00
Ildar Iskhakov
7dd726622a
Add endpoints to start and stop maintenance in alert receive channel … (#1755)
…private api

# 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-04-18 03:31:49 +00:00
Ildar Iskhakov
9d19493561
Added preview and migration API endpoints for route migration from regex into jinja2 (#1715)
# What this PR does
This PR adds new API endpoints for migrating routes from regex format to
jinja2 format. The changes include the following:

* `filtering_term_as_jinja2` field to GET `channels_filters` endpoint
* A POST endpoint
`channel_filters/ABCDEF123/convert_from_regex_to_jinja2/` for migrating
routes to jinja2 format.

These new endpoints will allow users to preview and migrate their
existing regex routes to the more flexible and maintainable jinja2
format.

Check the screenshot where this endpoints will be used
<img width="407" alt="Screenshot 2023-04-14 at 09 50 23"
src="https://user-images.githubusercontent.com/2262529/231920771-20792c7e-d6ef-4681-80e1-c82bb4aa4b8e.png">

## 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-04-18 02:53:53 +00:00
Ildar Iskhakov
f825fdf1a3
Send demo alert with dynamic payload and get demo payload example on private api (#1700)
# 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-04-18 02:48:11 +00:00
Matthias Teich
0c42c2a86d
Add option to use helm hook for migration job (#1386)
# What this PR does
This PR adds the option to use helm hooks for the database migration.

## Which issue(s) this PR fixes
Currently oncall always shows as out-of-sync in argo-cd because the name
changes on each hard refresh.
When using a helm hook the job is executed on sync but does not show as
out-of-sync

## Checklist

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

---------

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-04-17 10:22:05 +00:00
Joey Orlando
de6e8d1226
Update CHANGELOG.md 2023-04-14 12:08:00 +02:00
Joey Orlando
bededd5544
update changelog 2023-04-14 09:18:34 +02:00
Joey Orlando
3b274f45f4
add several new database columns + emit two new Django signals (#1522)
# What this PR does

- add new columns `gcom_org_contract_type`,
`gcom_org_irm_sku_subscription_start_date`, and
`gcom_org_oldest_admin_with_billing_privileges_user_id` to
`user_management_organization` table + `is_restricted` column to
`alerts_alertgroup` table
- emit two new Django signals
- `org_sync_signal` at the end of the
`engine/apps/user_management/sync.py::sync_organization` method
  - `alert_group_created_signal` when a new Alert Group is created

## Checklist

- [ ] Tests updated (N/A)
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated

---------

Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
2023-04-14 09:15:57 +02:00
Michael Derynck
79d39b7ec9
Update CHANGELOG.md 2023-04-13 14:18:01 -06:00
Ben Sully
303670947b
Fix web_link property of AlertGroup (#1738)
The routing of the OnCall plugin has changed and no longer uses URL
params
but instead uses paths. This link is used when declaring an Incident
from
the OnCall Slack alert and needs to match the correct pattern in order
for
Incident to correctly detect it.
2023-04-12 16:44:27 +00:00
Rares Mardare
5b1ce3988e
Fix a bug in GForm (#1712)
# What this PR does

Fixed `onChange` handler within `GForm` component
2023-04-11 12:23:55 +03:00
Ildar Iskhakov
6884a42603
Update CHANGELOG.md 2023-04-06 13:41:29 +08:00
Ildar Iskhakov
498e7ed5f3
Allow editing assigned team via public api (#1619)
# What this PR does

For example, changing the integration's team
```
curl "localhost:8080/api/v1/integrations/CLYV3QBVHDV3T/" \
  --request PUT \
  --header "Authorization: meow" \
  --header "Content-Type: application/json" --data '{"team_id": "TWP6JJJN6LYZX"}'
```

## 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-04-05 06:39:30 +00:00
Ildar Iskhakov
27b5ffad88
Update CHANGELOG.md 2023-04-04 11:59:53 +08:00
Ildar Iskhakov
840669235a
Disable mentions when resolution note is created (#1696)
# 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-04-04 11:57:38 +08:00
Ildar Iskhakov
532996176a
Display warnings on users page in a clean and consistent way (#1681)
# What this PR does

Before:
<img width="942" alt="Screenshot 2023-03-31 at 10 00 25"
src="https://user-images.githubusercontent.com/2262529/229003826-1f42820f-6997-4fec-82ed-acf4355b6758.png">


After:
<img width="937" alt="Screenshot 2023-03-31 at 09 59 22"
src="https://user-images.githubusercontent.com/2262529/229003723-6ac1743d-316f-4272-a73a-a1bebb27618f.png">


## 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-04-03 18:18:59 +08:00
Joey Orlando
c4f2b28c2f
update changelog 2023-04-03 11:50:55 +02:00
Joey Orlando
0b23ad3d24
fix changelog 2023-04-03 11:50:00 +02:00
Rares Mardare
0acac58af0
Incidents mapped to /alert-groups (#1678)
# What this PR does

Reopened old reverted PR that @Ukochka worked on. In addition it has
fixed the redirect from `?page=incident` to `/alert-groups`

---------

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-03-31 09:54:01 +00:00
Maxim Mordasov
2b3e269e28
Save selected teams filter in local storage (#1613)
# What this PR does

Selected teams filter is now saved in local storage

## Which issue(s) this PR fixes

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

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

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-03-31 09:12:21 +00:00
Maxim Mordasov
11d62245e9
fix safari scroll (#1663)
# What this PR does

Fix  scroll in Safari

## Which issue(s) this PR fixes

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

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

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-03-30 18:17:58 +00:00
Vadim Stepanov
ac57c8ee9f
Fix team search (#1680)
# What this PR does

Team search doesn't work when filtering by team:

<img width="331" alt="Screenshot 2023-03-30 at 15 48 50"
src="https://user-images.githubusercontent.com/20116910/228875971-0f55bdf8-6aa7-4759-9882-cdf7d11bb0c7.png">

This PR fixes it + adds backend unit tests.


## 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-03-30 15:34:55 +00:00
Joey Orlando
73343d4da8
Update CHANGELOG.md 2023-03-30 14:05:30 +02:00
Matias Bordese
f0c73ccc39
RRULE until values must be specified in UTC tz (#1661)
When generating ical information for an event, the RRULE until value
must be specified in UTC.

Related to https://github.com/grafana/support-escalations/issues/5426.
2023-03-30 13:53:39 +02:00
Vadim Stepanov
83504b15e4
Revert "Collection of bugs" (#1671)
Reverts grafana/oncall#1600 as it makes Slack links not working
correctly with the plugin UI.
2023-03-30 12:44:41 +01:00
Vadim Stepanov
9fca66d869
Changelog v1.2.4 (#1668) 2023-03-30 10:47:53 +01:00
Maxim Mordasov
061123e124
Allow changing team for escalation chains (#1658)
# What this PR does

Allows changing team for escalation chains

## 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: Ildar Iskhakov <ildar.iskhakov@grafana.com>
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2023-03-30 10:43:00 +01:00
Vadim Stepanov
3c00345f54
Fix Grafana teams sync (#1652)
# What this PR does
Sometimes plugin sync fails with the following exception:
```
Cannot delete or update a parent row: a foreign key constraint fails (`schedules_oncallschedule`, CONSTRAINT `alerts_oncallschedul_team_id_4e633f4b_fk_user_mana` FOREIGN KEY (`team_id`) REFERENCES `user_management_team` (`id`))'
```

How to reproduce:
1. Create a new Grafana team
2. Create two schedules with different types (e.g. ICal and Web) and
assign both schedules to the new team
3. Delete the team in Grafana
4. Trigger plugin sync, the sync will fail with the exception above

This happens because the `OnCallSchedule` Django model is a polymorphic
model and there's a [known
bug](https://github.com/django-polymorphic/django-polymorphic/issues/229)
in `django-polymorphic` with deleting related objects when using
`SET_NULL` and `CASCADE`. This PR adds non-polymorphic versions of
`SET_NULL` and `CASCADE` to use in schedule FKs as per this
[comment](https://github.com/django-polymorphic/django-polymorphic/issues/229#issuecomment-398434412).

This also applies to two other schedule FKs: `organization` and
`user_group`, which are not working properly as well.

## 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-03-28 18:26:24 +00:00