Commit graph

1225 commits

Author SHA1 Message Date
Matias Bordese
d6467e9cb7
Add escalation step to notify all members from a team (#3908)
Based on https://github.com/grafana/oncall/pull/3477

---------

Co-authored-by: xssfox <xss@sprocketfox.io>
2024-02-20 10:02:23 -03:00
Dominik Broj
6da36b3c0b
Use autogenerated types for alert_receive_channels (#3851)
# What this PR does

- autogenerate new types exposed by backend, remove custom types that
duplicate autogenerated ones
- use autogenerated types for alert receive channels
- in alert_receive_channel model:
  - use autogenerate http client (`onCallApi`) for http requests
- extract methods that don't update state into
alert_receive_channel.helpers.ts and make them pure (they accept
AlertReceiveChannelStore as param) to avoid inconsistency and issues
with `this` binding
  - use `makeAutoObservable`
  - remove unneeded decorators
- rename update* methods to fetch* whenever such methods retrieve data
from backend with GET requests
- in other models use `@action.bound` for actions and arrow functions
for store methods that are not actions (in subsequent PRs we will apply
the same changes as in alert_receive_channel, this is just for now until
we do it)
- refactor http-client so that it shows global notification on http
errors automatically and provide the possibility to opt-out from it when
making a call
- improve type-safety of `GSelect`
- fix bug related to attaching alert group
(https://raintank-corp.slack.com/archives/C04JCU51NF8/p1707476487580579)

## Which issue(s) this PR fixes

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

## 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: Vadim Stepanov <vadimkerr@gmail.com>
2024-02-20 12:09:22 +00:00
Sean Wood
61a657b0cd
Allow setting email app to use SSL instead of TLS (#3911)
# What this PR does
Adds flexibility of the method of encryption in the SMTP email app. Some
email servers are configured to use port 465 (intrinsic TLS) which
requires `EMAIL_USE_SSL` instead of `EMAIL_USE_TLS`.

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

## 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>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2024-02-20 03:38:09 -05:00
Innokentii Konstantinov
acd0c44c33
Support prescribed labels (#3848)
# What this PR does

**Cleanup label typing:**
1. LabelParam -> two separate types LabekKey and LabelValue 
2. LabelData -> renamed to LabelPair. 
3. LabelKeyData -> renamed to LabelOption
Data is not giving any info about what this type represents. 
4. Remove LabelsData and LabelsKeysData types. They are just list of
types listed above and with new naming it feels obsolete.
5. ValueData removed. LabelPair is used instead.
6. Rework AlertGroupCustomLabel to use LabelKey type for key to make
type system more consistent. Name model type AlertGroupCustomLabel**DB**
and api type AlertGroupCustomLabel**API** to clearly distinguish them.

**Split update_labels_cache into two tasks** update_label_option_cache
and update_label_pairs_cache.
Original task was expecting array of LabelsData (now it's LabelPair) OR
one LabelKeyData ( now it's LabelOption). I believe having one function
with two sp different argument types makes it more complicated for
understanding.


**Make OnCall backend support prescribed labels**. OnCall will sync and
store "prescribed" field for key and values, so Label dropdown able to
disable editing for certain labels.

## Which issue(s) this PR fixes

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

---------

Co-authored-by: Maxim Mordasov <maxim.mordasov@grafana.com>
Co-authored-by: Yulya Artyukhina <Ferril.darkdiver@gmail.com>
2024-02-20 14:42:51 +08:00
Matias Bordese
0711484a50
Add status change trigger type to webhooks (#3920)
Related to https://github.com/grafana/oncall/issues/3395

This should help with upcoming planned integrations work.
2024-02-19 14:12:56 -03:00
Matias Bordese
12f55ac936
Fix user hidden fields tests (#3919) 2024-02-19 14:27:13 +00:00
Matias Bordese
4ace9780c5
Update user details internal API perms (#3900)
Related to https://github.com/grafana/oncall/issues/1820
Editor and Viewer roles have the user-settings:read permission, which
allows them to list users but with some of the data hidden. It makes
sense to allow the same thing for the detail endpoint, keeping the
viewable data restriction (fixing the referenced issue too).
2024-02-16 16:48:24 +00:00
Michael Derynck
617146f5ea
When team is removed do not delete webhooks belonging to it (#3873)
# What this PR does
When a team is deleted webhooks belonging to that team will be marked as
having no team instead of the webhook being deleted.

## 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-02-15 17:53:55 +00:00
Yulya Artyukhina
445ac74088
Quick fix for labels error on labels cache update (#3899)
# What this PR does
Check response from labels repo before updating labels cache and update
cache only if there are no errors in the response.
## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/2532
## 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-02-15 08:55:43 +00:00
Matias Bordese
adaab1c6ad
Check for permissions on Slack escalate command (#3891)
Related to https://github.com/grafana/oncall/issues/3109

Fixes issue from https://github.com/grafana/oncall/pull/3881 (problem
was that there is no organization set in the Slack request, making it
impossible to check for user permissions; check permission once an
organization is set in the form instead).
2024-02-14 19:02:09 +00:00
Michael Derynck
07916d0c71
Don't check chatops gateway link in OSS deployment (#3893)
# What this PR does
Prevents checking ability to connect instance with chatops gateway when
running in OSS deployment.

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

## 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-02-14 13:15:04 +00:00
Michael Derynck
586a65a094
Don't html escape quotes when rendering (#3884)
# What this PR does
Disable escaping quotes for html in template results

![Screenshot from 2024-02-12
12-40-38](https://github.com/grafana/oncall/assets/28077050/221be1e9-1ced-48bf-9bbc-45fa8c9a4347)

Alert group 6 shows the new rendering vs group 5 which has the previous
incorrect rendering.

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

## 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-02-12 21:10:22 +00:00
Matias Bordese
5ecdc26b0a
Revert requiring permission on Slack direct paging (#3881)
Reverting part of https://github.com/grafana/oncall/pull/3861
2024-02-12 18:48:43 +00:00
Matias Bordese
0007fc69b7
Restrict integration name uniqueness per team (#3863)
Related to https://github.com/grafana/oncall/issues/3858

We still need to improve error messages in the UI, [to be
discussed](https://raintank-corp.slack.com/archives/C04JCU51NF8/p1707486122947369).
2024-02-12 11:40:08 +00:00
Matias Bordese
2a46152477
Include all upcoming shifts in upcoming shifts internal endpoint (#3871)
Related to https://github.com/grafana/oncall/issues/3859
2024-02-09 20:36:12 +00:00
Joey Orlando
aa0d4468db
Fix rounding issue with displayed time when sending "You're going oncall" push notification (#3872)
# Which issue(s) this PR fixes

So because of how we run the task that sends the "You're going oncall"
push notifications, there are sometimes rounding "errors" in the
displayed text of the push notification. For example, if you've
configured your mobile app to remind you 12h before your on-call shift
starts it sometimes might say:

> You're going oncall in 11 hours

This is because of the [background task being executed every
10mins](https://github.com/grafana/oncall/blob/dev/engine/settings/base.py#L545-L548)
and us continually checking if now is the appropriate time to send the
notification (we took this approach because we don't have any easy way
of emitting an event exactly when a shift starts.. yay ical).

This PR corrects that by rounding to the closest configuration value
that we allow.

## 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-02-09 15:31:34 -05:00
Michael Derynck
aebd98b8f9
Change email templating to not wrap user defined templates (#3862)
# What this PR does
Change email notification templates to not wrap the user template in a
fixed body. Info has been moved to a footer. The title now also matches
the template from the user exactly and will only get a default message
if the user template result is empty.
Example:

![Screenshot from 2024-02-08
12-16-38](https://github.com/grafana/oncall/assets/28077050/bb59b7a7-7ec8-4d9d-8aef-8aff012c74f7)

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

## 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-02-09 19:03:25 +00:00
Matias Bordese
160d501bbe
Add permission checks for Slack paging and shift swaps actions (#3861)
Fixes https://github.com/grafana/oncall/issues/3109
2024-02-09 12:30:05 +00:00
Joey Orlando
dd73e589ac
make mobile app notification title and subtitle templatable (#3845)
# What this PR does

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

https://www.loom.com/share/cca9af04f905456087f25e9cbf1845ab

## 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-02-08 17:23:15 -05:00
Andrey Oleynik
7cd814507e
Improve zvonok verification call (#3768)
# What this PR does

Added support for message template during phone number verification for
the Zvonok service. Template message support allows the use of
[SSML](https://www.w3.org/TR/2010/REC-speech-synthesis11-20100907/)
markup depending on the speaker used for speech synthesis.

Example: `Your verification code is <prosody
rate="x-slow">$verification_code</prosody>`

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

---------

Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2024-02-08 14:05:11 -05:00
Matias Bordese
cb48842e49
Update escalation step wording (#3854)
Fixes https://github.com/grafana/oncall/issues/3828 (was debugging some
code around, simple update)
2024-02-08 15:04:35 +00:00
Salvatore Giordano
47768f01fc
let mobile app use escalation options endpoints (#3847)
# 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-02-07 09:55:38 +00:00
Joey Orlando
aca2804502
add pytest-xdist to speed up backend tests (#3839)
# What this PR does

Speeds up `pytest` test execution by ~30%.

More specifically, adds
[`pytest-xdist`](https://pytest-xdist.readthedocs.io/en/stable/), which
according to their docs:
> plugin extends pytest with new test execution modes, the most used
being distributing tests across multiple CPUs to speed up test execution

**Before**
<img width="270" alt="Screenshot 2024-02-05 at 15 53 13"
src="https://github.com/grafana/oncall/assets/9406895/4da33299-5bd0-4dc3-86e1-32cfdf9106f7">

**After**
<img width="254" alt="Screenshot 2024-02-05 at 15 53 04"
src="https://github.com/grafana/oncall/assets/9406895/a59eeb52-291d-4cdc-82b2-55fd31e1c1c5">
2024-02-05 16:04:15 -05:00
Matias Bordese
97cb0f597b
Add acknowledged/resolved by data to alert groups public API (#3833)
Minor improvements to the alert groups public API (helping to get better
reporting information)
2024-02-05 11:02:55 -03:00
Yulya Artyukhina
395c21f6a4
Handle ag telegram message does not exist (#3830)
# What this PR does
Restart `send_link_to_channel_message_or_fallback_to_full_alert_group`
task without retry on the first run if alert group telegram message
doesn't exist. On the second run raise Exception

## Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/2492
## 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-02-05 12:19:41 +00:00
Joey Orlando
e477394b9c
patch occasional UnicodeEncodeError that occurs with outgoing webhooks (#3832)
# Which issue(s) this PR fixes

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

## 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-02-02 21:08:04 +00:00
Matias Bordese
f5065462c9
Include teams info in users API (#3817) 2024-02-01 17:16:57 -03:00
Joey Orlando
7db7b09c55
attempt to address some SlackAPIRatelimitError exceptions (#3820)
# Which issue(s) this PR fixes

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

Attempts to address some `SlackAPIRatelimitError` exceptions seen in the
following tasks:
- `apps.slack.tasks.post_slack_rate_limit_message`
([logs](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%22qhs%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%23%20%7Bcluster%3D~%5C%22prod-%28us-central-0%7Ceu-west-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22,%20job%3D~%5C%22amixr-prod%2Famixr-engine-celery-retry%2A%5C%22%7D%5Cn%7Bcluster%3D~%5C%22prod-%28us-central-0%7Ceu-west-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%5C%22apps.slack.tasks.post_slack_rate_limit_message%5C%22%20%7C%3D%20%5C%22retry%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))
- `alerts.tasks.notify_user.perform_notification`
([logs](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%22qhs%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bcluster%3D~%5C%22prod-%28us-central-0%7Ceu-west-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%5C%22SlackAPIRatelimitError%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))

## 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-02-01 14:47:12 -05:00
Matias Bordese
de0e5a19a6
Handle alert group does not exist on telegram button press (#3814)
Fixes https://github.com/grafana/oncall-private/issues/2364
2024-02-01 17:55:35 +00:00
Yulya Artyukhina
ba122ec6ef
Update notification checker (#3818)
# What this PR does
Count sms with status "accepted" as delivered in notification checker
## Which issue(s) this PR fixes

https://raintank-corp.slack.com/archives/C025VMT6SPK/p1706799009342889?thread_ts=1706786822.083149&cid=C025VMT6SPK
## 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-02-01 15:42:43 +00:00
KevinDW-Fluxys
4e3194c106
expose OUTGOING_WEBHOOK_TIMEOUT as env var (#3801)
# What this PR does
It adds functionality to be able to configure the outgoing webhook
timeout from an environment variable.

## Which issue(s) this PR fixes
Running into timeouts when outgoing webhooks take longer than 4 seconds
(which is exceptional, but can happen) the webhook reports failure,
while it still might have succeeded on the webhook side.

## 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>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2024-02-01 10:48:09 -05:00
Innokentii Konstantinov
006d64a889
Add ability to migrate one org (#3809) 2024-02-01 18:25:36 +08:00
Innokentii Konstantinov
eb3f41c80f
Enable Grafana Alerting v2 integration (#3808)
Enables Grafana Alerting v2 feature. It will enable integration dropdown
in OnCall Contact point in the Alerting UI.
In OSS if user has grafana version which supports this feature it will
work as well. If user has old grafana/oncall - nothing will happen.

---------

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2024-02-01 16:20:47 +08:00
Innokentii Konstantinov
dc355dbf0f Fix grafana_labels sync 2024-02-01 13:43:32 +08:00
Michael Derynck
2a466a0c4f
Add transaction on_commit before signals for alert group actions (#3731)
# What this PR does
Add transactions around log record creation and check transaction
on_commit before sending signals passing DB id of alert group log
records. In cases for delete we can then assume any missing IDs on tasks
are from intentionally deleted alert groups and we can stop tasks from
retrying endlessly.

## 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-31 15:54:50 -07:00
Joey Orlando
14feaba3d1
Merge branch 'dev' of github.com:grafana/oncall into dev 2024-01-31 15:48:05 -05:00
Joey Orlando
bc0f51c071
update tests for going_oncall_notification 2024-01-31 15:48:00 -05:00
Michael Derynck
8427953fad
Fix Incident plugin status sync (#3802)
# What this PR does
- Handle case where key exists for jsonData but explicitly set to None
- Disable incident if plugin disabled after or in the case it was
removed completely from the Grafana instance

## 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-31 11:52:20 -07:00
Joey Orlando
758c12790d
fix slack API rate limit errors in send_message_to_thread_if_bot_not_in_channel task (#3803)
# What this PR does

See [this
conversation](https://raintank-corp.slack.com/archives/C04JCU51NF8/p1706722752735009)
for more context.

Additionally, improves logging for this task + adds 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)
2024-01-31 13:42:52 -05:00
Matias Bordese
3795c836d1
Add transaction block and callbacks when triggering tasks (#3779)
Related to https://github.com/grafana/oncall/issues/3729
2024-01-31 09:26:14 -05:00
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
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
Innokentii Konstantinov
c58a81bbdf
Enable labels feature only if labels plugin is enabled (#3769)
# What this PR does
Adds a check to enable labels feature only if plugin provisioned. It's
needed to be protected from reconciliation delays and etc.

## 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 07:29:16 +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