mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-05-19 14:54:40 +01:00
Add tracing events for tracking query execution and upload documents (#2100)
* Add tracing for Execute (submit) query and Upload documents * Trace query closer to iterator operation * Add warnings to values used in Fabric * Fix format * Don't trace execute queries for filtering calls * Remove tracing call for documents tab filtering * Fix failing unit test. --------- Co-authored-by: Jade Welton <jawelton@microsoft.com> Co-authored-by: Sevo Kukol <sevoku@microsoft.com>
This commit is contained in:
parent
d5fe2d9e9f
commit
27c9ea7ab6
@ -1,5 +1,8 @@
|
|||||||
import { QueryOperationOptions } from "@azure/cosmos";
|
import { QueryOperationOptions } from "@azure/cosmos";
|
||||||
|
import { Action } from "Shared/Telemetry/TelemetryConstants";
|
||||||
|
import * as Constants from "../Common/Constants";
|
||||||
import { QueryResults } from "../Contracts/ViewModels";
|
import { QueryResults } from "../Contracts/ViewModels";
|
||||||
|
import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
|
||||||
interface QueryResponse {
|
interface QueryResponse {
|
||||||
// [Todo] remove any
|
// [Todo] remove any
|
||||||
@ -21,7 +24,9 @@ export function nextPage(
|
|||||||
firstItemIndex: number,
|
firstItemIndex: number,
|
||||||
queryOperationOptions?: QueryOperationOptions,
|
queryOperationOptions?: QueryOperationOptions,
|
||||||
): Promise<QueryResults> {
|
): Promise<QueryResults> {
|
||||||
|
TelemetryProcessor.traceStart(Action.ExecuteQuery);
|
||||||
return documentsIterator.fetchNext(queryOperationOptions).then((response) => {
|
return documentsIterator.fetchNext(queryOperationOptions).then((response) => {
|
||||||
|
TelemetryProcessor.traceSuccess(Action.ExecuteQuery, { dataExplorerArea: Constants.Areas.Tab });
|
||||||
const documents = response.resources;
|
const documents = response.resources;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const headers = (response as any).headers || {}; // TODO this is a private key. Remove any
|
const headers = (response as any).headers || {}; // TODO this is a private key. Remove any
|
||||||
|
@ -1044,9 +1044,22 @@ export default class Collection implements ViewModels.Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async uploadFiles(files: FileList): Promise<{ data: UploadDetailsRecord[] }> {
|
public async uploadFiles(files: FileList): Promise<{ data: UploadDetailsRecord[] }> {
|
||||||
const data = await Promise.all(Array.from(files).map((file) => this.uploadFile(file)));
|
try {
|
||||||
|
TelemetryProcessor.trace(Action.UploadDocuments, ActionModifiers.Start, {
|
||||||
return { data };
|
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<UploadDetailsRecord> {
|
private uploadFile(file: File): Promise<UploadDetailsRecord> {
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
// Data Explorer specific actions. No need to keep this in sync with the one in Portal.
|
// 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 {
|
export enum Action {
|
||||||
CollapseTreeNode,
|
CollapseTreeNode,
|
||||||
CreateCollection,
|
CreateCollection, // Used in Fabric. Please do not rename.
|
||||||
CreateGlobalSecondaryIndex,
|
CreateGlobalSecondaryIndex,
|
||||||
CreateDocument,
|
CreateDocument, // Used in Fabric. Please do not rename.
|
||||||
CreateStoredProcedure,
|
CreateStoredProcedure,
|
||||||
CreateTrigger,
|
CreateTrigger,
|
||||||
CreateUDF,
|
CreateUDF,
|
||||||
DeleteCollection,
|
DeleteCollection, // Used in Fabric. Please do not rename.
|
||||||
DeleteDatabase,
|
DeleteDatabase,
|
||||||
DeleteDocument,
|
DeleteDocument,
|
||||||
ExpandTreeNode,
|
ExpandTreeNode,
|
||||||
ExecuteQuery,
|
ExecuteQuery, // Used in Fabric. Please do not rename.
|
||||||
HasFeature,
|
HasFeature,
|
||||||
GetVNETServices,
|
GetVNETServices,
|
||||||
InitializeAccountLocationFromResourceGroup,
|
InitializeAccountLocationFromResourceGroup,
|
||||||
@ -144,6 +145,7 @@ export enum Action {
|
|||||||
ReadPersistedTabState,
|
ReadPersistedTabState,
|
||||||
SavePersistedTabState,
|
SavePersistedTabState,
|
||||||
DeletePersistedTabState,
|
DeletePersistedTabState,
|
||||||
|
UploadDocuments, // Used in Fabric. Please do not rename.
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ActionModifiers = {
|
export const ActionModifiers = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user