Skip to content

Commit

Permalink
Revert the change that triggered the alert
Browse files Browse the repository at this point in the history
  • Loading branch information
zubron committed May 21, 2018
1 parent 91c60ef commit f37538c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,11 @@ For details of how the alert is triggered from the API, see the

To simulate API usage, you can use the included [`api-client`](./api-client/README.md) which will
allow the error case to be produced more quickly.

### S4

In this branch, we revert the code from the previous branch that triggered the alert.

Once the change has been reverted and deployed, the error rate will decrease, and eventually the
alert will stop firing. Once this has happened, the Alertmanager will send another message to the
configured Slack webhook to state that the error has been resolved.
8 changes: 8 additions & 0 deletions todo-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,11 @@ Once the error condition is true, the alert will go into `Pending` state for one
is notified.
Once the Alertmanager is notified, you can view the alert in the [Alertmanager UI](http://192.168.100.100:9093/#/alerts).
Alertmanager will then send the alert to the configured receiver, in this case the Slack webhook.

## S4: Reverting the alert trigger

We now modify the code to revert the change that caused the alert to be triggered.
Once the revert has been deployed and the error responses are no longer occurring, the error rate will decrease
over time and the alert will stop firing.
Once the alert is no longer active, Alertmanager will send another message to the configured Slack webhook
receiver to state that the error has been resolved.
31 changes: 9 additions & 22 deletions todo-app/app/api/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,35 +94,22 @@ module.exports = (app) => {

// create todo and send back all todos after creation
app.post('/api/todos', (req, res) => {
Todo.count({}, (err, count) => {
// create a todo, information comes from AJAX request from Angular
Todo.create({
text: req.body.text,
complete: false
}, (err, todo) => {
if (err) {
total_errors.inc();
res.send(err);
return;
}

if (count < 10) {
// create a todo, information comes from AJAX request from Angular
Todo.create({
text: req.body.text,
complete: false
}, (err, todo) => {
if (err) {
total_errors.inc();
res.send(err);
return;
}

total_todos.inc();
incomplete_todos.inc();
// get and return all the todos after you create another
getTodos(res);
});
} else {
res.status(500).send('Too many ToDo items');
}
total_todos.inc();
incomplete_todos.inc();
// get and return all the todos after you create another
getTodos(res);
});

});

// update a todo with complete status
Expand Down
2 changes: 1 addition & 1 deletion todo-app/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
replicaCount: 1
image:
repository: todo-demo
tag: s3
tag: s4
pullPolicy: IfNotPresent
service:
name: todo-app
Expand Down

0 comments on commit f37538c

Please sign in to comment.