Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Enno Gelhaus
8a6bded977
Merge branch 'main' into feat/sentry-logging-tags
Some checks failed
Build / build (22.12.0) (push) Has been cancelled
2026-05-11 12:56:57 +02:00
Enno Gelhaus
44cb6ee41e
feat: fix logging tags for sentry
Some checks failed
Build / build (22.12.0) (push) Has been cancelled
2026-04-02 16:43:40 +02:00
3 changed files with 19 additions and 3 deletions

View file

@ -34,7 +34,7 @@ services:
container_name: postiz-pg-admin
restart: always
ports:
- 8081:80
- 8082:80
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: admin
@ -133,7 +133,7 @@ services:
networks:
- temporal-network
ports:
- "8080:8080"
- "8083:8080"
volumes:
redisinsight:

View file

@ -34,6 +34,14 @@ export const initializeSentry = (appName: string, allowLogs = false) => {
],
tracesSampleRate: 1.0,
enableLogs: true,
beforeSendLog: (log: any) => {
log.attributes = { ...(log.attributes || {}), service: appName, component: 'nestjs' };
return log;
},
beforeSend(event: any) {
event.tags = { ...(event.tags || {}), service: appName, component: 'nestjs' };
return event;
},
// Profiling
profileSessionSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.45,

View file

@ -40,7 +40,9 @@ export const initializeSentryBasic = (environment: string, dsn: string, extensio
debug: environment === 'development',
tracesSampleRate: 1.0,
beforeSend(event, hint) {
beforeSend(event: any, hint: any) {
event.tags = { ...(event.tags || {}), service: 'frontend', component: 'nextjs' };
if (event.exception && event.exception.values) {
for (const exception of event.exception.values) {
if (exception.value) {
@ -77,6 +79,12 @@ export const initializeSentryBasic = (environment: string, dsn: string, extensio
return event; // Send the event to Sentry
},
beforeSendLog: (log: any) => {
log.attributes = { ...(log.attributes || {}), service: 'frontend', component: 'nextjs' };
return log;
},
});
} catch (err) {
// Log initialization errors