What is Rollbar? They bill themselves as the Continuous Code Improvement Platform with real time AI-assisted workflows.Interestingly enough I found them through a mobile advert and subsequently signed up on my phone. It has a great name, but what can it really do?
Signing Up
You can sign up from the website
Once your account is created, you can setup a Rollbar error
Setting up with NodeJS
First, let's create a quick node package:
builder@DESKTOP-2SQ9NQM:~/Workspaces/rollbar$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (rollbardemo)
version: (1.0.0)
description: A Test for Rollbar
entry point: (index.js)
test command:
git repository:
keywords: Rollbar
author: Isaac Johnson
license: (ISC) MIT
About to write to /home/builder/Workspaces/rollbar/package.json:
{
"name": "rollbardemo",
"version": "1.0.0",
"description": "A Test for Rollbar",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"Rollbar"
],
"author": "Isaac Johnson",
"license": "MIT"
}
Is this ok? (yes)
Now let’s install and save rollbar as a package dependency:
$ npm install --save rollbar
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN rollbardemo@1.0.0 No repository field.
+ rollbar@2.19.4
added 14 packages in 2.948s
Now just call a rollbar log:
$ cat index.js | sed "s/accessToken: '.*/accessToken: '**masked**'/"
// include and initialize the rollbar library with your access token
var Rollbar = require("rollbar");
var rollbar = new Rollbar({
accessToken: '**masked**'
captureUncaught: true,
captureUnhandledRejections: true
});
// record a generic message and send it to Rollbar
rollbar.log("Hello world!");
run it
$ node index.js
Almost immediately i see a response:
Setting up Deployment Tracking
Since Azure DevOps isn’t listed yet as a plugin, we can set up a curl command based on the API docs: https://explorer.docs.rollbar.com/#operation/post-deploy
We will want to use https://api.rollbar.com/api/1/deploy with the payload
{
"environment": "string",
"revision": "string",
"rollbar_username": "string",
"local_username": "string",
"comment": "string",
"status": "string"
}
Additionally to tie to our account we’ll want to pass X-Rollbar-Access-Token
For this, we will want to go to Settings, Project Access Tokens. We can create a new token, but we should have already a server scoped token meant for deployments:
We can do a quick test locally:
$ curl -H "X-Rollbar-Access-Token: 5*****************************6" -H Content-Type: application/json" --request POST --data '{"environment":"example","revision":"7955bbd","rollbar_username":"isaac.johnson","local_username":"isaac","comment":"first","status":"succeeded"}' https://api.rollbar.com/api/1/deploy
{
"data": {
"deploy_id": 19034354
}
}
The revision is the SHA deployed and the status needs to be one of “started”, “succeeded”, “failed” or “timed_out”.
We can then see the results in the Deployments area
So what if we add a step in our Azure DevOps pipelines.
In our aws-release.yaml:
- bash: |
#!/bin/bash
set -x
curl -H "X-Rollbar-Access-Token: $(myToken)" -H "Content-Type: application/json" --request POST --data '{"environment":"$(System.StageDisplayName)","revision":"$(Build.SourceVersion)","rollbar_username":"isaac.johnson","local_username":"isaac","comment":"Build $(Build.BuildNumber)","status":"succeeded"}' https://api.rollbar.com/api/1/deploy
displayName: 'Rollbar Notifications'
We can now see the results:
Next, let’s connect to AzDO for WI
Click connect with Azure DevOps
Then connect
But we still need to actually enable Rollbar to create Work Items
After clicking Enable we can set the types and state:
The rules are at the bottom
We can filter on a few fields:
So for instance, we can set a rule like this:
And another for just info:
Notifications
Once enabled, we can actually trigger notifications to slack through Rollbar:
setting the channel
builder@DESKTOP-2SQ9NQM:~/Workspaces/rollbar$ curl -H "X-Rollbar-Access-Token: 3******************3" -H "
Content-Type: application/json" -X PUT --data '{"enabled":true,"service_account_id":250952,"channel":"#builds"}' http
s://api.rollbar.com/api/1/notifications/slack
{
"result": {},
"err": 0
}builder@DESKTOP-2SQ9NQM:~/Workspaces/rollbar$
Now in the Notifications area we can see the right slack channel:
Clicking test notifications, we can then see the result in slack.
We can then create a notification.
GIT integration
The choices here are a bit limited. I’ve reached out to ask about others, but as of this writing have yet to hear back.
While i used Azure Repos, i do have content in Github so let's try that.
We can click connect and choose which areas to grant access.
I can then tie in a repo and even limit to a path if i desire:
This lines up to one of my public repos: https://github.com/idjohnson/kubeless-perl-cicd
I made a small change the README but didn't see any event trigger in Rollbar. I must assume it’s for tracking deployments back to their code via the SHA.
To prove it out, I set my build to push the correct SHA via Azure-pipelines (not the new variable for non-master builds):
- bash: |
#!/bin/bash
set -x
curl -H "X-Rollbar-Access-Token: *********************************" -H "Content-Type: application/json" --request POST --data '{"environment":"$(System.StageDisplayName)","revision":"$(Build.SourceVersion)","rollbar_username":"isaac.johnson","local_username":"isaac","comment":"Build $(Build.BuildNumber)","status":"succeeded"}' https://api.rollbar.com/api/1/deploy
displayName: 'Rollbar Notifications (Master)'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- bash: |
#!/bin/bash
set -x
curl -H "X-Rollbar-Access-Token: *********************************" -H "Content-Type: application/json" --request POST --data '{"environment":"$(System.StageDisplayName)","revision":"$(System.PullRequest.SourceCommitID)","rollbar_username":"isaac.johnson","local_username":"isaac","comment":"Build $(Build.BuildNumber)","status":"succeeded"}' https://api.rollbar.com/api/1/deploy
displayName: 'Rollbar Notifications (PR)'
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
Note, i could more clearly denote PR and non-PR with
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
Pro-tip: in Azure DevOps, the SHA on a PR is a post-merge value which doesn't correspond with source. So to get the source version that triggered a build, use the undocumented "System.PullRequest.SourceCommitID" variable
I forced a sync from my Azure Repos repo into Github just to prove it out:
I don’t intend to keep this in Github, but it shows a basic connection works. I noted in testing my change, the notifications kick in and work just fine:
RQL
There is a search query area (Rollbar Query Language) which looks a lot like SQL. Here we can query events and download as csv if we want
Adding developers
In Teams, we can invite people
And like most good tools out there, it has SAML integration if we wish to federate our logins out:
Billing
There is a common feature I look for on good SaaS providers and that is the ability to see my costs and know how to change them.
In Subscription, we can see our Plan as well as usage:
And the plan:
Changing plans:
Summary
Rollbar.com was created in 2012 and presently homed in the Bay area but with development also in Barcelona and Budapest. They've had just over $18m in private funding and are still privately held.
I'm so far rather impressed in the offering. It still feels a little rough around the edges; some things needed REST updates, some connectivity is not so clear on how to use it.
However, even the free tier brings some real value and in that regards, it's worth checking out. This is one of those services I definitely plan to circle back for a second pass on with a more full backed end to end solution tour.