Commit graph

780 commits

Author SHA1 Message Date
Yulya Artyukhina
16ce0136f3
Refactor gaps and empty shift checks (#3785)
Refactor gaps and empty shift checks:
- Increase checking gaps and empty shifts frequency
- Unify gaps and empty shift checks
2024-01-31 15:25:06 +01:00
Yulya Artyukhina
801f1ad028
Fix telegram connection check (#3794)
Fix check whether user has telegram connection on `get_telegram_verification_code` endpoint
2024-01-31 15:23:11 +01:00
Matias Bordese
52871b08e6
Fix interval validation when creating shift via public API (#3775)
Related to https://github.com/grafana/support-escalations/issues/9142.
2024-01-31 11:06:54 -03:00
Matias Bordese
390cbb6d6f
Fix list user serializer logic (#3793) 2024-01-31 10:13:08 -03:00
Joey Orlando
3833d8de56
remove manual alert group (/oncall) slack slash command + force_route_id (#3790)
# What this PR does

Related to [this
discussion](https://raintank-corp.slack.com/archives/C04JCU51NF8/p1706550226831949)

Removes the `/oncall` Slack slash command + the concept of
`force_route_id` (as this Slack slash command was the last piece of code
to use this concept
[here](https://github.com/grafana/oncall/blob/dev/engine/apps/slack/scenarios/manual_incident.py#L146))

## TODO before merging
- [x] update the various env's Slack apps to remove the slash command
from the app manifests

## 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)
2024-01-30 17:28:23 -05:00
Joey Orlando
06933a696a
Support alert routing based on labels (#3778)
# What this PR does

This PR adds support for routing alerts based on labels.
https://www.loom.com/share/4401de6e3c4945d5b8961fe43ee373c9

Additionally:
- improve the typing around the `get_object` method that is inherited by
[`PublicPrimaryKeyMixin.get_object`](https://github.com/grafana/oncall/blob/dev/engine/common/api_helpers/mixins.py#L153)
in most of our models. `PublicPrimaryKeyMixin` is generic, so it can be
more strongly typed when it is being subclassed, which results in better
typing of the `get_object` method in child classes
- I decided to do this because I started looking into this task via the
[`AlertReceiveChannelView.send_demo_alert`
method/endpoint](https://github.com/grafana/oncall/blob/dev/engine/apps/api/views/alert_receive_channel.py#L242).
Within that method, `instance` is not typed because the inherited
`get_object` method is not typed.. I digress 😄
- improve typing around `Alert.create` and
`apps.integrations.tasks.create_alert` functions
- make `Alert.render_group_data` more DRY by extracting some logic out
into `Alert._apply_jinja_template_to_alert_payload_and_labels`
- deduplicate the logic of `value.strip().lower() in ["1", "true",
"ok"]` into a shared function,
`common.jinja_templater.apply_jinja_template.templated_value_is_truthy`

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

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
- [x] Documentation added (or `pr:no public docs` PR label added if not
required) (will be done in #3762)
2024-01-30 13:07:19 -05:00
Ildar Iskhakov
94af60e34d
Update CHANGELOG.md (#3786)
# 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)
2024-01-30 19:25:10 +08:00
Ildar Iskhakov
401d279d54
Refactor create_alert task (#3759)
# What this PR does

This PR simplifies alert group/alert creation, so the alert created and
escalation started in the same task.

## 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)
2024-01-30 08:39:04 +00:00
Matias Bordese
65cdcf93ba
Add is_currently_oncall information to internal user details API (#3765)
Related to https://github.com/grafana/oncall/issues/3164
2024-01-29 17:41:20 +00:00
Yulya Artyukhina
e17bad4cdd
Fix calculating number of oncall users per team (#3773)
# What this PR does
Fixes calculating number of oncall users per team for `team` api
endpoint

## 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)
2024-01-29 14:32:03 +00:00
Maxim Mordasov
29dadcc07f
Show warning when edit AM-based resolve templates (#3764)
# What this PR does

show autoresolve template for ALL integrations when autoresolve is ON
show modal on edit button click for alertmanager based integrations

<img width="557" alt="Screenshot 2024-01-29 at 13 37 08"
src="https://github.com/grafana/oncall/assets/20116910/64569912-4601-4be1-b51e-b040906a3ffb">


## Which issue(s) this PR fixes

Frontend part of https://github.com/grafana/oncall-private/issues/2260


## 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: Vadim Stepanov <vadimkerr@gmail.com>
2024-01-29 14:15:56 +00:00
Maxim Mordasov
bb7ce3d133
Fix dynamic labels & multi-label extraction labels (#3753)
# What this PR does

Fix dynamic labels & multi-label extraction labels

## Which issue(s) this PR fixes

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

## 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)
2024-01-29 09:23:21 +00:00
Yulya Artyukhina
e18dafa650
Fix routes and schedules public api endpoints (#3751)
# What this PR does
Add check whether organization has Slack connection on update Slack
related field using public api endpoints
## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/1611
## 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)
2024-01-25 12:52:55 +00:00
Yulya Artyukhina
19cae8086e
Retry perform_notification with Telegram ratelimit countdown on RetryAfter error (#3744)
# What this PR does
Use Telegram ratelimit countdown when retry `perform_notification` task
on `RetryAfter` error
## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/2451

## 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)
2024-01-24 15:31:56 +00:00
Michael Derynck
032ced6fd0
Add more logging to plugin sync and install (#3730)
# What this PR does
Add logging to process for syncing OnCall backend with Grafana to help
troubleshoot issues in self-hosted setups.


## Which issue(s) this PR fixes

## 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)
2024-01-23 22:59:33 +00:00
Joey Orlando
60fc9e6f74
Update CHANGELOG.md 2024-01-23 16:04:43 -05:00
Joey Orlando
fef81c598b
Update CHANGELOG.md 2024-01-23 09:52:37 -05:00
Rares Mardare
fc40abac9e
Improved alert group table columns layout calculation (#3712)
# What this PR does

Improves calculations across columns width

## Which issue(s) this PR fixes

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

## 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)
2024-01-19 11:25:18 +00:00
Joey Orlando
87d7901a59
Update CHANGELOG.md 2024-01-18 08:04:25 -05:00
Joey Orlando
16b648bd15
fix infinitely retrying apps.alerts.tasks.notify_user.perform_notification task (#3708)
# Which issue(s) this PR fixes

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

## 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)
2024-01-18 07:07:01 -05:00
Rares Mardare
b312667d31
AG columns polishing (#3668)
# What this PR does

## Which issue(s) this PR fixes

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

## 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)
2024-01-18 11:15:13 +00:00
Joey Orlando
78de298a2e
Update CHANGELOG.md 2024-01-17 12:02:11 -05:00
Matias Bordese
c99788e9d2
Update schedule on-call cache on scheduled refresh tasks (#3699)
Related to https://github.com/grafana/oncall/issues/3673
Keep cache up to date on every schedule refresh task run (which should
keep cache populated every time), helping on any call using cached
information (particularly the direct paging slack dialog building).
2024-01-17 16:30:11 +00:00
Vadim Stepanov
6c248ed1c8
Fix posting Slack message when route is deleted (#3702)
# What this PR does

Fixes https://github.com/grafana/oncall/issues/3646

## 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)
2024-01-17 13:00:25 +00:00
Rares Mardare
3c2c259721
Proper fix for GForm not resetting the hidden fields to undefined (#3691)
# What this PR does

## Which issue(s) this PR fixes

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

## 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)
2024-01-16 15:17:42 +00:00
Joey Orlando
72fc32daf6
Update CHANGELOG.md 2024-01-16 07:13:51 -05:00
Vadim Stepanov
80f85cf4b4
Fix updating a shift swap with no Slack message (#3686)
# What this PR does

Fixes https://github.com/grafana/oncall/issues/3648

## 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>
2024-01-15 17:36:01 +00:00
Joey Orlando
da7f07ffd6
Fix occasional AttributeError in apps.grafana_plugin.tasks.sync.sync_organization_async task (#3687)
# Which issue(s) this PR fixes

Fix this issue I came across in a celery task retry exception log:
![Screenshot 2024-01-15 at 11 21
13](https://github.com/grafana/oncall/assets/9406895/ed08f2f1-dc7d-4ad3-88a0-dc02cd740582)


## 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)
2024-01-15 11:34:40 -05:00
Matias Bordese
59bc17b186
Update CHANGELOG.md 2024-01-12 14:21:56 -03:00
Maxim Mordasov
866487b949
Fix several UI related bugs (#3659)
# What this PR does

Fix several UI related bugs

## Which issue(s) this PR fixes


https://github.com/grafana/oncall/issues/3585
https://github.com/grafana/oncall-private/issues/2427

## 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)
2024-01-12 15:35:21 +00:00
Matias Bordese
8656404598
Fix oncall_now for a schedule in orgs with multiple entries (#3671)
Fixes https://github.com/grafana/oncall/issues/3626
2024-01-12 14:46:13 +00:00
Vadim Stepanov
91040a5c25
changelog 2024-01-12 13:16:42 +00:00
Michael Derynck
d49af63d75
Fix unicode character encoding in JSON for webhooks (#3670)
# What this PR does
Fixes escaping for unicode characters in webhooks.

## Which issue(s) this PR fixes
#3149 

## 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)
2024-01-11 19:35:23 +00:00
Joey Orlando
39421f2cc7
Update CHANGELOG.md 2024-01-10 14:07:03 -05:00
Yulya Artyukhina
c947f8992e
Add endpoint for alert group escalation snapshot (#3615)
# What this PR does
Adds endpoint for alert group escalation snapshot

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

## 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)
2024-01-10 14:52:59 +00:00
Yulya Artyukhina
a7d441647e
Add stack slug to /organization endpoint response (#3644)
# What this PR does
Add stack slug to /organization endpoint response

## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/2444
## 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)
2024-01-10 12:29:43 +00:00
Joey Orlando
616d474e59
Move mobile app QR code to Grafana user profile page (#3296)
# What this PR does

Dependent on https://github.com/grafana/grafana/pull/77863

## 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: Rares Mardare <rares.mardare@grafana.com>
2024-01-10 11:59:44 +00:00
Joey Orlando
f20aa75869
Fix module 'apps.schedules.tasks.notify_about_empty_shifts_in_schedule' has no attribute 'apply_async' AttributeError (#3640)
# Which issue(s) this PR fixes

We've been seeing this `AttributeError` quite frequently for quite some
time
([logs](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%22oPl%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bcluster%3D~%5C%22prod-%28eu-west-0%7Cus-central-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%60AttributeError%28%5C%22module%20%27apps.schedules.tasks.notify_about_empty_shifts_in_schedule%27%20has%20no%20attribute%20%27apply_async%27%5C%22%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-7d%22,%22to%22:%22now%22%7D%7D%7D&orgId=1))

## 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)
2024-01-10 06:22:44 -05:00
Joey Orlando
006ee4b860
Decrease outgoing webhook timeouts from 10secs to 4secs (#3639)
# Which issue(s) this PR fixes

See all the context
[here](https://raintank-corp.slack.com/archives/C025VMT6SPK/p1704802171131009?thread_ts=1704762857.043879&cid=C025VMT6SPK)

<img width="690" alt="Screenshot 2024-01-09 at 15 26 33"
src="https://github.com/grafana/oncall/assets/9406895/e4c794a3-508d-4f24-af22-0f800828271d">


## 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)
2024-01-09 19:55:39 -05:00
Joey Orlando
4cc4099710
Address Telegram HTTP 500s when receiving message from Telegram in discussion group (#3622)
# Which issue(s) this PR fixes

Closes https://github.com/grafana/oncall/issues/3621

## Checklist

- [x] 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)
2024-01-09 08:31:56 -05:00
Joey Orlando
72e7224ad3
do not retry firebase.messaging.UnregisteredError exceptions for FCM relay tasks (#3637)
# What this PR does

_tldr_; we had a lengthy discussion about this
[here](https://raintank-corp.slack.com/archives/C04JCU51NF8/p1701893410542629?thread_ts=1701690117.016909&cid=C04JCU51NF8).
`firebase.messaging.UnregisteredError` errors occur because of events
outside of our control and retrying will never fix them, therefore we
should simply skip retrying in this case.

We retry these fairly often
([logs](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%22iWZ%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%23%20%7Bcluster%3D~%5C%22prod-%28eu-west-0%7Cus-central-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%5C%22task_name%3Dapps.webhooks.tasks.trigger_webhook.execute_webhook%5C%22%20%7C%3D%20%5C%22retry%5C%22%5Cn%7Bcluster%3D~%5C%22prod-%28eu-west-0%7Cus-central-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%5C%22apps.mobile_app.fcm_relay.fcm_relay_async%5C%22%20%7C%3D%20%5C%22UnregisteredError%5C%22%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-7d%22,%22to%22:%22now%22%7D%7D%7D&orgId=1))
which eats up unnecessary celery worker resources.

Related to https://github.com/grafana/oncall-private/issues/1820

## 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)
2024-01-09 08:14:20 -05:00
Joey Orlando
9fab4a7b06
Update CHANGELOG.md 2024-01-08 19:21:00 -05:00
Joey Orlando
3bcf5efc24
manually retry for requests.exceptions.Timeout exceptions when sending outgoing webhooks (#3632)
# Which issue(s) this PR fixes

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

## 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)
2024-01-08 19:13:15 -05:00
Matias Bordese
d57b41b758
Create log record for telegram formatting error in notification (#3628) 2024-01-08 20:12:28 +00:00
Dominik Broj
82b5a877d9
Brojd/fix timezone issues (#3618)
# What this PR does
- fix multiple issues on schedule related to handling timezones

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

## 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)
2024-01-08 13:57:01 +00:00
Salvatore Giordano
139df23911
Let mobile use paging endpoint (#3619)
# 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)
2024-01-08 12:18:39 +00:00
Dominik Broj
960dcae608
Brojd/implement insights (#3583)
# What this PR does
- Use Grafana Scenes to add Insights as a separate page in OnCall
- Add an option to run Prometheus instance via helm so that Prometheus
Exporter feature can be used easily without the need of setting up
Prometheus separately

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

## 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)
2024-01-05 07:05:31 +00:00
Joey Orlando
74b68a8d27
Update CHANGELOG.md 2024-01-04 17:14:03 -05:00
Matias Bordese
181d5d5712
Setup one-at-a-time lock for sync_organization tasks (#3612)
Related to https://github.com/grafana/support-escalations/issues/8844

Queuing multiple sync_organization tasks for the same org could lead to
parallel running of the sync task for the same organization, potentially
creating duplicated entries and/or generating multiple unneeded API
calls. This prevents running an organization sync while there is a sync
for that same org in progress.
2024-01-04 15:34:28 +00:00
Maxim Mordasov
59a064e05a
Bump MobX version to 6.12 and simplify stores (#3561)
# What this PR does

- update 
  "mobx" to "6.12.0",
  "mobx-react" to "9.1.0",
- add `runInAction` when update observables after async operations
- update babel config and ts config according to the
[guide](https://mobx.js.org/migrating-from-4-or-5.html)
- add  `makeObservable(this);` to each model constructor

## Which issue(s) this PR fixes

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

## 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)
2024-01-03 11:37:01 +00:00