зеркало из
1
0
Форкнуть 0
This commit is contained in:
manasi 2022-07-28 16:19:02 -07:00
Родитель 38e5a460e4
Коммит e1b5ad1c54
1 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -175,6 +175,7 @@ export const fetchDevice = async (parameters: FetchDeviceParameters): Promise<De
return result && result.body;
};
// tslint:disable-next-line:cyclomatic-complexity
export const fetchDevices = async (parameters: FetchDevicesParameters): Promise<DataPlaneResponse<Device[]>> => {
const connectionInformation = await dataPlaneConnectionHelper();
const queryString = buildQueryString(parameters.query);
@ -197,13 +198,15 @@ export const fetchDevices = async (parameters: FetchDevicesParameters): Promise<
(dataPlaneRequest.headers as any)[HEADERS.CONTINUATION_TOKEN] = parameters.query.continuationTokens[parameters.query.currentPageIndex]; // tslint:disable-line: no-any
}
const insights = AppInsightsClient.getInstance();
insights?.startTrackEvent(TELEMETRY_EVENTS.FETCH_DEVICES);
const response = await request(DATAPLANE_CONTROLLER_ENDPOINT, dataPlaneRequest);
insights?.stopTrackEvent(TELEMETRY_EVENTS.FETCH_DEVICES, {url: response.url, status: response.status.toString(), statusText: response.statusText});
insights?.flush();
const result = await dataPlaneResponseHelper(response);
return result;
try {
const response = await request(DATAPLANE_CONTROLLER_ENDPOINT, dataPlaneRequest);
AppInsightsClient.getInstance()?.trackEvent({name: TELEMETRY_EVENTS.FETCH_DEVICES}, {status: response.status.toString(), statusText: response.statusText});
const result = await dataPlaneResponseHelper(response);
return result;
} catch (e) {
AppInsightsClient.getInstance()?.trackEvent({name: TELEMETRY_EVENTS.FETCH_DEVICES}, {status: 'N/A', statusText: e.toString()});
throw (e);
}
};
export const deleteDevices = async (parameters: DeleteDevicesParameters) => {