feat(CF-536): Integrate comprehensive Sentry into task-mcp

- Create sentry.ts with MCP-aware initialization and PII scrubbing
- Replace basic inline Sentry initialization with initSentry()
- Update .env.vault-mapping for sentry.backend-node.dsn secret
- Includes PostgreSQL integration and transaction tracing

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-29 05:50:46 +02:00
parent cc2c98c4bf
commit 840767cea3
3 changed files with 122 additions and 10 deletions

View File

@@ -13,22 +13,15 @@
import dotenv from 'dotenv';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import * as Sentry from '@sentry/node';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const envPath = join(__dirname, '..', '.env');
const result = dotenv.config({ path: envPath, override: true });
// Initialize Sentry for error tracking
if (process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.SENTRY_ENVIRONMENT || 'production',
tracesSampleRate: parseFloat(process.env.SENTRY_API_TRACE_RATE || '0.1'),
integrations: [Sentry.postgresIntegration()],
});
}
// Initialize Sentry for error tracking (with MCP-aware filtering and PII scrubbing)
import { initSentry } from './sentry.js';
initSentry(process.env.SENTRY_ENVIRONMENT || 'production');
// Log environment loading status (goes to MCP server logs)
if (result.error) {