# 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)
fixes https://github.com/grafana/oncall/issues/1523
---------
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
# What this PR does
- Disallow creating direct paging integrations for a team that already
has one + make sure this constraint is also enforced on update
- Refactor some direct paging API parts to be more reusable & simple
- Add 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)
# 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)
# What this PR does
When a webhook is being copied if it contains a password or
authorization header reference the original webhook to get this data
since it has been masked in the input data.
## Which issue(s) this PR fixes
Fixes#2604
## 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)
# What this PR does
closes#2450
## 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)
# What this PR does
Updates public docs on direct paging after introducing numerous changes
to the feature.
## Preview
https://github.com/grafana/oncall/assets/20116910/f141e8b1-ac2c-455c-81f8-9c62c4c75234
## 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)
# What this PR does
Fix Slack direct paging issue when there are >100 schedules.
## 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)
Remove docker-compose warnings when running hobby deployment without
Prometheus exporter enabled.
Otherwise, I'm getting the following warnings when running any
docker-compose command:
```bash
docker-compose up -d
WARN[0000] The "FEATURE_PROMETHEUS_EXPORTER_ENABLED" variable is not set. Defaulting to a blank string.
WARN[0000] The "PROMETHEUS_EXPORTER_SECRET" variable is not set. Defaulting to a blank string.
WARN[0000] The "FEATURE_PROMETHEUS_EXPORTER_ENABLED" variable is not set. Defaulting to a blank string.
WARN[0000] The "PROMETHEUS_EXPORTER_SECRET" variable is not set. Defaulting to a blank string.
WARN[0000] The "FEATURE_PROMETHEUS_EXPORTER_ENABLED" variable is not set. Defaulting to a blank string.
WARN[0000] The "PROMETHEUS_EXPORTER_SECRET" variable is not set. Defaulting to a blank string.
WARN[0000] The "FEATURE_PROMETHEUS_EXPORTER_ENABLED" variable is not set. Defaulting to a blank string.
WARN[0000] The "PROMETHEUS_EXPORTER_SECRET" variable is not set. Defaulting to a blank string.
[+] Building 0.0s (0/0)
[+] Running 6/6
✔ Network oncall-oss_default Created 0.0s
✔ Container oncall-oss-grafana-1 Started 0.3s
✔ Container oncall-oss-redis-1 Healthy 6.5s
✔ Container oncall-oss-oncall_db_migration-1 Exited 7.5s
✔ Container oncall-oss-engine-1 Started 7.6s
✔ Container oncall-oss-celery-1 Started 7.6s
```
# 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)
# What this PR does
- Fixes issue with slack channels sync periodic tasks when we get slack
rate limit exception.
- Adds check for active task id to avoid starting multiple tasks for one
slack team.
Collecting channels for slack for some teams causes rate limit
exception, which causes the task to restart and start collecting slack
channels from the beginning. This PR adds new paginated api call and
refactors the slack channel sync task to continue collect data after
rate limit from the step before it was raised using `cursor` value from
the slack response.
## 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: Joey Orlando <joey.orlando@grafana.com>
# What this PR does
This is a follow up to #2502 which started to remove logic to
"archiving" alert groups. This PR:
- removes all references to `AlertGroup.is_archived` and marks the
column as deprecated. We will remove it in the next release
- removes the `AlertGroup.unarchived_objects` `Manager`
- renames the `AlertGroup.all_objects` `Manager` to `AlertGroup.objects`
## 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)
# What this PR does
Changes wording so it's clear that only "additional" responders (i.e.
users paged through direct paging) are shown in this section, and users
paged via escalation chain are not shown.
Before:
<img width="601" alt="Screenshot 2023-07-18 at 10 15 28"
src="https://github.com/grafana/oncall/assets/20116910/a152692f-2f2b-46e5-b51a-71acc9a25b7d">
After:
<img width="601" alt="Screenshot 2023-07-18 at 10 16 06"
src="https://github.com/grafana/oncall/assets/20116910/6ff95c72-a883-4a7a-a81a-4ae7fe11877f">
## 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)
# What this PR does
These columns don't appear to be referenced anywhere in the codebase.
Marking them as deprecated and will remove them/drop the columns from
the table in a subsequent release
## 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)
# What this PR does
Fix broken links to outgoing webhooks
## 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)
# What this PR does
This PR adds some enhancements to the `check_escalation_finished` celery
task. It short-circuits auditing of an alert group if it does not have
an escalation chain associated with it. In
`EscalationSnapshotMixin.start_escalation_if_needed`
we will not set `raw_escalation_snapshot`
([here](https://github.com/grafana/oncall/blob/dev/engine/apps/alerts/escalation_snapshot/escalation_snapshot_mixin.py#L262))
in this case:
```python3
def start_escalation_if_needed(self, countdown=START_ESCALATION_DELAY, eta=None):
"""
:type self:AlertGroup
"""
AlertGroup = apps.get_model("alerts", "AlertGroup")
is_on_maintenace_or_debug_mode = self.channel.maintenance_mode is not None
if (
self.is_restricted
or is_on_maintenace_or_debug_mode
or self.pause_escalation
or not self.escalation_chain_exists <-- here
):
logger.debug(
f"Not escalating alert group w/ pk: {self.pk}\n"
f"is_restricted: {self.is_restricted}\n"
f"is_on_maintenace_or_debug_mode: {is_on_maintenace_or_debug_mode}\n"
f"pause_escalation: {self.pause_escalation}\n"
f"escalation_chain_exists: {self.escalation_chain_exists}"
)
return
logger.debug(f"Start escalation for alert group with pk: {self.pk}")
# take raw escalation snapshot from db if escalation is paused
raw_escalation_snapshot = (
self.build_raw_escalation_snapshot() if not self.pause_escalation else self.raw_escalation_snapshot
)
task_id = celery_uuid()
AlertGroup.all_objects.filter(pk=self.pk,).update(
active_escalation_id=task_id,
is_escalation_finished=False,
raw_escalation_snapshot=raw_escalation_snapshot,
)
```
`EscalationSnapshotMixin.escalation_chain_exists` is as such:
```python3
@property
def escalation_chain_exists(self) -> bool:
if self.pause_escalation:
return False
elif not self.channel_filter:
return False
return self.channel_filter.escalation_chain is not None
```
## 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)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required) (N/A)
Related to https://github.com/grafana/oncall/issues/458
Change version naming for plugin and docker releases to drop the `v`
prefix (ie. `1.2.3` instead of `v1.2.3`).
Update both to keep consistency between plugin and engine versions,
which are also checked to match.
My previous PR only updated the CI that ran on PRs, I forgot about the
CD for releases.
Fixes https://github.com/grafana/oncall/actions/runs/5547818896.
You can see that this will resolve the problem because it is what allows
the PR CI to pass. I just forgot to include it in the release CD.
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
# What this PR does
Sets a default value for the PHONE_PROVIDER setting and replaces the
value of PHONE_PROVIDER with this default value if it is not valid.
## Which issue(s) this PR fixes
- [#2520](https://github.com/grafana/oncall/issues/2520)
- [#2323](https://github.com/grafana/oncall/issues/2323)
## 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>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Update "Grafana user management" url from `/org/users` to `/admin/users`
on the OnCall Users page.
# What this PR does
Currently in my Grafana Cloud instance when I click the link for
"Grafana user management" on the Users page of the OnCall app it takes
me to the `/org/users` page, which shows a 404 error (but also kinda
loads).
<img width="891" alt="2023-07-14_13-00-06"
src="https://github.com/grafana/oncall/assets/13998241/077172b8-387b-415e-af92-d394480fef1f">
## Which issue(s) this PR fixes
Discussed in Slack here:
https://raintank-corp.slack.com/archives/C0229FD3CE9/p1689006468472659
In my cloud instance the users page is found on `/admin/users`.
<img width="965" alt="2023-07-14_13-01-33"
src="https://github.com/grafana/oncall/assets/13998241/4e74000c-1713-406d-b23b-1691925158e6">
## 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)
# What this PR does
- Update docs to callout permission requirement in mobile app doc for
responding to alert group.
- Update link to RBAC fixed role doc for mapping between OnCall RBAC
fixed role and Grafana basic role.
# What this PR does
* users table: added warnings: No default notifications set, No
important notifications set
* users table: removed warnings when messenger is not configured (e.g.
telegram channels are not connected -> no need to show telegram warning
in users table)
* users table: moved current user to first place
* user profile: cleaned up and added hints to notification channel
connectors
* user profile: cleaned up and added hints to calendar sync
* chatops-slack: cleaned up and added hints to slack settings
fixes https://github.com/grafana/oncall/issues/2418
## 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)
This reverts commit 03f5b0f071.
# 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)
# What this PR does
- Remove `heartbeat_heartbeat` table. This model/table does not seems to
be deprecated/used anywhere (no data in this in production/staging; see
more comments in the code about this).
This PR is a step for migrating to AlertManager v2. I want to simplify
config thing a little to be able to move forward.
In INTEGRATIONS_TO_REVERSE_URL_MAP key equal value and in all cases we
just don't need it.
Public API is different, since I need this mapping for migration to
AlertManager v2 to provide backward-compatibility. It will be done in
next PRs.
# What this PR does
Fix authorization header was being masked in the requests instead of
only in logs
## 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)
# What this PR does
This PR:
- adds a few attributes to paginated API responses
- removes channel filter "send demo alert" internal API endpoint + tests
(this endpoint was marked as deprecated + not consumed by the web UI)
With the new paginated API response schema, the web UI will no longer
need to:
- hardcode `ITEMS_PER_PAGE` for each table
- manually calculate total number of pages
(these two things ☝️ will be done in
https://github.com/grafana/oncall/issues/2476)
For `GET /api/internal/v1/alertgroups` the response will now look like
this:
```diff
{
"next": <url> | None,
"previous": <url> | None,
"results": [],
++ "page_size": <int>
}
```
For all other paginated API responses, the response will now look like:
```diff
{
"count": <int>,
"next": <url> | None,
"previous": <url> | None,
"results": [],
++ "page_size": <int>,
++ "current_page_number": <int>,
++ "total_pages": <int>
}
```
## TODO
- [x] update public API docs to include these new attributes
## 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)
# What this PR does
Fix the following pre-existing `import` `mypy` errors (related to
#2392):
```bash
❯ mypy .
settings/prod_without_db.py:4: error: Cannot find implementation or library stub for module named "uwsgi" [import]
engine/logging/formatters.py:2: error: Skipping analyzing "pythonjsonlogger": module is installed, but missing library stubs or py.typed marker [import]
engine/logging/formatters.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
engine/celery.py:7: error: Skipping analyzing "celery.utils.debug": module is installed, but missing library stubs or py.typed marker [import]
Found 3 errors in 3 files (checked 595 source files)
```
## 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)
# What this PR does
I don't see any traffic to these endpoint URLs over the past week. The
terraform "renderers" in `engine/apps/alerts/terraform_renderer` make a
lot of references to amixr, making think these are legacy, and can be
removed.
## 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)