diff --git a/src/Common/IteratorUtilities.ts b/src/Common/IteratorUtilities.ts index 6283488b8..0cbe8ea63 100644 --- a/src/Common/IteratorUtilities.ts +++ b/src/Common/IteratorUtilities.ts @@ -1,5 +1,8 @@ import { QueryOperationOptions } from "@azure/cosmos"; +import { Action } from "Shared/Telemetry/TelemetryConstants"; +import * as Constants from "../Common/Constants"; import { QueryResults } from "../Contracts/ViewModels"; +import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor"; interface QueryResponse { // [Todo] remove any @@ -21,7 +24,9 @@ export function nextPage( firstItemIndex: number, queryOperationOptions?: QueryOperationOptions, ): Promise { + TelemetryProcessor.traceStart(Action.ExecuteQuery); return documentsIterator.fetchNext(queryOperationOptions).then((response) => { + TelemetryProcessor.traceSuccess(Action.ExecuteQuery, { dataExplorerArea: Constants.Areas.Tab }); const documents = response.resources; // eslint-disable-next-line @typescript-eslint/no-explicit-any const headers = (response as any).headers || {}; // TODO this is a private key. Remove any diff --git a/src/Explorer/Tree/Collection.ts b/src/Explorer/Tree/Collection.ts index bc3af39f1..096b9e087 100644 --- a/src/Explorer/Tree/Collection.ts +++ b/src/Explorer/Tree/Collection.ts @@ -1044,9 +1044,22 @@ export default class Collection implements ViewModels.Collection { } public async uploadFiles(files: FileList): Promise<{ data: UploadDetailsRecord[] }> { - const data = await Promise.all(Array.from(files).map((file) => this.uploadFile(file))); - - return { data }; + try { + TelemetryProcessor.trace(Action.UploadDocuments, ActionModifiers.Start, { + nbFiles: files.length, + }); + const data = await Promise.all(Array.from(files).map((file) => this.uploadFile(file))); + TelemetryProcessor.trace(Action.UploadDocuments, ActionModifiers.Success, { + nbFiles: files.length, + }); + return { data }; + } catch (error) { + TelemetryProcessor.trace(Action.UploadDocuments, ActionModifiers.Failed, { + error: getErrorMessage(error), + errorStack: getErrorStack(error), + }); + throw error; + } } private uploadFile(file: File): Promise { diff --git a/src/Shared/Telemetry/TelemetryConstants.ts b/src/Shared/Telemetry/TelemetryConstants.ts index e0f1691be..d61a2cf8f 100644 --- a/src/Shared/Telemetry/TelemetryConstants.ts +++ b/src/Shared/Telemetry/TelemetryConstants.ts @@ -1,17 +1,18 @@ // Data Explorer specific actions. No need to keep this in sync with the one in Portal. +// Some of the enums names are used in Fabric. Please do not rename them. export enum Action { CollapseTreeNode, - CreateCollection, + CreateCollection, // Used in Fabric. Please do not rename. CreateGlobalSecondaryIndex, - CreateDocument, + CreateDocument, // Used in Fabric. Please do not rename. CreateStoredProcedure, CreateTrigger, CreateUDF, - DeleteCollection, + DeleteCollection, // Used in Fabric. Please do not rename. DeleteDatabase, DeleteDocument, ExpandTreeNode, - ExecuteQuery, + ExecuteQuery, // Used in Fabric. Please do not rename. HasFeature, GetVNETServices, InitializeAccountLocationFromResourceGroup, @@ -144,6 +145,7 @@ export enum Action { ReadPersistedTabState, SavePersistedTabState, DeletePersistedTabState, + UploadDocuments, // Used in Fabric. Please do not rename. } export const ActionModifiers = {