Bugfix/metrics provider undefined error (#3489)

fix metrics provider undefined error
This commit is contained in:
Henry Heng
2024-11-08 16:22:22 +00:00
committed by GitHub
parent ccc0088d0d
commit d64cb7028b
6 changed files with 9 additions and 9 deletions
@@ -112,7 +112,7 @@ const createAssistant = async (requestBody: any): Promise<Assistant> => {
version: await getAppVersion(),
assistantId: dbResponse.id
})
appServer.metricsProvider.incrementCounter(FLOWISE_METRIC_COUNTERS.ASSISTANT_CREATED, { status: FLOWISE_COUNTER_STATUS.SUCCESS })
appServer.metricsProvider?.incrementCounter(FLOWISE_METRIC_COUNTERS.ASSISTANT_CREATED, { status: FLOWISE_COUNTER_STATUS.SUCCESS })
return dbResponse
} catch (error) {
throw new InternalFlowiseError(
@@ -192,7 +192,7 @@ const saveChatflow = async (newChatFlow: ChatFlow): Promise<any> => {
chatflowId: dbResponse.id,
flowGraph: getTelemetryFlowObj(JSON.parse(dbResponse.flowData)?.nodes, JSON.parse(dbResponse.flowData)?.edges)
})
appServer.metricsProvider.incrementCounter(
appServer.metricsProvider?.incrementCounter(
dbResponse?.type === 'MULTIAGENT' ? FLOWISE_METRIC_COUNTERS.AGENTFLOW_CREATED : FLOWISE_METRIC_COUNTERS.CHATFLOW_CREATED,
{ status: FLOWISE_COUNTER_STATUS.SUCCESS }
)
@@ -996,7 +996,7 @@ const _insertIntoVectorStoreWorkerThread = async (data: ICommonObject) => {
type: ChatType.INTERNAL,
flowGraph: omit(indexResult['result'], ['totalKeys', 'addedDocs'])
})
appServer.metricsProvider.incrementCounter(FLOWISE_METRIC_COUNTERS.VECTORSTORE_UPSERT, { status: FLOWISE_COUNTER_STATUS.SUCCESS })
appServer.metricsProvider?.incrementCounter(FLOWISE_METRIC_COUNTERS.VECTORSTORE_UPSERT, { status: FLOWISE_COUNTER_STATUS.SUCCESS })
entity.status = DocumentStoreStatus.UPSERTED
await appServer.AppDataSource.getRepository(DocumentStore).save(entity)
+1 -1
View File
@@ -18,7 +18,7 @@ const createTool = async (requestBody: any): Promise<any> => {
toolId: dbResponse.id,
toolName: dbResponse.name
})
appServer.metricsProvider.incrementCounter(FLOWISE_METRIC_COUNTERS.TOOL_CREATED, { status: FLOWISE_COUNTER_STATUS.SUCCESS })
appServer.metricsProvider?.incrementCounter(FLOWISE_METRIC_COUNTERS.TOOL_CREATED, { status: FLOWISE_COUNTER_STATUS.SUCCESS })
return dbResponse
} catch (error) {
throw new InternalFlowiseError(StatusCodes.INTERNAL_SERVER_ERROR, `Error: toolsService.createTool - ${getErrorMessage(error)}`)