Skip to content
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

🔧 chore: refactor opsgenie client to decompose send notification #88588

Merged
merged 2 commits into from
Apr 2, 2025

Conversation

iamrajjoshi
Copy link
Member

@iamrajjoshi iamrajjoshi commented Apr 2, 2025

the opsgenie client's send_notification was also building the payload, which makes things coupled and was making updating the link building logic a little bit more difficult, so i am breaking this logic down.

@iamrajjoshi iamrajjoshi requested a review from mifu67 April 2, 2025 18:47
@iamrajjoshi iamrajjoshi self-assigned this Apr 2, 2025
@iamrajjoshi iamrajjoshi requested review from a team as code owners April 2, 2025 18:47
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 2, 2025
@@ -85,40 +85,32 @@ def _get_issue_alert_payload(
}
return payload

def send_notification(
def send_notification(self, data):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a simple method which takes a payload and sends a notification

):
headers = self._get_auth_headers()
interaction_type = OnCallInteractionType.CREATE
if isinstance(data, (Event, GroupEvent)):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if statement isn't needed anymore and the logic inside of it now lives in the callee, see notification.py

Copy link

codecov bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #88588       +/-   ##
===========================================
+ Coverage   45.52%   87.75%   +42.23%     
===========================================
  Files       10005    10027       +22     
  Lines      566929   567907      +978     
  Branches    22296    22296               
===========================================
+ Hits       258068   498354   +240286     
+ Misses     308441    69133   -239308     
  Partials      420      420               

@iamrajjoshi iamrajjoshi merged commit 92580d2 into master Apr 2, 2025
48 checks passed
@iamrajjoshi iamrajjoshi deleted the raj/aci/refactor-opsgenie-client branch April 2, 2025 20:46
Copy link

sentry-io bot commented Apr 3, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ ApiError: {"code":40301,"message":"To perform this action, use an API key from an API integration.","took":0.001,"requestId":"c4ab062f-9e8a-4870-b3b5-a35ad4ffbc0a"} sentry.incidents.tasks.handle_trigger_action View Issue
  • ‼️ ApiError: {"message":"Request body is not processable. Please check the errors.","errors":{"message":"Message can not be empty."},"took":0.002,"requestId":"d6588615-4bc6-44a6-9374-574cf4a26b03"} getsentry.tasks.quotas.deactivate_db_spike View Issue

Did you find this useful? React with a 👍 or 👎

andrewshie-sentry pushed a commit that referenced this pull request Apr 8, 2025
)

the opsgenie client's `send_notification` was also building the payload,
which makes things coupled and was making updating the link building
logic a little bit more difficult, so i am breaking this logic down.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants