-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add several new database columns + emit two new Django signals #1522
Conversation
b83b393
to
1573288
Compare
3063c1d
to
588b4fc
Compare
5d0d2d2
to
e554c6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice done! Left a few minor comments
engine/apps/alerts/incident_appearance/renderers/phone_call_renderer.py
Outdated
Show resolved
Hide resolved
5525e81
to
57f3549
Compare
with patch.object(GrafanaAPIClient, "is_rbac_enabled_for_organization", return_value=False): | ||
with patch.object(GrafanaAPIClient, "get_users", return_value=api_users_response): | ||
with patch.object(GrafanaAPIClient, "get_teams", return_value=(api_teams_response, None)): | ||
with patch.object(GrafanaAPIClient, "get_team_members", return_value=(api_members_response, None)): | ||
with patch.object( | ||
GrafanaAPIClient, "check_token", return_value=(None, api_check_token_call_status) | ||
): | ||
with patch.object( | ||
GrafanaAPIClient, "get_grafana_plugin_settings", return_value=({"enabled": True}, None) | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly just refactored this for readability sake.. having 8 nested context managers is really difficult to deal with...
d077df6
to
63c9e01
Compare
|
||
class Meta: | ||
model = Alert | ||
fields = [ | ||
"id", | ||
"raw_request_data", | ||
] | ||
|
||
def get_raw_request_data(self, obj): | ||
# TODO: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to show something more useful than just an empty object in this case?
- add new columns - `gcom_org_contract_type` and `gcom_org_has_irm_sku` on `user_management_organization` table - `is_restricted` on `alerts_alertgroup` table - `alert_groups_created_counter_current_month` and `alert_groups_created_this_month` on `alerts_alertreceivechannel` table - emit two new Django signals - `org_sync_signal` at the end of the organization sync task - `alert_group_created_signal` when a new Alert Group is created
219f2a3
to
3cc9fcf
Compare
…fana/oncall into jorlando/sync-cloud-org-license-type
} | ||
|
||
.tag { | ||
font-size: 12px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially the plan was to add these tags to show up on Integration page as well but now that was removed from scope - for now I'll let them here as we might iterate again and possibly add the limit tag display in here.
…fana/oncall into jorlando/sync-cloud-org-license-type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be required to change slack, telegram and MSTeams renderers as well to restrict alert groups there. Worth to check if not escalation alert group also means not delivering it to the chatops integration.
Check distribute_alert
task.
@@ -14,6 +14,12 @@ | |||
] | |||
) | |||
|
|||
alert_group_created_signal = django.dispatch.Signal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add comment that subscriber to that signal must be super-fast, since it's process of creating alert group
from .user import FastUserSerializer | ||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel(logging.DEBUG) | ||
|
||
|
||
class AlertGroupFieldsCacheSerializerMixin: | ||
class AlertGroupFieldsCacheSerializerMixin(AlertsFieldCacheBusterMixin): | ||
CACHE_KEY_FORMAT_TEMPLATE = "{field_name}_alert_group_{object_id}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
# What this PR does - add new columns `gcom_org_contract_type`, `gcom_org_irm_sku_subscription_start_date`, and `gcom_org_oldest_admin_with_billing_privileges_user_id` to `user_management_organization` table + `is_restricted` column to `alerts_alertgroup` table - emit two new Django signals - `org_sync_signal` at the end of the `engine/apps/user_management/sync.py::sync_organization` method - `alert_group_created_signal` when a new Alert Group is created ## Checklist - [ ] Tests updated (N/A) - [ ] Documentation added (N/A) - [x] `CHANGELOG.md` updated --------- Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
What this PR does
gcom_org_contract_type
,gcom_org_irm_sku_subscription_start_date
, andgcom_org_oldest_admin_with_billing_privileges_user_id
touser_management_organization
table +is_restricted
column toalerts_alertgroup
tableorg_sync_signal
at the end of theengine/apps/user_management/sync.py::sync_organization
methodalert_group_created_signal
when a new Alert Group is createdChecklist
CHANGELOG.md
updated