Merge pull request #365 from grafana/dev

Merge dev to main for release 1.0.21
This commit is contained in:
Michael Derynck 2022-08-12 10:31:37 -06:00 committed by GitHub
commit d02c6aaab6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 292 additions and 4 deletions

View file

@ -1,5 +1,8 @@
# Change Log
## v1.0.21 (2022-08-12)
- Bug fixes
-
## v1.0.19 (2022-08-10)
- Bug fixes

View file

@ -76,6 +76,12 @@ See [Grafana docs](https://grafana.com/docs/grafana/latest/administration/plugin
<a href="https://github.com/grafana/oncall/discussions"><img width="200px" src="docs/img/GH_discussions.png"></a>
<a href="https://slack.grafana.com/"><img width="200px" src="docs/img/slack.png"></a>
## Stargazers over time
[![Stargazers over time](https://starchart.cc/grafana/oncall.svg)](https://starchart.cc/grafana/oncall)
## Further Reading
- *Migration from the PagerDuty* - [Migrator](https://github.com/grafana/oncall/tree/dev/tools/pagerduty-migrator)
- *Documentation* - [Grafana OnCall](https://grafana.com/docs/grafana-cloud/oncall/)

View file

@ -81,7 +81,10 @@ class PluginAuthentication(BaseAuthentication):
@staticmethod
def _get_user(request: Request, organization: Organization) -> User:
context = json.loads(request.headers.get("X-Grafana-Context"))
user_id = context["UserId"]
try:
user_id = context["UserId"]
except KeyError:
user_id = context["UserID"]
try:
return organization.users.get(user_id=user_id)
except User.DoesNotExist:

View file

@ -1,4 +1,4 @@
django==3.2.14
django==3.2.15
djangorestframework==3.12.4
slackclient==1.3.0
whitenoise==5.3.0

View file

@ -0,0 +1,42 @@
terraform {
required_providers {
grafana = {
source = "grafana/grafana"
version = ">= 1.22.0"
}
}
}
provider "grafana" {
alias = "oncall"
oncall_access_token = <YOUR_API_TOKEN>
}
data "grafana_oncall_user" "ikonstantinov" {
provider = grafana.oncall
username = "ikonstantinov"
}
resource "grafana_oncall_integration" "prod_alertmanager" {
provider = grafana.oncall
name = "Prod AM"
type = "alertmanager"
default_route {
escalation_chain_id = grafana_oncall_escalation_chain.default.id
}
}
resource "grafana_oncall_escalation_chain" "default" {
provider = grafana.oncall
name = "default"
}
resource "grafana_oncall_escalation" "notify_me_step" {
provider = grafana.oncall
escalation_chain_id = grafana_oncall_escalation_chain.default.id
type = "notify_persons"
persons_to_notify = [
data.grafana_oncall_user.ikonstantinov.id
]
position = 0
}

View file

@ -0,0 +1,106 @@
terraform {
required_providers {
grafana = {
source = "grafana/grafana"
version = ">= 1.22.0"
}
}
}
provider "grafana" {
alias = "oncall"
oncall_access_token = <YOUR_API_TOKEN>
}
// Users
data "grafana_oncall_user" "ikonstantinov" {
provider = grafana.oncall
username = "ikonstantinov"
}
data "grafana_oncall_user" "mkukuy" {
provider = grafana.oncall
username = "mkukuy"
}
// Schedule
resource "grafana_oncall_schedule" "primary" {
provider = grafana.oncall
name = "Primary"
type = "calendar"
time_zone = "UTC"
shifts = [
grafana_oncall_on_call_shift.week_shift.id
]
}
resource "grafana_oncall_on_call_shift" "week_shift" {
provider = grafana.oncall
name = "Week shift"
type = "rolling_users"
start = "2022-06-01T00:00:00"
duration = 60 * 60 * 24 // 24 hours
frequency = "weekly"
by_day = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"]
week_start = "MO"
rolling_users = [
[data.grafana_oncall_user.ikonstantinov.id],
[data.grafana_oncall_user.mkukuy.id]
]
time_zone = "UTC"
}
// Prod Alertmanager Integration
resource "grafana_oncall_integration" "prod_alertmanager" {
provider = grafana.oncall
name = "Prod AM"
type = "alertmanager"
default_route {
escalation_chain_id = grafana_oncall_escalation_chain.default.id
}
}
// Routes
resource "grafana_oncall_route" "critical_route" {
provider = grafana.oncall
integration_id = grafana_oncall_integration.prod_alertmanager.id
escalation_chain_id = grafana_oncall_escalation_chain.critical.id
routing_regex = "\"severity\": \"critical\""
position = 0
}
// Default escalation chain
resource "grafana_oncall_escalation_chain" "default" {
provider = grafana.oncall
name = "default"
}
resource "grafana_oncall_escalation" "wait" {
provider = grafana.oncall
escalation_chain_id = grafana_oncall_escalation_chain.default.id
type = "wait"
duration = 60 * 5
position = 0
}
resource "grafana_oncall_escalation" "notify_schedule" {
provider = grafana.oncall
escalation_chain_id = grafana_oncall_escalation_chain.default.id
type = "notify_on_call_from_schedule"
notify_on_call_from_schedule = grafana_oncall_schedule.primary.id
position = 1
}
// Critical escalation chain
resource "grafana_oncall_escalation_chain" "critical" {
provider = grafana.oncall
name = "critical"
}
resource "grafana_oncall_escalation" "notify_schedule_critical" {
provider = grafana.oncall
escalation_chain_id = grafana_oncall_escalation_chain.critical.id
type = "notify_on_call_from_schedule"
notify_on_call_from_schedule = grafana_oncall_schedule.primary.id
position = 0
}

View file

@ -0,0 +1,75 @@
terraform {
required_providers {
grafana = {
source = "grafana/grafana"
version = ">= 1.22.0"
}
}
}
provider "grafana" {
alias = "oncall"
oncall_access_token = <YOUR_API_TOKEN>
}
// Users
data "grafana_oncall_user" "ikonstantinov" {
provider = grafana.oncall
username = "ikonstantinov"
}
data "grafana_oncall_user" "mkukuy" {
provider = grafana.oncall
username = "mkukuy"
}
// Schedule
resource "grafana_oncall_schedule" "primary" {
provider = grafana.oncall
name = "Primary"
type = "calendar"
time_zone = "UTC"
shifts = [
grafana_oncall_on_call_shift.week_shift.id
]
}
resource "grafana_oncall_on_call_shift" "week_shift" {
provider = grafana.oncall
name = "Week shift"
type = "rolling_users"
start = "2022-06-01T00:00:00"
duration = 60 * 60 * 24 // 24 hours
frequency = "weekly"
by_day = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"]
week_start = "MO"
rolling_users = [
[data.grafana_oncall_user.ikonstantinov.id],
[data.grafana_oncall_user.mkukuy.id]
]
time_zone = "UTC"
}
// Prod Alertmanager Integration
resource "grafana_oncall_integration" "prod_alertmanager" {
provider = grafana.oncall
name = "Prod AM"
type = "alertmanager"
default_route {
escalation_chain_id = grafana_oncall_escalation_chain.default.id
}
}
// Default escalation chain
resource "grafana_oncall_escalation_chain" "default" {
provider = grafana.oncall
name = "default"
}
resource "grafana_oncall_escalation" "notify_schedule" {
provider = grafana.oncall
escalation_chain_id = grafana_oncall_escalation_chain.default.id
type = "notify_on_call_from_schedule"
notify_on_call_from_schedule = grafana_oncall_schedule.primary.id
position = 0
}

View file

@ -1,9 +1,62 @@
# Change Log
## v1.0.21 (2022-08-12)
- Bug fixes
-
## v1.0.19 (2022-08-10)
- Bug fixes
## v1.0.15 (2022-08-03)
- Bug fixes
## v1.0.13 (2022-07-27)
- Optimize alert group list view
- Fix a bug related to Twilio setup
## v1.0.12 (2022-07-26)
- Update push-notifications dependency
- Rework how absolute URLs are built
- Fix to show maintenance windows per team
- Logging improvements
- Internal api to get a schedule final events
## v1.0.10 (2022-07-22)
- Speed-up of alert group web caching
- Internal api for OnCall shifts
## v1.0.9 (2022-07-21)
- Frontend bug fixes & improvements
- Support regex_replace() in templates
- Bring back alert group caching and list view
## v1.0.7 (2022-07-18)
- Backend & frontend bug fixes
- Deployment improvements
- Reshape webhook payload for outgoing webhooks
- Add escalation chain usage info on escalation chains page
- Improve alert group list load speeds and simplify caching system
## v1.0.6 (2022-07-12)
- Manual Incidents enabled for teams
- Fix phone notifications for OSS
- Public API improvements
## v1.0.5 (2022-07-06)
- Bump Django to 3.2.14
- Fix PagerDuty iCal parsing
## 1.0.4 (2022-06-28)
- Allow Telegram DMs without channel connection.
## 1.0.3 (2022-06-27)
- Fix users public api endpoint. Now it returns users with all roles.
- Fix redundant notifications about gaps in schedules.
- Frontend fixes.
## 1.0.2 (2022-06-17)
- Fix Grafana Alerting integration to handle API changes in Grafana 9
- Improve public API endpoint for outgoing webhooks (/actions) by adding ability to create, update and delete
- Improve public api endpoint for for outgoing webhooks (/actions) by adding ability to create, update and delete outgoing webhook instance
## 1.0.0 (2022-06-14)
@ -11,4 +64,4 @@
## 0.0.71 (2022-06-06)
- Initial Commit Release
- Initial Commit Release