const Sentry = require('@sentry/node');

function initMonitoring() {
  Sentry.init({
    dsn: process.env.SENTRY_DSN,
    environment: process.env.NODE_ENV || 'development',
    sendDefaultPii: false,
  });
}

function captureError(error, requestId) {
  Sentry.withScope((scope) => {
    scope.setTag('request_id', requestId || 'unknown');
    Sentry.captureException(error);
  });
}

module.exports = { captureError, initMonitoring };
