add telemetry for productId
This commit is contained in:
parent
099cf481b4
commit
30b457d129
|
|
@ -395,6 +395,7 @@ export interface IExecuteFlowParams extends IPredictionQueueAppServer {
|
||||||
orgId: string
|
orgId: string
|
||||||
workspaceId: string
|
workspaceId: string
|
||||||
subscriptionId: string
|
subscriptionId: string
|
||||||
|
productId: string
|
||||||
baseURL: string
|
baseURL: string
|
||||||
isInternal: boolean
|
isInternal: boolean
|
||||||
isEvaluation?: boolean
|
isEvaluation?: boolean
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,18 @@ export class UserService {
|
||||||
data.updatedBy = data.id
|
data.updatedBy = data.id
|
||||||
}
|
}
|
||||||
|
|
||||||
return queryRunner.manager.create(User, data)
|
const userObj = queryRunner.manager.create(User, data)
|
||||||
|
|
||||||
|
this.telemetry.sendTelemetry(
|
||||||
|
TelemetryEventType.USER_CREATED,
|
||||||
|
{
|
||||||
|
userId: userObj.id,
|
||||||
|
createdBy: userObj.createdBy
|
||||||
|
},
|
||||||
|
userObj.id
|
||||||
|
)
|
||||||
|
|
||||||
|
return userObj
|
||||||
}
|
}
|
||||||
|
|
||||||
public async saveUser(data: Partial<User>, queryRunner: QueryRunner) {
|
public async saveUser(data: Partial<User>, queryRunner: QueryRunner) {
|
||||||
|
|
@ -120,15 +131,6 @@ export class UserService {
|
||||||
await queryRunner.release()
|
await queryRunner.release()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.telemetry.sendTelemetry(
|
|
||||||
TelemetryEventType.USER_CREATED,
|
|
||||||
{
|
|
||||||
userId: newUser.id,
|
|
||||||
createdBy: newUser.createdBy
|
|
||||||
},
|
|
||||||
newUser.id
|
|
||||||
)
|
|
||||||
|
|
||||||
return newUser
|
return newUser
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -292,12 +292,18 @@ const saveChatflow = async (
|
||||||
const chatflow = appServer.AppDataSource.getRepository(ChatFlow).create(newChatFlow)
|
const chatflow = appServer.AppDataSource.getRepository(ChatFlow).create(newChatFlow)
|
||||||
dbResponse = await appServer.AppDataSource.getRepository(ChatFlow).save(chatflow)
|
dbResponse = await appServer.AppDataSource.getRepository(ChatFlow).save(chatflow)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const subscriptionDetails = await usageCacheManager.getSubscriptionDataFromCache(subscriptionId)
|
||||||
|
const productId = subscriptionDetails?.productId || ''
|
||||||
|
|
||||||
await appServer.telemetry.sendTelemetry(
|
await appServer.telemetry.sendTelemetry(
|
||||||
'chatflow_created',
|
'chatflow_created',
|
||||||
{
|
{
|
||||||
version: await getAppVersion(),
|
version: await getAppVersion(),
|
||||||
chatflowId: dbResponse.id,
|
chatflowId: dbResponse.id,
|
||||||
flowGraph: getTelemetryFlowObj(JSON.parse(dbResponse.flowData)?.nodes, JSON.parse(dbResponse.flowData)?.edges)
|
flowGraph: getTelemetryFlowObj(JSON.parse(dbResponse.flowData)?.nodes, JSON.parse(dbResponse.flowData)?.edges),
|
||||||
|
productId,
|
||||||
|
subscriptionId
|
||||||
},
|
},
|
||||||
orgId
|
orgId
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,7 @@ interface IExecuteNodeParams {
|
||||||
orgId: string
|
orgId: string
|
||||||
workspaceId: string
|
workspaceId: string
|
||||||
subscriptionId: string
|
subscriptionId: string
|
||||||
|
productId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IExecuteAgentFlowParams extends Omit<IExecuteFlowParams, 'incomingInput'> {
|
interface IExecuteAgentFlowParams extends Omit<IExecuteFlowParams, 'incomingInput'> {
|
||||||
|
|
@ -838,7 +839,8 @@ const executeNode = async ({
|
||||||
iterationContext,
|
iterationContext,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
productId
|
||||||
}: IExecuteNodeParams): Promise<{
|
}: IExecuteNodeParams): Promise<{
|
||||||
result: any
|
result: any
|
||||||
shouldStop?: boolean
|
shouldStop?: boolean
|
||||||
|
|
@ -1060,7 +1062,8 @@ const executeNode = async ({
|
||||||
},
|
},
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
productId
|
||||||
})
|
})
|
||||||
|
|
||||||
// Store the result
|
// Store the result
|
||||||
|
|
@ -1287,7 +1290,8 @@ export const executeAgentFlow = async ({
|
||||||
isTool = false,
|
isTool = false,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
productId
|
||||||
}: IExecuteAgentFlowParams) => {
|
}: IExecuteAgentFlowParams) => {
|
||||||
logger.debug('\n🚀 Starting flow execution')
|
logger.debug('\n🚀 Starting flow execution')
|
||||||
|
|
||||||
|
|
@ -1754,7 +1758,8 @@ export const executeAgentFlow = async ({
|
||||||
iterationContext,
|
iterationContext,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
productId
|
||||||
})
|
})
|
||||||
|
|
||||||
if (executionResult.agentFlowExecutedData) {
|
if (executionResult.agentFlowExecutedData) {
|
||||||
|
|
@ -2020,7 +2025,9 @@ export const executeAgentFlow = async ({
|
||||||
chatflowId: chatflowid,
|
chatflowId: chatflowid,
|
||||||
chatId,
|
chatId,
|
||||||
type: evaluationRunId ? ChatType.EVALUATION : isInternal ? ChatType.INTERNAL : ChatType.EXTERNAL,
|
type: evaluationRunId ? ChatType.EVALUATION : isInternal ? ChatType.INTERNAL : ChatType.EXTERNAL,
|
||||||
flowGraph: getTelemetryFlowObj(nodes, edges)
|
flowGraph: getTelemetryFlowObj(nodes, edges),
|
||||||
|
productId,
|
||||||
|
subscriptionId
|
||||||
},
|
},
|
||||||
orgId
|
orgId
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,8 @@ export const executeFlow = async ({
|
||||||
isTool,
|
isTool,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
productId
|
||||||
}: IExecuteFlowParams) => {
|
}: IExecuteFlowParams) => {
|
||||||
// Ensure incomingInput has all required properties with default values
|
// Ensure incomingInput has all required properties with default values
|
||||||
incomingInput = {
|
incomingInput = {
|
||||||
|
|
@ -421,7 +422,8 @@ export const executeFlow = async ({
|
||||||
isTool,
|
isTool,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
productId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -812,7 +814,9 @@ export const executeFlow = async ({
|
||||||
chatflowId: chatflowid,
|
chatflowId: chatflowid,
|
||||||
chatId,
|
chatId,
|
||||||
type: isEvaluation ? ChatType.EVALUATION : isInternal ? ChatType.INTERNAL : ChatType.EXTERNAL,
|
type: isEvaluation ? ChatType.EVALUATION : isInternal ? ChatType.INTERNAL : ChatType.EXTERNAL,
|
||||||
flowGraph: getTelemetryFlowObj(nodes, edges)
|
flowGraph: getTelemetryFlowObj(nodes, edges),
|
||||||
|
productId,
|
||||||
|
subscriptionId
|
||||||
},
|
},
|
||||||
orgId
|
orgId
|
||||||
)
|
)
|
||||||
|
|
@ -954,6 +958,9 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||||
organizationId = orgId
|
organizationId = orgId
|
||||||
const subscriptionId = org.subscriptionId as string
|
const subscriptionId = org.subscriptionId as string
|
||||||
|
|
||||||
|
const subscriptionDetails = await appServer.usageCacheManager.getSubscriptionDataFromCache(subscriptionId)
|
||||||
|
const productId = subscriptionDetails?.productId || ''
|
||||||
|
|
||||||
await checkPredictions(orgId, subscriptionId, appServer.usageCacheManager)
|
await checkPredictions(orgId, subscriptionId, appServer.usageCacheManager)
|
||||||
|
|
||||||
const executeData: IExecuteFlowParams = {
|
const executeData: IExecuteFlowParams = {
|
||||||
|
|
@ -974,7 +981,8 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
|
||||||
usageCacheManager: appServer.usageCacheManager,
|
usageCacheManager: appServer.usageCacheManager,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
productId
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.MODE === MODE.QUEUE) {
|
if (process.env.MODE === MODE.QUEUE) {
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,9 @@ export const upsertVector = async (req: Request, isInternal: boolean = false) =>
|
||||||
const orgId = org.id
|
const orgId = org.id
|
||||||
const subscriptionId = org.subscriptionId as string
|
const subscriptionId = org.subscriptionId as string
|
||||||
|
|
||||||
|
const subscriptionDetails = await appServer.usageCacheManager.getSubscriptionDataFromCache(subscriptionId)
|
||||||
|
const productId = subscriptionDetails?.productId || ''
|
||||||
|
|
||||||
const executeData: IExecuteFlowParams = {
|
const executeData: IExecuteFlowParams = {
|
||||||
componentNodes: appServer.nodesPool.componentNodes,
|
componentNodes: appServer.nodesPool.componentNodes,
|
||||||
incomingInput,
|
incomingInput,
|
||||||
|
|
@ -293,7 +296,8 @@ export const upsertVector = async (req: Request, isInternal: boolean = false) =>
|
||||||
isUpsert: true,
|
isUpsert: true,
|
||||||
orgId,
|
orgId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
subscriptionId
|
subscriptionId,
|
||||||
|
productId
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.MODE === MODE.QUEUE) {
|
if (process.env.MODE === MODE.QUEUE) {
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,6 @@ const ViewMessagesDialog = ({ show, dialogProps, onCancel }) => {
|
||||||
const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args))
|
const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args))
|
||||||
|
|
||||||
const [chatlogs, setChatLogs] = useState([])
|
const [chatlogs, setChatLogs] = useState([])
|
||||||
const [allChatlogs, setAllChatLogs] = useState([])
|
|
||||||
const [chatMessages, setChatMessages] = useState([])
|
const [chatMessages, setChatMessages] = useState([])
|
||||||
const [stats, setStats] = useState({})
|
const [stats, setStats] = useState({})
|
||||||
const [selectedMessageIndex, setSelectedMessageIndex] = useState(0)
|
const [selectedMessageIndex, setSelectedMessageIndex] = useState(0)
|
||||||
|
|
@ -758,7 +757,6 @@ const ViewMessagesDialog = ({ show, dialogProps, onCancel }) => {
|
||||||
if (getChatmessageApi.data) {
|
if (getChatmessageApi.data) {
|
||||||
getStoragePathFromServer.request()
|
getStoragePathFromServer.request()
|
||||||
|
|
||||||
setAllChatLogs(getChatmessageApi.data)
|
|
||||||
const chatPK = processChatLogs(getChatmessageApi.data)
|
const chatPK = processChatLogs(getChatmessageApi.data)
|
||||||
setSelectedMessageIndex(0)
|
setSelectedMessageIndex(0)
|
||||||
if (chatPK) {
|
if (chatPK) {
|
||||||
|
|
@ -794,7 +792,6 @@ const ViewMessagesDialog = ({ show, dialogProps, onCancel }) => {
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
setChatLogs([])
|
setChatLogs([])
|
||||||
setAllChatLogs([])
|
|
||||||
setChatMessages([])
|
setChatMessages([])
|
||||||
setChatTypeFilter(['INTERNAL', 'EXTERNAL'])
|
setChatTypeFilter(['INTERNAL', 'EXTERNAL'])
|
||||||
setFeedbackTypeFilter([])
|
setFeedbackTypeFilter([])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue