Skip to content

Commit

Permalink
Added metadata to sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiipsa committed Sep 27, 2023
1 parent 703a24c commit 341d64e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,16 @@ bot.use(

Sentry.init({
dsn: config.sentry.dsn,
release: config.commitHash,
integrations: [
new ProfilingIntegration()
],
tracesSampleRate: 1.0, // Performance Monitoring. Should use 0.1 in production
profilesSampleRate: 1.0 // Set sampling rate for profiling - this is relative to tracesSampleRate
})

Sentry.setTags({ botName: config.botName })

ES.init()

bot.use(async (ctx: BotContext, next: NextFunction): Promise<void> => {
Expand Down
11 changes: 11 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import * as dotenv from 'dotenv'
import { execSync } from 'child_process'
dotenv.config()

let commitHash = ''
try {
commitHash = execSync('git rev-parse HEAD').toString().trim()
console.log('### commitHash', commitHash)
} catch (error) {
console.error('Error retrieving commit hash:', error)
}

export default {
botName: process.env.BOT_NAME ?? 'local',
commitHash,
port: +(process.env.PORT ?? '3000'),
appAdmins:
(process.env.APP_ADMINS?.split(',').map((x) => parseInt(x))) ??
Expand Down

0 comments on commit 341d64e

Please sign in to comment.