MCPcopy Create free account
hub / github.com/effect-app/libs / spanAttributes

Function spanAttributes

packages/effect-app/src/RequestContext.ts:32–48  ·  view source on GitHub ↗
(ctx: Pick<RequestContext, "locale" | "namespace"> & Partial<RequestContext>)

Source from the content-addressed store, hash-verified

30}
31
32export const spanAttributes = (ctx: Pick<RequestContext, "locale" | "namespace"> & Partial<RequestContext>) => ({
33 "code.function.name": ctx.name,
34 "app.locale": ctx.locale,
35 "app.tenant.id": ctx.namespace,
36 ...ctx.sourceId ? { "client.id": ctx.sourceId } : {},
37 ...(ctx.userProfile?.sub
38 ? {
39 "user.id": ctx
40 .userProfile
41 .sub,
42 "user.roles": "roles" in ctx
43 .userProfile
44 ? ctx.userProfile.roles
45 : undefined
46 }
47 : {})
48})

Callers 4

logFmtLogger.tsFile · 0.90
jsonLogger.tsFile · 0.90
RequestContextMiddlewareFunction · 0.90
withRequestSpanFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…