mirror of
https://git.sleeping.town/mirrors/foxy-moxy
synced 2024-11-21 19:47:43 +00:00
[BC-37] add Sentry to Foxy-Moxy
This commit is contained in:
parent
b2eba9af95
commit
c0b208cc67
2 changed files with 9 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/Patreon/foxy-moxy#readme",
|
"homepage": "https://github.com/Patreon/foxy-moxy#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@sentry/node": "^5.7.1",
|
||||||
"canvas": "^2.0.1",
|
"canvas": "^2.0.1",
|
||||||
"chance": "^1.0.16",
|
"chance": "^1.0.16",
|
||||||
"connect-datadog": "*",
|
"connect-datadog": "*",
|
||||||
|
|
|
@ -3,7 +3,7 @@ const connectDatadog = require('connect-datadog')
|
||||||
const uuid = require('uuid/v4')
|
const uuid = require('uuid/v4')
|
||||||
const sanitize = require('sanitize-filename')
|
const sanitize = require('sanitize-filename')
|
||||||
const Canvas = require('canvas')
|
const Canvas = require('canvas')
|
||||||
|
const Sentry = require('@sentry/node');
|
||||||
const Fox = require('./js/fox.js')
|
const Fox = require('./js/fox.js')
|
||||||
const renderFox = require('./js/render-fox.js')
|
const renderFox = require('./js/render-fox.js')
|
||||||
|
|
||||||
|
@ -40,6 +40,10 @@ function getFox (req, res, version) {
|
||||||
const cacheTimeout = 60 * 60 * 24 * 30
|
const cacheTimeout = 60 * 60 * 24 * 30
|
||||||
const app = express()
|
const app = express()
|
||||||
app.use(connectDatadog({stat: 'foxy-moxy'}))
|
app.use(connectDatadog({stat: 'foxy-moxy'}))
|
||||||
|
Sentry.init({ dsn: 'https://46660182a19d400f9775f441ac9bcf15@sentry.io/1780766' })
|
||||||
|
|
||||||
|
// The request handler must be the first middleware on the app
|
||||||
|
app.use(Sentry.Handlers.requestHandler())
|
||||||
|
|
||||||
app.get('/healthcheck', (req, res) => {
|
app.get('/healthcheck', (req, res) => {
|
||||||
res.status(200).end()
|
res.status(200).end()
|
||||||
|
@ -53,4 +57,7 @@ app.get('/2/:width/:seed', (req, res) => {
|
||||||
getFox(req, res)
|
getFox(req, res)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// The error handler must be before any other error middleware and after all controllers
|
||||||
|
app.use(Sentry.Handlers.errorHandler())
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
|
Loading…
Reference in a new issue