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

[Platform][Alert]: Handle Alert Receivers/Alert Routes duplicates gracefully, now response returns 500. #9670

Open
sridhar-yb opened this issue Aug 11, 2021 · 1 comment
Assignees
Labels
area/platform Yugabyte Platform QA QA filed bugs

Comments

@sridhar-yb
Copy link

Hit POST Alert Receivers call twice

curl --location --request POST 'http://portal.dev.yugabyte.com/api/v1/customers/11d78d93-1381-4d1d-8393-ba76f47ba7a6/alert_receivers' \
--header 'X-AUTH-TOKEN: dbafc686-7c32-408e-8f9f-b752e2ca62eb' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "test-channel-15",
    "params": {
        "targetType": "Slack",
        "username": "MyName",
        "webhookUrl": "https://google.com",
        "iconUrl": "https://iconURL.com"
    }
}'

Response:

<!DOCTYPE html>
<html lang="en">

<head>
	<title>Error</title>
	<style>
		html,
		body,
		pre {
			margin: 0;
			padding: 0;
			font-family: Monaco, 'Lucida Console', monospace;
			background: #ECECEC;
		}

		h1 {
			margin: 0;
			background: #A31012;
			padding: 20px 45px;
			color: #fff;
			text-shadow: 1px 1px 1px rgba(0, 0, 0, .3);
			border-bottom: 1px solid #690000;
			font-size: 28px;
		}

		p#detail {
			margin: 0;
			padding: 15px 45px;
			background: #F5A0A0;
			border-top: 4px solid #D36D6D;
			color: #730000;
			text-shadow: 1px 1px 1px rgba(255, 255, 255, .3);
			font-size: 14px;
			border-bottom: 1px solid #BA7A7A;
		}
	</style>
</head>

<body>
	<h1>Oops, an error occurred</h1>

	<p id="detail">
		This exception has been logged with id <strong>7kk776lm3</strong>.
	</p>

</body>

</html>

It would be good to handle responses like
{ "success": false, "error": "Alert Receiver Already Existing" }

@sridhar-yb sridhar-yb added area/platform Yugabyte Platform QA QA filed bugs labels Aug 11, 2021
@sridhar-yb
Copy link
Author

cc: @VijiYB @jatinbhowad

SergeyPotachev added a commit that referenced this issue Aug 13, 2021
…tes gracefully, now response returns 500.

Summary:
  - Extracted the AlertReceiver functionality into a separate service;
  - Changed responses for updates of AlertRoute and AlertReceiver with duplicate names.

Test Plan:
- Recheck alert receiver operations;
- Check responses for attempts to create/update alert receivers/routes with duplicate names.

Reviewers: amalyshev

Reviewed By: amalyshev

Subscribers: yugaware, jenkins-bot

Differential Revision: https://phabricator.dev.yugabyte.com/D12566
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform Yugabyte Platform QA QA filed bugs
Projects
None yet
Development

No branches or pull requests

3 participants