mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-21 09:09:23 +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 { 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
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { FeedOptions, ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
import { FeedOptions, ItemDefinition, QueryIterator, Resource } from "@azure/cosmos";
|
||||||
import { Action, ActionModifiers } from "Shared/Telemetry/TelemetryConstants";
|
|
||||||
import { isVectorSearchEnabled } from "Utils/CapabilityUtils";
|
import { isVectorSearchEnabled } from "Utils/CapabilityUtils";
|
||||||
import { LocalStorageUtility, StorageKey } from "../../Shared/StorageUtility";
|
import { LocalStorageUtility, StorageKey } from "../../Shared/StorageUtility";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { Queries } from "../Constants";
|
import { Queries } from "../Constants";
|
||||||
import { client } from "../CosmosClient";
|
import { client } from "../CosmosClient";
|
||||||
|
|
||||||
@ -13,7 +11,6 @@ export const queryDocuments = (
|
|||||||
options: FeedOptions,
|
options: FeedOptions,
|
||||||
): QueryIterator<ItemDefinition & Resource> => {
|
): QueryIterator<ItemDefinition & Resource> => {
|
||||||
options = getCommonQueryOptions(options);
|
options = getCommonQueryOptions(options);
|
||||||
TelemetryProcessor.trace(Action.ExecuteQuery, ActionModifiers.Submit);
|
|
||||||
return client().database(databaseId).container(containerId).items.query(query, options);
|
return client().database(databaseId).container(containerId).items.query(query, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -495,7 +495,11 @@ const getNewDocumentButtonState = (editorState: ViewModels.DocumentExplorerState
|
|||||||
const _loadNextPageInternal = (
|
const _loadNextPageInternal = (
|
||||||
iterator: QueryIterator<ItemDefinition & Resource>,
|
iterator: QueryIterator<ItemDefinition & Resource>,
|
||||||
): Promise<DataModels.DocumentId[]> => {
|
): 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
|
// Export to expose to unit tests
|
||||||
|
Loading…
x
Reference in New Issue
Block a user