From 8294ab56396771814ff5c0ea693cabb83598650a Mon Sep 17 00:00:00 2001 From: Innokentii Konstantinov Date: Wed, 3 Apr 2024 16:28:22 +0800 Subject: [PATCH 1/3] Add more logs for updating slack user group members (#4146) --- engine/apps/slack/models/slack_usergroup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engine/apps/slack/models/slack_usergroup.py b/engine/apps/slack/models/slack_usergroup.py index 3bdda3de..244d4f22 100644 --- a/engine/apps/slack/models/slack_usergroup.py +++ b/engine/apps/slack/models/slack_usergroup.py @@ -110,6 +110,8 @@ class SlackUserGroup(models.Model): logger.info(f"Skipping usergroup {self.slack_id}, already populated correctly") return + logger.info(f"Slack user group {self.slack_id} memberlist in not up-to-date, updating, members {slack_ids}") + try: self.update_members(slack_ids) except SlackAPIPermissionDeniedError: @@ -121,12 +123,14 @@ class SlackUserGroup(models.Model): try: sc.usergroups_users_update(usergroup=self.slack_id, users=slack_ids) except (SlackAPITokenError, SlackAPIUsergroupNotFoundError, SlackAPIInvalidUsersError) as err: - logger.warning(f"Slack usergroup update failed: {err}") - except SlackAPIError: + logger.warning(f"Slack usergroup {self.slack_id} update failed: {err}") + except SlackAPIError as slack_api_error: + logger.warning(f"Slack usergroup {self.slack_id} update failed: {slack_api_error}") raise else: self.members = slack_ids self.save(update_fields=("members",)) + logger.info(f"Saved cached memberlist for slack user group {self.slack_id}, members {slack_ids}") def get_users_from_members_for_organization(self, organization): return organization.users.filter( From a51b7a79a86ce627bc41b4b9d6f71c910b470b5f Mon Sep 17 00:00:00 2001 From: Alyssa Wada <101596687+alyssawada@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:24:56 -0600 Subject: [PATCH 2/3] update docs landing page (#4116) # What this PR does Updates the OnCall docs landing page to implement new page design and card grid layout. ## Which issue(s) this PR closes Closes #4086 ## 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. --- docs/sources/_index.md | 123 ++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 69 deletions(-) diff --git a/docs/sources/_index.md b/docs/sources/_index.md index a81dd89c..d8549339 100644 --- a/docs/sources/_index.md +++ b/docs/sources/_index.md @@ -1,81 +1,66 @@ --- -title: Grafana OnCall -menuTitle: OnCall -description: Learn about the key features of Grafana OnCall and how improve your IRM solution -weight: 500 - -# This is the oncall index document -# Please do not make changes to the weight of this document -# The weight is set for ordering in the docs/grafana-cloud/alerting-and-irm/ folder - -keywords: - - OnCall - - Grafana Cloud - - Alerts - - Notifications - - On-call - - Escalation - - IRM -canonical: https://grafana.com/docs/oncall/latest/ aliases: - /docs/grafana-cloud/alerting-and-irm/oncall/ + - /docs/oncall/ # /docs/oncall// +canonical: https://grafana.com/docs/oncall/latest/ +description: Learn about the key benefits and features of Grafana OnCall +labels: + products: + - cloud + - oss +menuTitle: OnCall +title: Grafana OnCall +weight: 500 +hero: + title: Grafana OnCall + level: 1 + image: /media/docs/grafana-cloud/alerting-and-irm/grafana-icon-oncall.svg + width: 100 + height: 100 + description: Grafana OnCall allows you to automate alert routing and escalation to ensure swift resolution and service reliability. +cards: + title_class: pt-0 lh-1 + items: + - title: Introduction + href: ./intro/ + description: Learn more about the key benefits and features that are available with Grafana OnCall. + height: 24 + - title: Set up + href: ./set-up/ + description: Explore the set up options for Grafana OnCall. + height: 24 + - title: Configure + href: ./configure/ + description: Customize alert escalation and routing with flexible configuration options. Explore how to configure alert templates, routing rules, and outgoing webhooks. + height: 24 + - title: Integrations + href: ./integrations/ + description: Connect external alert sources, ChatOps tools, and much more to ensure alerts and updates are routed to and from OnCall, regardless of the other tools in your workflow. + - title: Manage on-call schedules + href: ./manage/on-call-schedules/ + description: Create and manage on-call schedules, scheduled overrides, and shift swaps. + height: 24 + - title: Configure user notifications + href: ./manage/notify/ + description: Create, manage, and view user notification policies. + height: 24 --- -# Grafana OnCall documentation +{{< docs/hero-simple key="hero" >}} -Grafana OnCall is an incident response and on-call management system that helps teams reduce the stress and maintenance of being on-call. Based on the Grafana -OnCall OSS project, Grafana OnCall is available on Grafana Cloud as part of the Grafana Incident Response & Management (IRM) solution. +--- -## What is Grafana OnCall? +## Overview -Grafana OnCall is a robust on-call management and incident response tool that is conveniently integrated into your Grafana Cloud environment. +Respond to issues faster and improve your service reliability with Grafana OnCall. +Integrated directly into Grafana Cloud, you can automatically route alerts to designated on-call teams and ChatOps +channels according to predefined escalation policies, schedules, and notification preferences. -Positioned at the core of Grafana’s Incident Response & Management (IRM) solution, Grafana OnCall automatically routes and escalates alerts to on-call teams and -channels based on your predefined escalation policies and on-call schedules. +Alleviate the burden of being on-call with customized schedules tailored to your team's availability and timezones. +Personalize notification settings to ensure individuals receive alerts through their preferred channels, such as SMS, mobile apps, or ChatOps platforms. -## Key features +Through automated alert routing and escalation, Grafana OnCall reduces incident response time, minimizes downtime and helps mitigate the impact of incidents. -### Diverse monitoring system support +## Explore -Grafana OnCall integrates with a diverse set of monitoring systems, including Grafana, Prometheus, Alertmanager, Zabbix, and more. This flexibility ensures -that, regardless of your existing monitoring infrastructure, your team benefits from Grafana OnCall. - -### Automatic escalation to on-call rotations - -Efficiently manage on-call rotations using Grafana OnCall's flexible calendar options. Define on-call schedules directly in the OnCall app, in your preferred -calendar application with iCal format, or leverage Terraform within your "as-code" workflow. Configurable alert escalation routes notifications to on-call team -members, Slack channels, and other designated points, ensuring timely responses. - -### ChatOps focused - -Grafana OnCall integrates closely with your Slack workspace to deliver alert notifications to individuals and groups, making daily alerts more visible and -easier to manage. - -### Mobile app - -Access on-call alerts on the go with the dedicated mobile app, putting critical notifications in the palm of your hand. - -### As-code and GitOps - -Equipped with a full API and Terraform capabilities, Grafana OnCall is ready for GitOps and large organization configuration. - -### Fully customizable - -With customizable alert grouping and routing, you can decide which alerts you want to be notified of and how, ensuring the right people are notified for the -right issues. - -## Common on-call challenges - -Explore how Grafana OnCall addresses common on-call challenges: - -- **Alert Noise and Fatigue:** Automatic grouping and configurable auto-resolve settings control alert noise and reduce fatigue during incidents. -- **Balancing On-Call Load:** Schedule balance feature identifies potential workload imbalances, ensuring fair distribution. -- **Tool Sprawl:** Grafana OnCall, part of the Grafana Cloud suite, centralizes alert responses and investigations. -- **Calendar Maintenance:** Manage on-call rotations efficiently with flexible calendar integration for easy scheduling and alert escalation. -- **Custom Workflows:** Tailor incident response workflows with highly customizable alert grouping and routing for targeted notifications. - -## Get started - -To learn more about what Grafana OnCall can do for you, explore the following topics: - -{{< section >}} +{{< card-grid key="cards" type="simple" >}} From 1a4fa1a3681259ad5829e2682343d383af5173e4 Mon Sep 17 00:00:00 2001 From: Maxim Mordasov Date: Thu, 4 Apr 2024 13:17:46 +0100 Subject: [PATCH 3/3] Fix rotation creation form "Limit each shift length" feature (#4152) # What this PR does Fix rotation creation form "Limit each shift length" feature ## Which issue(s) this PR closes Closes https://github.com/grafana/support-escalations/issues/9970 ## 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. --- .../src/containers/RotationForm/RotationForm.helpers.ts | 4 ++-- .../src/containers/RotationForm/RotationForm.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/grafana-plugin/src/containers/RotationForm/RotationForm.helpers.ts b/grafana-plugin/src/containers/RotationForm/RotationForm.helpers.ts index c8aee870..5d4dcb56 100644 --- a/grafana-plugin/src/containers/RotationForm/RotationForm.helpers.ts +++ b/grafana-plugin/src/containers/RotationForm/RotationForm.helpers.ts @@ -198,8 +198,8 @@ export const dayJSAddWithDSTFixed = ({ // At first we add time as usual let newDateCandidate = baseDate.add(...addParams); - const differenceInHoursInLocalTimezone = newDateCandidate.hour() - baseDate.hour(); - const differenceInHoursInUTC = newDateCandidate.utc().hour() - baseDate.utc().hour(); + const differenceInHoursInLocalTimezone = newDateCandidate.diff(baseDate, 'hours'); + const differenceInHoursInUTC = newDateCandidate.utc().diff(baseDate.utc(), 'hours'); // But if we identify that there was a DST change before base date and the result candidate if (differenceInHoursInLocalTimezone !== differenceInHoursInUTC) { diff --git a/grafana-plugin/src/containers/RotationForm/RotationForm.tsx b/grafana-plugin/src/containers/RotationForm/RotationForm.tsx index c7f42b68..93bb8795 100644 --- a/grafana-plugin/src/containers/RotationForm/RotationForm.tsx +++ b/grafana-plugin/src/containers/RotationForm/RotationForm.tsx @@ -367,7 +367,7 @@ export const RotationForm = observer((props: RotationFormProps) => { setShowActiveOnSelectedDays(value); - if (value) { + if (value && shiftEnd.diff(shiftStart, 'hours') > 24) { setShiftEnd( dayJSAddWithDSTFixed({ baseDate: shiftStart, @@ -385,7 +385,7 @@ export const RotationForm = observer((props: RotationFormProps) => { } } }, - [showActiveOnSelectedPartOfDay, shiftStart, repeatEveryValue, repeatEveryPeriod] + [showActiveOnSelectedPartOfDay, shiftStart, shiftEnd, repeatEveryValue, repeatEveryPeriod] ); const handleShowActiveOnSelectedPartOfDayToggle = useCallback( @@ -394,7 +394,7 @@ export const RotationForm = observer((props: RotationFormProps) => { setShowActiveOnSelectedPartOfDay(value); if (!value) { - if (showActiveOnSelectedPartOfDay) { + if (showActiveOnSelectedDays && shiftEnd.diff(shiftStart, 'hours') > 24) { setShiftEnd( dayJSAddWithDSTFixed({ baseDate: shiftStart, @@ -411,7 +411,7 @@ export const RotationForm = observer((props: RotationFormProps) => { } } }, - [shiftStart, repeatEveryPeriod, repeatEveryValue, showActiveOnSelectedPartOfDay] + [shiftStart, shiftEnd, repeatEveryPeriod, repeatEveryValue, showActiveOnSelectedDays] ); useEffect(() => {