feat: Add new tracking events for flow and data load executions (#6492)
* add new events * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
79f91e3ac1
commit
0fbe1b0d09
2 changed files with 53 additions and 2 deletions
|
|
@ -5,3 +5,20 @@ export const track = async (
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const trackFlowBuild = async (
|
||||||
|
flowName: string,
|
||||||
|
isError?: boolean,
|
||||||
|
properties?: Record<string, any>,
|
||||||
|
): Promise<void> => {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const trackDataLoaded = async (
|
||||||
|
flowId?: string,
|
||||||
|
flowName?: string,
|
||||||
|
component?: string,
|
||||||
|
componentId?: string,
|
||||||
|
): Promise<void> => {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,12 @@ import {
|
||||||
BROKEN_EDGES_WARNING,
|
BROKEN_EDGES_WARNING,
|
||||||
componentsToIgnoreUpdate,
|
componentsToIgnoreUpdate,
|
||||||
} from "@/constants/constants";
|
} from "@/constants/constants";
|
||||||
import { track } from "@/customization/utils/analytics";
|
import { ENABLE_DATASTAX_LANGFLOW } from "@/customization/feature-flags";
|
||||||
|
import {
|
||||||
|
track,
|
||||||
|
trackDataLoaded,
|
||||||
|
trackFlowBuild,
|
||||||
|
} from "@/customization/utils/analytics";
|
||||||
import { brokenEdgeMessage } from "@/utils/utils";
|
import { brokenEdgeMessage } from "@/utils/utils";
|
||||||
import {
|
import {
|
||||||
EdgeChange,
|
EdgeChange,
|
||||||
|
|
@ -19,7 +24,7 @@ import {
|
||||||
MISSED_ERROR_ALERT,
|
MISSED_ERROR_ALERT,
|
||||||
} from "../constants/alerts_constants";
|
} from "../constants/alerts_constants";
|
||||||
import { BuildStatus } from "../constants/enums";
|
import { BuildStatus } from "../constants/enums";
|
||||||
import { VertexBuildTypeAPI } from "../types/api";
|
import { LogsLogType, VertexBuildTypeAPI } from "../types/api";
|
||||||
import { ChatInputType, ChatOutputType } from "../types/chat";
|
import { ChatInputType, ChatOutputType } from "../types/chat";
|
||||||
import {
|
import {
|
||||||
AllNodeType,
|
AllNodeType,
|
||||||
|
|
@ -699,6 +704,28 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
...get().verticesBuild!.verticesIds,
|
...get().verticesBuild!.verticesIds,
|
||||||
...next_vertices_ids,
|
...next_vertices_ids,
|
||||||
];
|
];
|
||||||
|
if (
|
||||||
|
ENABLE_DATASTAX_LANGFLOW &&
|
||||||
|
vertexBuildData?.id?.includes("AstraDB")
|
||||||
|
) {
|
||||||
|
const search_results: LogsLogType[] = Object.values(
|
||||||
|
vertexBuildData?.data?.logs?.search_results,
|
||||||
|
);
|
||||||
|
search_results.forEach((log) => {
|
||||||
|
if (
|
||||||
|
log.message.includes("Adding") &&
|
||||||
|
log.message.includes("documents") &&
|
||||||
|
log.message.includes("Vector Store")
|
||||||
|
) {
|
||||||
|
trackDataLoaded(
|
||||||
|
get().currentFlow?.id,
|
||||||
|
get().currentFlow?.name,
|
||||||
|
"AstraDB Vector Store",
|
||||||
|
vertexBuildData?.id,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
get().updateVerticesBuild({
|
get().updateVerticesBuild({
|
||||||
verticesIds: newIds,
|
verticesIds: newIds,
|
||||||
verticesLayers: newLayers,
|
verticesLayers: newLayers,
|
||||||
|
|
@ -747,6 +774,9 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
get().setIsBuilding(false);
|
get().setIsBuilding(false);
|
||||||
|
trackFlowBuild(get().currentFlow?.name ?? "Unknown", false, {
|
||||||
|
flowId: get().currentFlow?.id,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onBuildUpdate: handleBuildUpdate,
|
onBuildUpdate: handleBuildUpdate,
|
||||||
onBuildError: (title: string, list: string[], elementList) => {
|
onBuildError: (title: string, list: string[], elementList) => {
|
||||||
|
|
@ -767,6 +797,10 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
setErrorData({ list, title });
|
setErrorData({ list, title });
|
||||||
get().setIsBuilding(false);
|
get().setIsBuilding(false);
|
||||||
get().buildController.abort();
|
get().buildController.abort();
|
||||||
|
trackFlowBuild(get().currentFlow?.name ?? "Unknown", true, {
|
||||||
|
flowId: get().currentFlow?.id,
|
||||||
|
error: list,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onBuildStart: (elementList) => {
|
onBuildStart: (elementList) => {
|
||||||
const idList = elementList
|
const idList = elementList
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue