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
+4 -4
View File
@@ -494,7 +494,7 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
flowGraph: getTelemetryFlowObj(nodes, edges)
})
appServer.metricsProvider.incrementCounter(
appServer.metricsProvider?.incrementCounter(
isInternal ? FLOWISE_METRIC_COUNTERS.CHATFLOW_PREDICTION_INTERNAL : FLOWISE_METRIC_COUNTERS.CHATFLOW_PREDICTION_EXTERNAL,
{ status: FLOWISE_COUNTER_STATUS.SUCCESS }
)
@@ -512,7 +512,7 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
return result
} catch (e) {
appServer.metricsProvider.incrementCounter(
appServer.metricsProvider?.incrementCounter(
isInternal ? FLOWISE_METRIC_COUNTERS.CHATFLOW_PREDICTION_INTERNAL : FLOWISE_METRIC_COUNTERS.CHATFLOW_PREDICTION_EXTERNAL,
{ status: FLOWISE_COUNTER_STATUS.FAILURE }
)
@@ -608,7 +608,7 @@ const utilBuildAgentResponse = async (
type: isInternal ? ChatType.INTERNAL : ChatType.EXTERNAL,
flowGraph: getTelemetryFlowObj(nodes, edges)
})
appServer.metricsProvider.incrementCounter(
appServer.metricsProvider?.incrementCounter(
isInternal ? FLOWISE_METRIC_COUNTERS.AGENTFLOW_PREDICTION_INTERNAL : FLOWISE_METRIC_COUNTERS.AGENTFLOW_PREDICTION_EXTERNAL,
{ status: FLOWISE_COUNTER_STATUS.SUCCESS }
)
@@ -658,7 +658,7 @@ const utilBuildAgentResponse = async (
return undefined
} catch (e) {
logger.error('[server]: Error:', e)
appServer.metricsProvider.incrementCounter(
appServer.metricsProvider?.incrementCounter(
isInternal ? FLOWISE_METRIC_COUNTERS.AGENTFLOW_PREDICTION_INTERNAL : FLOWISE_METRIC_COUNTERS.AGENTFLOW_PREDICTION_EXTERNAL,
{ status: FLOWISE_COUNTER_STATUS.FAILURE }
)
+1 -1
View File
@@ -197,7 +197,7 @@ export const upsertVector = async (req: Request, isInternal: boolean = false) =>
flowGraph: getTelemetryFlowObj(nodes, edges),
stopNodeId
})
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 })
return upsertedResult['result'] ?? { result: 'Successfully Upserted' }
} catch (e) {