Python for Entrepreneurs Transcripts
Chapter: Monitoring and logging in production
Lecture: Setting up notifications in Rollbar
0:01 So it was really cool that we went to Rollbar and we saw the error message
0:05 but how do we get notified? I mean, this is better than logging by a long shot
0:09 but it's not as good as I said it could be.
0:12 Well, you have a little bit more configuration to do for that.
0:15 So, let's go over here and look at my email, check this out, in my email,
0:20 just five minutes ago I got pretty much what we got in our dashboard,
0:25 so bam, an error has occurred, Python For Entrepreneurs Course in dev mode,
0:30 here is the error, and this just shows you the trace back of all the various things
0:35 that I showed you when we looked around, OK.
0:38 So that's really great. But, there is more options OK, so let's go over here,
0:43 click on settings for the project and go to make sure you have source control integrated,
0:48 so you can get extra information, but notifications, that's where we want to go,
0:52 so right now we have email, and we could connect this to Bitbucket issues
0:58 or if you are using Campfire or create GitHub issues automatically from this,
1:02 all of those are awesome, I'll just scroll through, we got Jira, we've got Slack,
1:07 we've got Trello, you can sort of break out of the box and do web hooks,
1:12 all you want, I am going to integrate this with Slack.
1:15 OK, so we come down here, I have already authorized Slack
1:21 and I am going to say enable Slack integration, it says cool I am going to use this
1:25 and where is it going to go, I am going to post to a runtime,
1:29 so we are going to post all he errors to runtime, save those settings,
1:33 and then if we come down here you can see on a tenth error,
1:39 tenth time error occurrs, we could sent that and it's an error not a message,
1:43 when there is a deployment, and how do we know like if something gets reactivated
1:49 or whatever, we are going to get all of these sent.
1:52 But if for some reason I don't want to know when an item is reopened,
1:56 I could just delete that, right.
2:00 OK, so let's go cause that error again.
2:03 Here it is, and if I hit it again, it's going to happen again,
2:07 actually let me just make a different error
2:09 so you can see what it looks like the first time.
2:12 It's going to be a ValueError, and this is going to trigger it, here we go,
2:19 sign in again and "Ka Boom!", ValueError.
2:24 OK, now notice, I got a little pop up already right there, now it depends on
2:28 how your Slack is set up, if it pops up like an actual notification,
2:31 or it just says "hey, there is something going on, look at this, red thing Rollbar",
2:35 nice message, there has been an error in dev, a new ValueError, kaboom,
2:42 there is some of your notifications, right, and if you have the Slack app installed
2:46 for your phone and you turn on notifications for this channel,
2:49 you can create a special runtime channel or something, right,
2:52 and then you will get those notifications popping up on your phone, straight away,
2:56 so again, we can just click here and let's use Chrome
2:59 because that is where it's authenticated against, and we'll pull it up, and there it is,
3:03 "Ka Boom", ValueError in all the stuff that you would expect to see.
3:08 So, that is how you set up the notification side, so don't forget to do that
3:13 because that is where some of the biggest value for what you have in Rollbar is,
3:18 the fact that you get notified straight away.
3:22 Final thing to notice is we have a dev section here, if we go over to settings,
3:25 you can see here we have environments dev, there could be test,
3:28 there could be production, you can hide the notifications and messages
3:33 from various things, so you can come over here and say "I don't want to see dev errors",
3:37 I only want to see production errors, or production and staging, whatever, right,
3:41 but you probably don't want to leave this on,
3:44 because you will get freaked out - "oh my gosh there is something wrong with the website",
3:46 no, actually, it's just somebody doing some development and they are not done.
3:51 Something like that. So that is how you add Rollbar to a Pyramid app.
3:57 I have this running in all of my Pyramid apps, and it has saved me more than once.