forked from Lex-Studios/Stellar-Spend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsentry.server.config.ts
More file actions
38 lines (33 loc) · 1.17 KB
/
Copy pathsentry.server.config.ts
File metadata and controls
38 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Sentry Server Configuration with OpenTelemetry Integration
*/
import * as Sentry from '@sentry/node';
import { nodeProfilingIntegration } from '@sentry/profiling-node';
import { OpenTelemetryIntegration } from '@sentry/opentelemetry';
// Initialize Sentry with OpenTelemetry integration
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV || 'development',
release: process.env.npm_package_version || '1.0.0',
// Enable performance monitoring
tracesSampleRate: parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE || '0.1'),
profilesSampleRate: parseFloat(process.env.SENTRY_PROFILES_SAMPLE_RATE || '0.1'),
// Integrations
integrations: [
// OpenTelemetry integration for trace correlation
new OpenTelemetryIntegration({
spanProcessor: {
onSpan: (span) => {
// Add Sentry-specific attributes to spans
const transaction = Sentry.getCurrentHub().getScope()?.getTransaction();
if (transaction) {
span.setAttribute('sentry.transaction', transaction.name);
}
},
},
}),
nodeProfilingIntegration(),
],
});
// Export configured Sentry
export default Sentry;