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