Commit graph

2540 commits

Author SHA1 Message Date
Yulya Artyukhina
f1fcb41fb4
Add "user_was_notified_of_alert_groups" metric (#2334)
This PR adds new metric for Prometheus exporter
"user_was_notified_of_alert_groups" which counts how many alert groups
user was notified of.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-06-28 08:15:19 +00:00
Ildar Iskhakov
8f5441b4c6
Update CHANGELOG.md 2023-06-28 09:41:45 +08:00
Vadim Stepanov
3fafcb43b1
Fix 404 link for schedule quality (#2358)
Fixes https://github.com/grafana/oncall/issues/2357

Old link (404):
https://grafana.com/docs/oncall/latest/calendar-schedules/web-schedule/#schedule-quality-report
New link:
https://grafana.com/docs/oncall/latest/on-call-schedules/web-schedule/#schedule-quality-report
2023-06-27 11:50:16 +00:00
Joey Orlando
75028d0427
continue addressing mypy violations (#2170)
# What this PR does

See #2173 

Also, closes #2187 . All of the new files under `type_stubs/icalendar`
were autogenerated by running:

```bash
stubgen -p icalendar -o type_stubs
```

## 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-06-27 10:23:08 +00:00
Rares Mardare
951a2a5d45
Use correct slack key/display_name in templates (#2352)
Slack was prior to this using the wrong key to display the name of the
template
2023-06-27 12:31:54 +03:00
Joey Orlando
f75747ac23
For "You're Going OnCall" push notifications, show shift times in the user's configured timezone, otherwise UTC (#2351)
# Which issue(s) this PR fixes

closes #2350

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-27 05:59:54 +00:00
Ildar Iskhakov
065cc9343a
Show 100000+ in stats when there are more than 100000 alert groups in the result (#1901)
# 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-06-27 02:58:16 +00:00
Ildar Iskhakov
e265bade4f
Refactor docs for the new integrations page (#2290)
# 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)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-06-27 09:57:27 +08:00
Michael Derynck
dd713bac55
Change permissions used for finishing plugin setup (#2242)
Fixes issue where user not having `plugins:install`permission were
unable to complete setup of OnCall.

- Check multiple Grafana permissions to complete OnCall setup instead of
`plugins:install` since the plugin is already installed at this point
- Use the following permissions
  - `plugins:write` - Plugin setup will write to plugin config
- `users:read` - Grafana API key being granted to OnCall will be used to
read users from Grafana
- `teams:read` - Grafana API key being granted to OnCall will be used to
read teams from Grafana
- `apikeys:create` - If Grafana API key does not exist it will be
created
- `apikeys:delete` - If existing Grafana API key does not work it will
be deleted and recreated

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

TODO:
- [x] Fix tests
2023-06-26 22:22:13 +00:00
Matias Bordese
d23e2f44da
Update CHANGELOG.md 2023-06-26 14:12:52 -03:00
Vadim Stepanov
1203b615c9
Fix phone call & SMS relay (#2345)
# What this PR does

Fix incorrect order of arguments for phone provider method invocations
when relaying phone calls and SMS from OSS instances.

## 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-06-26 16:09:21 +00:00
Matias Bordese
f4eb2bbf2e
Remove unused prefetch_related in metrics task (#2343)
The `prefecth_related` data here is not being used later (since we are
applying filters not getting `.all`) and it is preloading all alert
groups for integrations into memory (which can be a lot).
2023-06-26 14:12:10 +00:00
jackycsl
460a2826e1
[README]fix prometheus yml indentation error (#2327)
# What this PR does
Fix the getting started guide error when enabling prometheus.

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

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [X] 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-06-26 13:44:33 +00:00
Joey Orlando
7638e75cab
Update CHANGELOG.md 2023-06-26 09:18:41 -04:00
Rares Mardare
1012c86f45
Added chatops fetch (for MSTeams) and changed styling to be compatible with global grafana styles in templates (#2337)
# 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-06-26 13:57:28 +03:00
Sergei Kuzmin
a8ce45ff0f
Set base oncall url as default for telegram.webhookUrl (#2322)
# What this PR does

## Which issue(s) this PR fixes

Grafana OnCall base_url is most likely the one to be used for Telegram
callback.

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated - Not
needed
- [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-06-26 09:23:00 +00:00
Matias Bordese
5f73af19f0
Minor updates to schedule rotation form and preview (#2316)
- When editing a shift, use `shiftStart` as `rotationStart` value
(originally, `rotationStart` was most of the time the timestamp of
creation, which is confusing in the new form; otoh, for newly created
shifts, the `shiftStart` will match `rotationStart`)
- Since shift preview is requested starting the day before the start of
the week, sometimes the displayed preview is missing the last day of the
week (preview returns 7 days by default)
2023-06-23 16:29:36 +00:00
Rares Mardare
e308b5298d
Switch old with new integrations page (#2310)
# What this PR does

- Removed old Integration usages
- Swaped old with new page

---------

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-06-23 08:50:18 +00:00
Sergei Kuzmin
370d7b9867
Secrets consistency for the chart (#1016)
- Enabling existing secrets for external MySQL and Redis
- Tolerate existing secrets for bundled charts.
- README.md: secrets handling explained.
- Fixed multiple bugs where missing required field was replaced with
default instead of failing.
- PHONE_NOTIFICATIONS_LIMIT was on the wrong level: it was not set if
existingSecret was true.

Next are the cosmetic changes. They improve chart consistency, e.g.
prevent generation of multiple new lines in certain cases:
- Common approach to spaces trimming. This typically allows curly blocks
and actual strings indentation and nice `nindent` usage:
- Two curly blocks should not trim the same space. I.e. "{{ ... -}} {{-
... }}" shouldn't happen.
- Template generates either single line or multiline string. In both
cases, no new line appears on both sides of the output string. So we
delete unnecessary new lines inside and at the end of string with
"trim-to-left" (`{{-` ) and the leading new line using "trim-to-right"
(`-}}`).
Note that trimming both leading and trailing new line is not always
easily possible: https://github.com/Masterminds/sprig/issues/357

    Example.

    ```
    {{- define "mytemplate" -}}
    {{ if someBoolean -}}
      {{ .Value.some }}
    {{- else -}}
      some string
    {{- end }}
    {{- end }}
    ```

- `template` replaced with `include`. It is often recommended to use
`include` by default, as it allows pipelining.

## Checklist

- [ ] Tests updated - No tests for Helm chart
- [X] Documentation added
- [x] `CHANGELOG.md` updated

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-06-23 05:43:05 +00:00
Matias Bordese
3dfc30cf13
Update CHANGELOG.md 2023-06-22 12:19:56 -03:00
Matias Bordese
2739db0394 Merge main to dev 2023-06-22 12:14:54 -03:00
Matias Bordese
6f387557d6
Update CHANGELOG.md 2023-06-22 12:01:21 -03:00
Yulia Shanyrova
2cdab7e804
Grouping templating chatops fix (#2307)
[css fixes, displaying chatops button visibility fix]
2023-06-22 13:01:11 +03:00
Rares Mardare
a339d80c62
Added missing chatOpsDisplayName to OSS + some ui tweaks (#2305)
# 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-06-22 10:55:00 +03:00
Ildar Iskhakov
0a493be126
Fix template preview markup (#2304)
# 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-06-22 14:34:54 +08:00
Ildar Iskhakov
8bfaccf733
Fix broken markup on alert group page, declutter, make time format consistent (#2295)
# What this PR does

This PR changes Alert Group layout according to the feedback from this
issue https://github.com/grafana/oncall/issues/2008

Also it makes time format more consistent across OnCall

## 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-06-21 15:24:50 +00:00
Rares Mardare
42a851309d
light theme fixes (#2302)
# What this PR does

- light theme fixes for templates&grouping
2023-06-21 14:46:50 +03:00
Vadim Stepanov
eada4a4355
Fix duplicate orders for user notification policies (#2278)
# What this PR does

Fixes an issue when multiple user notification policies have duplicated
order values, leading to the following unexpected behaviours:
1. Not possible to rearrange notification policies that have duplicated
orders.
2. The notification system only executes the first policy from each
order group. For example, if there are policies with orders `[0, 0, 0,
0]`, only the first policy will be executed, and all others will be
skipped. So the user will see four policies in the UI, while only one of
them will be actually executed.

This PR fixes the issue by adding a unique index on `(user_id,
important, order)` for `UserNotificationPolicy` model. However, it's not
possible to add that unique index using the ordering library that we use
due to it's implementation details.
I added a new abstract Django model `OrderedModel` that's able to work
with such unique indices + under concurrent load.

Important info on this new `OrderedModel` abstract model:
- Orders are unique on the DB level
- Orders are allowed to be non-consecutive, for example order sequence
`[100, 150, 400]` is valid
- When deleting an instance, orders of other instances don't change.
This is a notable difference from the library we use. I think it's
better to only delete the instance without changing any other orders,
because it reduces the number of dependencies between instances (e.g.
Terraform drift will be much smaller this way if a policy is deleted via
the web UI).

## Which issue(s) this PR fixes

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

## 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-06-21 11:13:56 +00:00
Yulya Artyukhina
0c46b41498
Metrics doc (#2149)
# What this PR does

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

---------

Co-authored-by: Matias Bordese <mbordese@gmail.com>
2023-06-21 11:00:13 +00:00
Rares Mardare
f48d4f1f25
Fixes for templates&grouping (#2300)
# What this PR does

- Fixed a few issues when using the light theme
- Show/Hide Escalation - Search Escalation - Reload Escalation (all
fixes)
- Inbound Email show in http endpoint
- Allow opening the route template in collapsed state (added new button
for it)
2023-06-21 13:42:01 +03:00
Yulya Artyukhina
64976d6b8d
Add dashboard for oncall metrics to provisioning plugin settings (#1973)
Add dashboard for oncall metrics to the plugin settings by following
[this
instruction](https://community.grafana.com/t/how-to-include-dashboards-in-your-data-source-plugin/62749).
Dashboards files should be in `.json` format and stored in the plugin's
directory in `/src/dashboards/`.
As the result the dashboard can be imported from the `Dashboards` tab at
the plugin settings page:
<img width="1504" alt="Screenshot 2023-06-21 at 11 28 31"
src="https://github.com/grafana/oncall/assets/22730923/8c2bfe4a-f3c8-480a-b18c-7ba21a9b8e30">

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-06-21 10:11:04 +00:00
Joey Orlando
cf6aefbd00
adjust stale PR bot to use pr:stale label instead (#2298) 2023-06-21 04:28:07 -04:00
Yulya Artyukhina
af939dc83a
Optimize getting response time for alert groups (#2296)
Optimize getting response time for alert groups in calculation metrics
task

## 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-06-21 08:16:35 +00:00
Joey Orlando
861a419b92
upgrade playwright (#2297) 2023-06-21 04:08:26 -04:00
Rares Mardare
bc32726fbb
Templates&grouping changes (#2291)
# What this PR does

- Fixed newlines in cheatsheat display
- Reference templates by keys instead of display names
- UI esthetic changes asked by Raphael (borders, sizing, spacing etc)
- Increased Demo Alert Modal height
- Moved MoveUp/MoveDown on routes to ellipsis on the right
- Hide Heartbeat Settings if there's none to display
- Removed Telegram request as now the data is available in response
2023-06-20 16:03:07 +00:00
Yulia Shanyrova
e4788d5732
Grouping templating polishing11 (#2293)
- [x] Alert group scroll
- [x] Result scroll right padding
- [x] Cheatsheet scroll right padding
- [x] Template editor and cheatsheet title alight center
- [x] Edit custom payload - left padding
- [x] Change background of Use custom payload title like Template Editor
- [x] No alert groups is missing right border
- [x] Save template - should not close the drawer if there is an error
- [x] Width cheatsheet code 100%
- [x] Edit/close Alert payload margin 8px
- [x] Background secondary Result - when Select alert group message
2023-06-20 15:11:31 +00:00
Matias Bordese
89834ee232
Changed web schedule updates to sync refresh ical (#2279)
Updating a schedule using the web UI sometimes you don't get the change
immediately available (since the ical refresh is async).
Related to https://github.com/grafana/oncall/issues/1968
2023-06-20 15:01:35 +00:00
Matias Bordese
f30e41eb27
Update test helper to match schedule UI change (#2294) 2023-06-20 11:41:10 -03:00
Ildar Iskhakov
21a6979aa1
Add inbound email field to private api (#2287)
# 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-06-20 21:54:07 +08:00
Maxim Mordasov
9f0064f21b
Schedules 2nd iteration updates (#1720)
# What this PR does

Features and bugs related to [[Q1 2023] Iteration with
Schedules](https://github.com/grafana/oncall-private/issues/1660)
milestone

## 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: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
2023-06-20 16:18:56 +03:00
Yulia Shanyrova
9e15fe6875
Grouping templating polishing10 (#2276)
# What this PR does
- Description of Alert Manager info box was changed
- Fix for filtering Escalation chains in Integration 
- Alt text for Image template
- Conditional result for Template was fixed
2023-06-20 12:47:54 +00:00
Salvatore Giordano
0177301bb8
refactor title and subtitle of shift notifications (#2288)
# 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)
- [ ] `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-06-20 10:49:13 +00:00
Joey Orlando
4f2d3bee9f
add is_restricted column to alert_group table (#2289)
# What this PR does

Plus mark `alert_receive_channel.restricted_at` column as deprecated.
This column will be removed in a future release.

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated (N/A)
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required) (N/A)
2023-06-20 06:20:32 -04:00
Joey Orlando
75682517f1
install requirements-dev.txt dependencies oncall docker image dev target (#2284)
# What this PR does

install `requirements-dev.txt` dependencies oncall docker image dev
target to allow commands like `make test` to properly work. Otherwise
you currently get:
```bash
Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "pytest": executable file not found in $PATH: unknown
make: *** [test] Error 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)
2023-06-19 05:50:59 -04:00
Innokentii Konstantinov
5d035808bb
Dev to main (#2282)
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
Co-authored-by: Ruslan Gainanov <gromrx1@gmail.com>
Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-06-19 13:52:34 +08:00
Innokentii Konstantinov
79b17ad15a Update CHANGELOG.md 2023-06-19 13:39:40 +08:00
Ildar Iskhakov
c71ed490b4
Optmise autoresolve query (#2273)
# 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)

---------

Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
2023-06-19 04:43:46 +00:00
Ildar Iskhakov
10661b6752
Refactor template for edit for DRY (#2264)
# 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)

---------

Co-authored-by: Ruslan Gainanov <gromrx1@gmail.com>
Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-06-16 11:46:19 +00:00
Joey Orlando
111ecb9297
remove legacy permission strings (#2269)
# What this PR does

Remove deprecated `permissions` `List[str]` from internal API user
response. These permission strings are no longer used and AFAICT are not
referenced anywhere in the UI.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required) (N/A)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-06-16 10:00:14 +00:00
Ruslan Gainanov
691a503cfa
fix existingSecret for RabbitMQ to default value (see #761) (#864)
**What this PR does**:
The existing value brokes the release when using external RabbitMQ. 
```
 Warning  Failed     6s (x11 over 112s)  kubelet            Error: couldn't find key password in Secret monitoring/oncall-rabbitmq-external
```

**Which issue(s) this PR fixes**:
Related MR [#761](https://github.com/grafana/oncall/pull/761)

**Checklist**
- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated

---------

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-06-16 03:14:36 +00:00