Skip to content

Instantly share code, notes, and snippets.

@ajsharma
Created February 3, 2017 00:33
Show Gist options
  • Save ajsharma/e529c03aec73c3dfa74a523cad07701c to your computer and use it in GitHub Desktop.
Save ajsharma/e529c03aec73c3dfa74a523cad07701c to your computer and use it in GitHub Desktop.
Rollbar RQL to pull most frequent Rails errors in the last 24 hours
SELECT item.counter, item.title, count(*), max(timestamp), item.framework
FROM item_occurrence
WHERE timestamp > unix_timestamp() - 60 * 60 * 24
AND item.environment = 'production'
AND item.framework = 1
AND item.level > 30
GROUP BY item.counter
ORDER BY count(*) DESC
LIMIT 1000
@ajsharma
Copy link
Author

ajsharma commented Feb 3, 2017

framework may change depending on integration, I'm not sure.

For us, it's 1 = Rails (I figured it out by inspecting the filter dropdown in Rollbar)

@ajsharma
Copy link
Author

ajsharma commented Feb 3, 2017

the twist if you want to see ActiveJobs only

SELECT item.counter, item.title, count(*), max(timestamp), item.framework
FROM item_occurrence
WHERE timestamp > unix_timestamp() - 60 * 60 * 24
  AND item.environment = 'production'
  AND item.framework = 1
  AND item.level > 30
  AND body.trace.extra.job IS NOT NULL
GROUP BY item.counter
ORDER BY count(*) DESC
LIMIT 1000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment