Commit graph

1687 commits

Author SHA1 Message Date
Matias Bordese
0fa3522db7
Add doc references to regex_search jinja filter (#4973)
This filter wasn't listed in cheatsheet or docs, but it is usually more
flexible/simpler than `regex_match` if trying to search for a substring
in payload.

Also setup a
[timeout](https://github.com/mrabarnett/mrab-regex?tab=readme-ov-file#timeout)
when regex searching/matching/replacing.

Related to [this
issue](https://docs.google.com/document/d/1gESMLdbJSnLnSnK7Nhp7DvJ7f10qZXsEm5GrgBc5RqQ/edit)
2024-09-04 17:47:09 +00:00
Michael Derynck
0ff98c141c
Update cryptography dependency to 43.0.1 (#4984)
# What this PR does

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-09-04 16:54:40 +00:00
Vadim Stepanov
bb2113db58
Make cloud email domain configurable (#4982)
# What this PR does

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

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-09-04 14:46:52 +00:00
Michael Derynck
cf69289888
Relax sync team serializer validation to match underlying model (#4976)
# What this PR does
- Teams do not require valid email addresses to be sync'd
- AvatarURL can be blank

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-09-03 18:47:54 +00:00
Matias Bordese
22cd4b86fc
Handle Slack invalid_auth error when posting alert group notification (#4970)
Also, make telegram error check more flexible (case insensitive, e.g. we
got some of these recently: `telegram.error.Unauthorized: Forbidden: bot
was blocked by the user`)
2024-09-02 16:37:27 +00:00
Vadim Stepanov
7b74b65168
Fix direct paging ack (#4957)
# What this PR does

Fixes https://github.com/grafana/oncall/issues/4760 (also provides a
workaround for https://github.com/grafana/oncall/issues/4761)

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-30 09:17:09 +00:00
Michael Derynck
962cc34432
Compress sync data (#4951)
# What this PR does
- Compresses sync data being sent to engine
- Minor fix to log messages when JSON parse errors occur

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-29 18:36:35 +00:00
Matias Bordese
f5be809b47
Improve schedule filters before generating user calendar export (#4950)
Avoid checking all schedules in an organization when filtering user
events during export.
This should help with some slow requests we are noticing.
2024-08-29 11:56:03 +00:00
Matias Bordese
c281813125
Check for incident enabled before making mobile app request (#4947)
Related to some issues we have noticed in our logs
([example](https://ops.grafana-ops.net/goto/8sa28TqIR?orgId=1)).
Also make sure unexpected responses are logged too.
2024-08-28 17:56:59 +00:00
Michael Derynck
586205368e
Sync process and backend plugin tweaks (#4939)
- Split up sync requests into batches to run concurrently
- Add more logging for when API calls to Grafana fail to parse
- Call sync from backend plugin when status is called
- Lock sync from backend plugin to only run every 5 mins
- Add timer display for API call to sync to return remaining time before
sync can execute
- Remove locks from celery task since it's work is low cost and we lock
in the backend plugin anyways.
2024-08-28 16:34:30 +00:00
Matias Bordese
d3f034b218
Handle a deleted organization triggering auth (#4937)
Related to https://github.com/grafana/oncall-private/issues/2203
2024-08-28 16:32:24 +00:00
Riksus
1840f42644
Make jinja template limits configurable by env var (#4865)
# What this PR does
Fixing variable for jinja templates to env
## Which issue(s) this PR closes
Related to [issue](https://github.com/grafana/oncall/issues/2911)

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
2024-08-28 10:12:03 -06:00
Michael Derynck
9655a90f23
Fix plugin sync issues (#4930)
# What this PR does
- Fix incorrect response for error message on sync
- Remove sleep delay from sync (natural latency provides enough delay)

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-26 19:12:18 +00:00
Matias Bordese
0ac7c40671
Update org creation to use DB uniqueness constraint (#4926)
Fix issue related to
[logs](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%2257p%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22amixr-prod%5C%22,%20cluster%3D%5C%22prod-us-central-0%5C%22,%20job%3D%5C%22amixr-prod%2Famixr-engine%5C%22%7D%20%7C%3D%20%5C%22user_management_organization.user_management_organization_stack_id_org_id_727b4929_uniq%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-2d%22,%22to%22:%22now%22%7D%7D%7D&orgId=1)
(check for existing org using the unique DB index)
2024-08-26 15:03:26 +00:00
Yulya Artyukhina
c87d3018b9
Handle TimeoutError on sending message to Slack (#4916)
# What this PR does

## Which issue(s) this PR closes

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

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-26 10:27:07 +00:00
Michael Derynck
a25d44da1a
Move validate_grafana_token_format to common location, use in sync_v2 (#4919)
# What this PR does
Moves validate_grafana_token_format to GrafanaAPIClient, use it in
sync_v2 to improve logging and skip requests that would not work.

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-23 19:52:53 +00:00
Michael Derynck
a5770309d9
Add more validation when updating api_token (#4918)
# What this PR does
Skip updating stored api_token for Grafana if it does not look like one.
Note: Exact format is not checked (prefix) since there are some
differences between versions for what API tokens might look like and
this should tolerate those differences.

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-23 18:21:57 +00:00
Michael Derynck
b2b64da86c
Fix api_token not being updated (#4912)
# What this PR does
Fixes organization api_token not being updated when it differs from what
is stored in the DB.

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-23 13:22:54 +00:00
Michael Derynck
042fb49aaf
Add logging for invalid api_tokens during sync (#4905)
# What this PR does
Add logging for when we skip an organization for sync if it is missing
its api token.

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-22 20:40:18 +00:00
Matias Bordese
66925366a6
Fix flaky test depending on DB ordering (#4907)
See
https://github.com/grafana/oncall/actions/runs/10513279782/job/29128524241
2024-08-22 18:56:59 +00:00
Matias Bordese
cd5e9955b9
Make sure organization token is valid before sync (#4904)
Since we will be triggering sync for orgs without a `last_time_synced`
set, we need to make sure the token is valid (previously both,
`last_time_synced` and the token, were updated from the frontend plugin)
2024-08-22 17:49:22 +00:00
Matias Bordese
87dd5c6623
Update sync task to consider never synced orgs (#4901) 2024-08-22 15:09:28 +00:00
Alyssa Wada
070abb9d4f
docs: unified slack (#4844)
# What this PR does
Adds documentation to support the Unified IRM Slack integration

## Which issue(s) this PR closes

Related to
[issue](https://github.com/grafana/technical-documentation/issues/961)

---------

Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
2024-08-22 07:58:26 +00:00
Yulya Artyukhina
19dfe3d262
Fix getting metrics list from env (#4891)
# What this PR does

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-21 14:31:54 +00:00
Joey Orlando
0020c22143
add start_rotation_from_user_index field to /oncall_shifts internal API response (#4854)
# What this PR does

## Which issue(s) this PR closes

Closes https://github.com/grafana/support-escalations/issues/11866

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
2024-08-21 08:13:51 -04:00
Innokentii Konstantinov
5d92db18b1
Make root command configurable (#4863)
Makes IRM root command configurable via env
2024-08-21 06:54:47 +00:00
Joey Orlando
65dd0a7d20
upgrade Docker base image from python:3.12.3-alpine3.18 to python:3.12.3-alpine3.20 (#4879)
# What this PR does

Fixes [many
CVEs](https://ops.grafana-ops.net/a/grafana-vulnerabilityobs-app/sources/9/version/5561?var-package=&var-cve=CVE-2023-42363&var-riskLevel=$__all)
currently present in our `latest` tagged Docker image:

**Before**
<img width="1250" alt="Screenshot 2024-08-20 at 16 33 14"
src="https://github.com/user-attachments/assets/8215cefe-0a4c-44a8-a817-47d5d9633ceb">

**After**
<img width="1245" alt="Screenshot 2024-08-20 at 16 30 09"
src="https://github.com/user-attachments/assets/2ddc9246-edbc-4801-8dc4-cdc962786ef8">

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-20 20:44:18 +00:00
Joey Orlando
081c6bd2c2
fix synk security scan on CI (#4875)
# Which issue(s) this PR closes

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

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-20 15:06:54 -04:00
Michael Derynck
a16525ea45
Push sync from backend plugins (#4861)
# What this PR does
Change push sync to have a lock to ensure only 1 instance runs at a
time. Also adds argument to optionally specify which orgs to sync. Added
some more log messages.

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-20 16:20:33 +00:00
Joey Orlando
4a39518a56
address outstanding CVEs + remove plop from grafana-plugin/ (#4871)
# Which issue(s) this PR closes

Closes the following dependabot alerts/CVEs:

- [x] https://github.com/grafana/oncall/security/dependabot/117 -
CVE-2022-42969
- [x] https://github.com/grafana/oncall/security/dependabot/106 and
https://github.com/grafana/oncall/security/dependabot/105 -
CVE-2024-3651
- [x] https://github.com/grafana/oncall/security/dependabot/51 -
CVE-2022-46175
- [x] https://github.com/grafana/oncall/security/dependabot/124 -
CVE-2024-4068
- [ ] https://github.com/grafana/oncall/security/dependabot/78 -
CVE-2023-44270
- [ ] https://github.com/grafana/oncall/security/dependabot/132 and
https://github.com/grafana/oncall/security/dependabot/131 -
CVE-2024-39689

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-20 10:29:01 -04:00
Vadim Stepanov
68caa12d5b
Fix SSR push notifications for deleted orgs (#4868)
following up on https://github.com/grafana/oncall/pull/4813, stop
sending SSR reminders for on-call schedules from deleted orgs
2024-08-20 11:32:20 +00:00
Innokentii Konstantinov
a3684a8ddc
Add stack_id to Tenant dataclass (#4864)
Fix retrying chatops_proxy tasks

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2024-08-20 11:24:53 +00:00
Joey Orlando
b54384dee6
second AlertGroup.slack_log_message migration (#4862)
# What this PR does

Follow up to https://github.com/grafana/oncall/pull/4858

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-20 11:11:25 +00:00
Joey Orlando
82410429b4
remove leftofter/deprecated slack log report tasks (#4858)
# What this PR does

Follow up to https://github.com/grafana/oncall/pull/4686

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-19 19:10:46 -04:00
Ildar Iskhakov
48725888d1
Move slack log report from message thread to button (#4686)
# What this PR does

Continuation of [Add slack button to show log report
#4641](https://github.com/grafana/oncall/pull/4641)

## Which issue(s) this PR closes

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

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2024-08-19 20:17:06 +00:00
Joey Orlando
0c96427cfc
fix apps.telegram.tasks.send_log_and_actions_message retrying tasks (#4851)
# What this PR does

It _appears_ like Telegram may have changed one of the error messages
they return for `telegram.error.BadRequest`. This _may_ be causing us to
infinitely retry some of these tasks.

Previously we were checking for two variants of the same type of error
message:
- "Message to reply not found"
- "Replied message not found"

_However_, if I search for the following [in the
logs](https://ops.grafana-ops.net/goto/hMgBb8CSR?orgId=1):
```logql
{namespace="amixr-prod"} |~ `(Message to be replied not found|Message to reply not found|Replied message not found)`
````
I _only_ see references to "Message to be replied not found". I have
updated references to the former to this new error log message we are
seeing.

Also:
- deduplicate some of the words we check for in
`telegram.error.BadRequest` and `telegram.error.Unauthorized` into
`apps.telegram.client.TelegramClient.BadRequestMessage` and
`apps.telegram.client.TelegramClient.UnauthorizedMessage` respectively
- deduplicate some of the wording we use in the `reason` arg passed to
`TelegramToUserConnector.create_telegram_notification_error` into
`apps.telegram.models.connectors.personal.TelegramToUserConnector.NotificationErrorReason`
- standardize how we check the `message` attribute of
`telegram.error.TelegramError`s into a new `error_message_is` static
method on `apps.telegram.client.TelegramClient`
- previously we would check these error messages in two different ways:
  ```python3
  # style 1
  if "error message to check" in e.message:
    # do something

  # style 2
  if error.message == "error message to check":
    # do something
  ```

## Which issue(s) this PR closes

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

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-19 14:05:40 -04:00
Michael Derynck
f79445fbcb
Fix pagination behavior when page # exceeds search results (#4817)
# What this PR does
Change pagination to return last available page if the page number
exceeds the pages available instead of returning 404. This came up from
if the user is on a page other than the first and they enter a search
and the number of search results are smaller than what would be needed
to reach the current page number it would give a blank page and 404.

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
2024-08-19 13:59:01 +00:00
Dominik Broj
06d19bf6e9
New OnCall plugin initialization process (#4657)
# What this PR does

New OnCall plugin initialization process

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
2024-08-16 16:43:52 +00:00
Matias Bordese
a416863a28
Update alert groups public API filters support (#4832)
Related to https://github.com/grafana/oncall/issues/4747

- include labels in response
- allow filtering by labels
- allow filtering by started_at
- update docs
2024-08-15 19:58:25 +00:00
Joey Orlando
67fc52d56a
add POST /escalation public API endpoint + add public API docs for teams/organization endpoints (#4815)
# What this PR does

- Adds a `POST /escalation` public endpoint (equivalent to the internal
direct paging API endpoint)
- Adds public API documentation for teams and organization endpoints

<img width="1140" alt="Screenshot 2024-08-15 at 12 49 40"
src="https://github.com/user-attachments/assets/e0e8d6bb-f3ac-4f9e-bdf7-e8926949cc3b">

## Which issue(s) this PR closes

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

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-15 18:31:35 +00:00
Yulya Artyukhina
64bf1e5096
Speed up internal api endpoints (#4830)
# What this PR does
Reduces number of calls to db for `/schedules`, `/alertgroups` and
`/users` endpoints.
Fixes the issue when there was an additional call to db to get
organization url to build user avatar full link.

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-15 14:20:55 +00:00
Innokentii Konstantinov
27c741213f
Escalate deprecation messages (#4811)
# What this PR does
Add two deprecations messages for /escalate command
1. If integration is not yet upgraded to Grafana IRM Slack integration -
just ephemeral message asking to upgrade
2. If integration is already upgraded - deprecation message, command
will not work, but ask to use /grafana-irm escalate
2024-08-15 08:34:33 +00:00
Joey Orlando
eb777f5415
address Google OAuth2 issues where user didn't grant us the https://www.googleapis.com/auth/calendar.events.readonly scope (#4802)
# What this PR does

Follow up PR to https://github.com/grafana/oncall/pull/4792

Basically if when communicating with Google Calendar's API we encounter
an HTTP 403, or the Google client throws a
`google.auth.exceptions.RefreshError` this means one of three things:
1. the refresh token we have persisted for the user is missing the
`https://www.googleapis.com/auth/calendar.events.readonly` scope (HTTP
403)
2. the Google user has been deleted
(`google.auth.exceptions.RefreshError`)
3. the refresh token has expired (`google.auth.exceptions.RefreshError`)

To prevent scenario 1 above from happening in the future we now will
check that the token has been granted the required scopes. If the user
doesn't grant us all the necessary scopes, we will show them an error
message in the UI:
https://www.loom.com/share/0055ef03192b4154b894c2221cecbd5f

For tokens that were granted prior to this PR and which are missing the
required scope, we will show the user a dismissible warning banner in
the UI letting them know that they will need to reconnect their account
and grant us the missing permissions (see [this second demo
video](https://www.loom.com/share/bf2ee8b840864a64893165370a892bcd)
showing this).

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.

---------

Co-authored-by: Dominik <dominik.broj@grafana.com>
2024-08-14 18:02:34 -04:00
Yulya Artyukhina
29bd42c0b1
Fix collecting metrics (#4822)
# What this PR does
Reverts the accidental removal of the ApplicationMetricsCollector from
the metric register

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-14 13:53:43 +00:00
Matias Bordese
a1c67cdfe7
Address deprecation warnings in tests (#4681)
Related to https://github.com/grafana/oncall/issues/4496

[No
warnings](https://github.com/grafana/oncall/actions/runs/10359091611/job/28674729718?pr=4681#step:5:305)!
2024-08-13 20:51:18 +00:00
Vadim Stepanov
4528dc1d5c
Better logging for send_message_to_fcm_device (#4814) 2024-08-13 17:47:43 +00:00
Vadim Stepanov
01f7007f8c
Deleted organization fixes (#4813)
# What this PR does

Makes it so that:
* Shift swap requests are not created from Google Calendar for deleted
orgs
* On-call shift mobile app notifications are not sent to users from
deleted orgs

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-13 16:27:39 +00:00
Yulya Artyukhina
18726432af
Reduce a number of requests to db on alert_receive_channel internal api endpoint (#4805)
# What this PR does
Reduce a number of requests to db on `alert_receive_channel` internal
api endpoint
from
<img width="348" alt="Screenshot 2024-08-12 at 14 55 05"
src="https://github.com/user-attachments/assets/fcbadfaf-4f01-40ae-879a-86115e13984d">
to
<img width="341" alt="Screenshot 2024-08-12 at 14 55 13"
src="https://github.com/user-attachments/assets/4fbdc3f8-297a-44ed-acfa-41f6245b2a5e">

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-13 09:24:30 +00:00
Innokentii Konstantinov
b3119e5266
chore: return 422 on slack step not found (#4810)
# What this PR does
Return 422 instead of 500 when the handler for the slack incoming event
was not found to gracefully omit events on call not subscribed to.
2024-08-13 07:57:17 +00:00
Yulya Artyukhina
503939783f
Add settings var to choose application metrics to collect (#4781)
# What this PR does
Adds settings var `METRICS_TO_COLLECT` to choose what metrics should be
collected by `ApplicationMetricsCollector`.
It allows to collect different application metrics using different
exporters.

## Which issue(s) this PR closes

## 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] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-08-12 10:37:48 +00:00