feat(diagnostics): correlate staff operations errors and audit records
This commit is contained in:
1 parent
440ce4e556
commit
a2954e4408
14 files changed
+473
-110
No files matched your search
@@ -38,3 +38,17 @@ export function setContextUserId(userId: UserId): void {
|
||||
const store = als.getStore();
|
||||
if (store) store.userId = userId;
|
||||
}
|
||||
|
||||
/** Stable correlation data exists only inside an active request or job. */
|
||||
export function getOperationContext(): {
|
||||
operationId?: string;
|
||||
userId?: number;
|
||||
} {
|
||||
const store = als.getStore();
|
||||
return store
|
||||
? {
|
||||
operationId: store.requestId,
|
||||
...(store.userId === null ? {} : { userId: Number(store.userId) }),
|
||||
}
|
||||
: {};
|
||||
}
|
||||
Reference in new issue
Block a user