mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Add logs (#4977)
* Add better logs to build chatflow functino * Add connection logs to queue manager * Redact credentials * Add connection logs for redis pub-sub * add more loggings around queue --------- Co-authored-by: Henry <hzj94@hotmail.com>
This commit is contained in:
@@ -922,6 +922,8 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||
chatflow.analytic = JSON.stringify(newEval)
|
||||
}
|
||||
|
||||
let organizationId = ''
|
||||
|
||||
try {
|
||||
// Validate API Key if its external API request
|
||||
if (!isInternal) {
|
||||
@@ -949,6 +951,7 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||
}
|
||||
|
||||
const orgId = org.id
|
||||
organizationId = orgId
|
||||
const subscriptionId = org.subscriptionId as string
|
||||
|
||||
await checkPredictions(orgId, subscriptionId, appServer.usageCacheManager)
|
||||
@@ -977,7 +980,7 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||
if (process.env.MODE === MODE.QUEUE) {
|
||||
const predictionQueue = appServer.queueManager.getQueue('prediction')
|
||||
const job = await predictionQueue.addJob(omit(executeData, OMIT_QUEUE_JOB_DATA))
|
||||
logger.debug(`[server]: [${orgId}]: Job added to queue: ${job.id}`)
|
||||
logger.debug(`[server]: [${orgId}/${chatflow.id}/${chatId}]: Job added to queue: ${job.id}`)
|
||||
|
||||
const queueEvents = predictionQueue.getQueueEvents()
|
||||
const result = await job.waitUntilFinished(queueEvents)
|
||||
@@ -1002,7 +1005,7 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||
return result
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error('[server]: Error:', e)
|
||||
logger.error(`[server]:${organizationId}/${chatflow.id}/${chatId} Error:`, e)
|
||||
appServer.abortControllerPool.remove(`${chatflow.id}_${chatId}`)
|
||||
incrementFailedMetricCounter(appServer.metricsProvider, isInternal, isAgentFlow)
|
||||
if (e instanceof InternalFlowiseError && e.statusCode === StatusCodes.UNAUTHORIZED) {
|
||||
|
||||
Reference in New Issue
Block a user