Skip to content

Commit

Permalink
chore: Update la gestion du scope pour sentry v8
Browse files Browse the repository at this point in the history
  • Loading branch information
Mintoo200 committed May 16, 2024
1 parent 5e4cbdd commit 6b8b314
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/client/services/bff.httpClient.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export class BffHttpClientService implements HttpClientService {
(request: InternalAxiosRequestConfig) => {
const transactionId = uuid4();
request.headers['x-transaction-id'] = transactionId;
// FIXME (GAFI 16-05-2024): On est d'accord que là, si j'ai 2 requêtes qui partent coup sur coup, le transactionId
// de la première est écrasé par la seconde ?
this.logger.setTransactionId(transactionId);
return request;
},
Expand Down
10 changes: 4 additions & 6 deletions src/client/services/logger.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import * as Sentry from '@sentry/nextjs';

export class LoggerService {
constructor(sessionId?: string) {
Sentry.configureScope((scope: Sentry.Scope) => {
scope.setTag('session_id', sessionId);
});
const scope = Sentry.getCurrentScope();
scope.setTag('session_id', sessionId);
}

private static log(
Expand All @@ -27,8 +26,7 @@ export class LoggerService {
}

setTransactionId(transactionId: string): void {
Sentry.configureScope((scope) => {
scope.setTag('transaction_id', transactionId);
});
const scope = Sentry.getCurrentScope();
scope.setTag('transaction_id', transactionId);
}
}

0 comments on commit 6b8b314

Please sign in to comment.