import * as Sentry from '@sentry/nestjs';
import { nodeProfilingIntegration } from '@sentry/profiling-node';

Sentry.init({
  dsn: process.env['SENTRY_DSN'],
  environment: process.env['NODE_ENV'] ?? 'development',
  integrations: [nodeProfilingIntegration()],
  tracesSampleRate: process.env['NODE_ENV'] === 'production' ? 0.2 : 1.0,
  profilesSampleRate: process.env['NODE_ENV'] === 'production' ? 0.2 : 1.0,
  enabled: !!process.env['SENTRY_DSN'],
});
