Merge pull request #14291 from Budibase/record-sqs-queries-in-datadog

Record SQS queries in DataDog.
This commit is contained in:
Sam Rose 2024-07-31 15:50:43 +01:00 committed by GitHub
commit ff6d220d42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -43,6 +43,7 @@ import {
} from "./filters" } from "./filters"
import { dataFilters, PROTECTED_INTERNAL_COLUMNS } from "@budibase/shared-core" import { dataFilters, PROTECTED_INTERNAL_COLUMNS } from "@budibase/shared-core"
import { isSearchingByRowID } from "./utils" import { isSearchingByRowID } from "./utils"
import tracer from "dd-trace"
const builder = new sql.Sql(SqlClient.SQL_LITE) const builder = new sql.Sql(SqlClient.SQL_LITE)
const MISSING_COLUMN_REGEX = new RegExp(`no such column: .+`) const MISSING_COLUMN_REGEX = new RegExp(`no such column: .+`)
@ -225,7 +226,11 @@ async function runSqlQuery(
} }
const db = context.getAppDB() const db = context.getAppDB()
return await tracer.trace("sqs.runSqlQuery", async span => {
span?.addTags({ sql })
return await db.sql<Row>(sql, bindings) return await db.sql<Row>(sql, bindings)
})
} }
const response = await alias.queryWithAliasing(json, processSQLQuery) const response = await alias.queryWithAliasing(json, processSQLQuery)
if (opts?.countTotalRows) { if (opts?.countTotalRows) {