mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-16 06:38:20 +01:00
Trace query closer to iterator operation
This commit is contained in:
parent
7f2fe7e33e
commit
495daaf00b
@ -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<QueryResults> {
|
||||
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
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { FeedOptions, ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
||||
import { Action, ActionModifiers } from "Shared/Telemetry/TelemetryConstants";
|
||||
import { isVectorSearchEnabled } from "Utils/CapabilityUtils";
|
||||
import { LocalStorageUtility, StorageKey } from "../../Shared/StorageUtility";
|
||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { Queries } from "../Constants";
|
||||
import { client } from "../CosmosClient";
|
||||
|
||||
@ -13,7 +11,6 @@ export const queryDocuments = (
|
||||
options: FeedOptions,
|
||||
): QueryIterator<ItemDefinition & Resource> => {
|
||||
options = getCommonQueryOptions(options);
|
||||
TelemetryProcessor.trace(Action.ExecuteQuery, ActionModifiers.Submit);
|
||||
return client().database(databaseId).container(containerId).items.query(query, options);
|
||||
};
|
||||
|
||||
|
@ -495,7 +495,11 @@ const getNewDocumentButtonState = (editorState: ViewModels.DocumentExplorerState
|
||||
const _loadNextPageInternal = (
|
||||
iterator: QueryIterator<ItemDefinition & Resource>,
|
||||
): Promise<DataModels.DocumentId[]> => {
|
||||
return iterator.fetchNext().then((response) => response.resources);
|
||||
TelemetryProcessor.traceStart(Action.ExecuteQuery);
|
||||
return iterator.fetchNext().then((response) => {
|
||||
TelemetryProcessor.traceSuccess(Action.ExecuteQuery, { dataExplorerArea: Constants.Areas.Tab });
|
||||
return response.resources;
|
||||
});
|
||||
};
|
||||
|
||||
// Export to expose to unit tests
|
||||
|
Loading…
x
Reference in New Issue
Block a user