Merge branch 'master' into instrument-couch
This commit is contained in:
commit
0ef42ae347
|
@ -15,7 +15,6 @@ import { UserCtx, ContextUser } from "@budibase/types"
|
|||
import tracer from "dd-trace"
|
||||
|
||||
export default async (ctx: UserCtx, next: any) => {
|
||||
return tracer.trace("currentapp middleware", {}, async span => {
|
||||
// try to get the appID from the request
|
||||
let requestAppId = await utils.getAppIdFromCtx(ctx)
|
||||
if (!requestAppId) {
|
||||
|
@ -23,6 +22,7 @@ export default async (ctx: UserCtx, next: any) => {
|
|||
}
|
||||
|
||||
if (requestAppId) {
|
||||
const span = tracer.scope().active()
|
||||
span?.addTags({ app_id: requestAppId })
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,7 @@ export default async (ctx: UserCtx, next: any) => {
|
|||
roleId = roleHeader
|
||||
|
||||
// Delete admin and builder flags so that the specified role is honoured
|
||||
ctx.user = users.removePortalUserPermissions(
|
||||
ctx.user
|
||||
) as ContextUser
|
||||
ctx.user = users.removePortalUserPermissions(ctx.user) as ContextUser
|
||||
}
|
||||
} catch (error) {
|
||||
// Swallow error and do nothing
|
||||
|
@ -119,5 +117,4 @@ export default async (ctx: UserCtx, next: any) => {
|
|||
|
||||
return next()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -52,7 +52,8 @@ export function processFormulas<T extends Row | Row[]>(
|
|||
{ dynamic, contextRows }: FormulaOpts = { dynamic: true }
|
||||
): T {
|
||||
return tracer.trace("processFormulas", {}, span => {
|
||||
span?.addTags({ table_id: table._id })
|
||||
const numRows = Array.isArray(inputRows) ? inputRows.length : 1
|
||||
span?.addTags({ table_id: table._id, dynamic, numRows })
|
||||
const rows = Array.isArray(inputRows) ? inputRows : [inputRows]
|
||||
if (rows) {
|
||||
for (let [column, schema] of Object.entries(table.schema)) {
|
||||
|
@ -77,7 +78,7 @@ export function processFormulas<T extends Row | Row[]>(
|
|||
rows[i] = {
|
||||
...row,
|
||||
[column]: tracer.trace("processStringSync", {}, span => {
|
||||
span?.addTags({ column })
|
||||
span?.addTags({ table_id: table._id, column, static: isStatic })
|
||||
return processStringSync(formula, context)
|
||||
}),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue