Added health metrics for application load and database load (#2257)

* Added health metrics for application load

* Added health metrics for application load

* Fix unit tests

* Added more metrics

* Added few comments

* Added DatabaseLoad Scenario and address comments

* Fix unit tests

* fix unit tests

* Fix unit tests

* fix unit tests

* fix the mock

* Fix unit tests
This commit is contained in:
sunghyunkang1111
2025-12-09 14:14:35 -06:00
committed by GitHub
parent 8c0e6da377
commit 5b7d1a74af
19 changed files with 701 additions and 2 deletions
+36
View File
@@ -50,3 +50,39 @@ require("jquery-ui-dist/jquery-ui");
// The test environment Data Explorer uses does not have crypto.subtle implementation
(<any>global).crypto.subtle = {};
// Mock Performance API for scenario monitoring
const performanceMock = {
...(typeof performance !== "undefined" ? performance : {}),
mark: jest.fn(),
measure: jest.fn(),
clearMarks: jest.fn(),
clearMeasures: jest.fn(),
getEntriesByName: jest.fn().mockReturnValue([]),
getEntriesByType: jest.fn().mockReturnValue([]),
now: jest.fn(() => Date.now()),
timeOrigin: Date.now(),
};
// Assign to both global and window
Object.defineProperty(global, "performance", {
writable: true,
configurable: true,
value: performanceMock,
});
Object.defineProperty(window, "performance", {
writable: true,
configurable: true,
value: performanceMock,
});
// Mock fetch API - minimal mock to prevent errors
(<any>global).fetch = jest.fn(() =>
Promise.resolve({
ok: true,
status: 200,
json: () => Promise.resolve({}),
text: () => Promise.resolve(""),
}),
);