Set app_id, user_id, and tenant_id as baggage items on spans.
This commit is contained in:
parent
34d1046c6d
commit
0b683876f8
|
@ -23,7 +23,7 @@ export default async (ctx: UserCtx, next: any) => {
|
|||
|
||||
if (requestAppId) {
|
||||
const span = tracer.scope().active()
|
||||
span?.addTags({ app_id: requestAppId })
|
||||
span?.setBaggageItem("app_id", requestAppId)
|
||||
}
|
||||
|
||||
// deny access to application preview
|
||||
|
@ -76,6 +76,14 @@ export default async (ctx: UserCtx, next: any) => {
|
|||
return next()
|
||||
}
|
||||
|
||||
if (ctx.user) {
|
||||
const span = tracer.scope().active()
|
||||
if (ctx.user._id) {
|
||||
span?.setBaggageItem("user_id", ctx.user._id)
|
||||
}
|
||||
span?.setBaggageItem("tenant_id", ctx.user.tenantId)
|
||||
}
|
||||
|
||||
const userId = ctx.user ? generateUserMetadataID(ctx.user._id!) : undefined
|
||||
|
||||
// if the user is not in the right tenant then make sure to wipe their cookie
|
||||
|
|
Loading…
Reference in New Issue