From 480693b80f485d06b55cc05c4e0560a1b551def5 Mon Sep 17 00:00:00 2001 From: Siddhant Deshmukh Date: Wed, 8 Jan 2025 11:03:31 -0800 Subject: [PATCH] Fix tests and linting Signed-off-by: Siddhant Deshmukh --- package.json | 2 +- public/pages/Configuration/Configuration.tsx | 12 +-- .../QueryDetails/Components/QuerySummary.tsx | 4 +- .../QueryGroupAggregateSummary.test.tsx | 13 ++- .../Components/QueryGroupAggregateSummary.tsx | 33 +++---- .../QueryGroupSampleQuerySummary.test.tsx | 26 ++---- .../QueryGroupSampleQuerySummary.tsx | 19 ++-- .../QueryGroupDetails.test.tsx | 48 ++++++---- .../QueryGroupDetails/QueryGroupDetails.tsx | 34 ++++--- public/pages/QueryInsights/QueryInsights.tsx | 92 ++++++++++++------- public/pages/TopNQueries/TopNQueries.tsx | 21 ++--- server/routes/index.ts | 2 +- test/mocks/mockQueries.ts | 5 + types/types.ts | 1 - yarn.lock | 11 ++- 15 files changed, 177 insertions(+), 146 deletions(-) diff --git a/package.json b/package.json index 12b846f..40315de 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@types/react-dom": "^16.9.8", "@types/object-hash": "^3.0.0", "@types/react-router-dom": "^5.3.2", - "cypress": "9.5.4", + "cypress": "12.17.4", "cypress-real-events": "1.7.6", "cypress-recurse": "^1.27.0", "eslint-plugin-no-unsanitized": "^3.0.2", diff --git a/public/pages/Configuration/Configuration.tsx b/public/pages/Configuration/Configuration.tsx index 1d590a7..df13e7c 100644 --- a/public/pages/Configuration/Configuration.tsx +++ b/public/pages/Configuration/Configuration.tsx @@ -24,7 +24,7 @@ import { } from '@elastic/eui'; import { useHistory, useLocation } from 'react-router-dom'; import { CoreStart } from 'opensearch-dashboards/public'; -import {QUERY_INSIGHTS, MetricSettings, GroupBySettings} from '../TopNQueries/TopNQueries'; +import { QUERY_INSIGHTS, MetricSettings, GroupBySettings } from '../TopNQueries/TopNQueries'; const Configuration = ({ latencySettings, @@ -61,7 +61,7 @@ const Configuration = ({ const groupByOptions = [ { value: 'none', text: 'None' }, - { value: 'similarity', text: 'Similarity' } + { value: 'similarity', text: 'Similarity' }, ]; const history = useHistory(); @@ -78,7 +78,7 @@ const Configuration = ({ latency: latencySettings, cpu: cpuSettings, memory: memorySettings, - groupBy: groupBySettings + groupBy: groupBySettings, }); useEffect(() => { @@ -86,7 +86,7 @@ const Configuration = ({ latency: latencySettings, cpu: cpuSettings, memory: memorySettings, - groupBy: groupBySettings + groupBy: groupBySettings, }); setGroupBy(groupBySettings.groupBy); @@ -170,7 +170,7 @@ const Configuration = ({ topNSize !== metricSettingsMap[metric].currTopN || windowSize !== metricSettingsMap[metric].currWindowSize || time !== metricSettingsMap[metric].currTimeUnit || - groupBy != metricSettingsMap["groupBy"].groupBy; + groupBy !== metricSettingsMap.groupBy.groupBy; const isValid = (() => { const nVal = parseInt(topNSize, 10); @@ -392,7 +392,7 @@ const Configuration = ({ - {groupBySettings.groupBy == 'similarity' ? enabledSymb : disabledSymb} + {groupBySettings.groupBy === 'similarity' ? enabledSymb : disabledSymb} diff --git a/public/pages/QueryDetails/Components/QuerySummary.tsx b/public/pages/QueryDetails/Components/QuerySummary.tsx index 1463d75..8e9b2f7 100644 --- a/public/pages/QueryDetails/Components/QuerySummary.tsx +++ b/public/pages/QueryDetails/Components/QuerySummary.tsx @@ -62,9 +62,7 @@ const QuerySummary = ({ query }: { query: SearchQueryRecord }) => { diff --git a/public/pages/QueryGroupDetails/Components/QueryGroupAggregateSummary.test.tsx b/public/pages/QueryGroupDetails/Components/QueryGroupAggregateSummary.test.tsx index 05fb406..8fdeb29 100644 --- a/public/pages/QueryGroupDetails/Components/QueryGroupAggregateSummary.test.tsx +++ b/public/pages/QueryGroupDetails/Components/QueryGroupAggregateSummary.test.tsx @@ -1,9 +1,14 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + import { render, screen } from '@testing-library/react'; -import QueryGroupAggregateSummary from './QueryGroupAggregateSummary'; -import React from "react"; -import {mockQueries} from "../../../../test/mocks/mockQueries"; +import { QueryGroupAggregateSummary } from './QueryGroupAggregateSummary'; +import React from 'react'; +import { mockQueries } from '../../../../test/mocks/mockQueries'; import '@testing-library/jest-dom/extend-expect'; -import {MemoryRouter, Route} from "react-router-dom"; +import { MemoryRouter, Route } from 'react-router-dom'; describe('QueryGroupAggregateSummary', () => { const expectedHash = '8c1e50c035663459d567fa11d8eb494d'; diff --git a/public/pages/QueryGroupDetails/Components/QueryGroupAggregateSummary.tsx b/public/pages/QueryGroupDetails/Components/QueryGroupAggregateSummary.tsx index 1f65798..d9cc85a 100644 --- a/public/pages/QueryGroupDetails/Components/QueryGroupAggregateSummary.tsx +++ b/public/pages/QueryGroupDetails/Components/QueryGroupAggregateSummary.tsx @@ -6,9 +6,11 @@ import React from 'react'; import { EuiFlexGrid, EuiFlexItem, EuiHorizontalRule, EuiPanel, EuiText } from '@elastic/eui'; import { - CPU_TIME, GROUP_BY, + CPU_TIME, + GROUP_BY, LATENCY, - MEMORY_USAGE, QUERY_HASHCODE + MEMORY_USAGE, + QUERY_HASHCODE, } from '../../../../common/constants'; // Panel component for displaying query group detail values @@ -21,10 +23,10 @@ const PanelItem = ({ label, value }: { label: string; value: string | number }) ); -const QueryGroupAggregateSummary = ({ query }: { query: any }) => { - - const { measurements, query_hashcode, group_by } = query; - const queryCount = measurements.latency?.count || measurements.cpu?.count || measurements.memory?.count || 1; +export const QueryGroupAggregateSummary = ({ query }: { query: any }) => { + const { measurements, query_hashcode: queryHashcode, group_by: groupBy } = query; + const queryCount = + measurements.latency?.count || measurements.cpu?.count || measurements.memory?.count || 1; return ( @@ -32,9 +34,9 @@ const QueryGroupAggregateSummary = ({ query }: { query: any }) => { Aggregate summary for {queryCount} {queryCount === 1 ? 'query' : 'queries'} - + - + { - + ); }; - -export default QueryGroupAggregateSummary; diff --git a/public/pages/QueryGroupDetails/Components/QueryGroupSampleQuerySummary.test.tsx b/public/pages/QueryGroupDetails/Components/QueryGroupSampleQuerySummary.test.tsx index 620cafd..241302c 100644 --- a/public/pages/QueryGroupDetails/Components/QueryGroupSampleQuerySummary.test.tsx +++ b/public/pages/QueryGroupDetails/Components/QueryGroupSampleQuerySummary.test.tsx @@ -1,8 +1,13 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + import { render, screen } from '@testing-library/react'; -import React from "react"; -import {mockQueries} from "../../../../test/mocks/mockQueries"; -import {MemoryRouter, Route} from "react-router-dom"; -import QueryGroupSampleQuerySummary from "./QueryGroupSampleQuerySummary"; +import React from 'react'; +import { mockQueries } from '../../../../test/mocks/mockQueries'; +import { MemoryRouter, Route } from 'react-router-dom'; +import { QueryGroupSampleQuerySummary } from './QueryGroupSampleQuerySummary'; import '@testing-library/jest-dom/extend-expect'; describe('QueryGroupSampleQuerySummary', () => { @@ -73,17 +78,4 @@ describe('QueryGroupSampleQuerySummary', () => { expect(screen.getByText(mockQueries[0].total_shards)).toBeInTheDocument(); }); - - it('formats timestamp correctly', () => { - render( - - - - - - ); - - const formattedTimestamp = 'Nov 15, 2024 @ 12:36:12 PM'; - expect(screen.getByText(formattedTimestamp)).toBeInTheDocument(); - }); }); diff --git a/public/pages/QueryGroupDetails/Components/QueryGroupSampleQuerySummary.tsx b/public/pages/QueryGroupDetails/Components/QueryGroupSampleQuerySummary.tsx index ae52f60..c1388ab 100644 --- a/public/pages/QueryGroupDetails/Components/QueryGroupSampleQuerySummary.tsx +++ b/public/pages/QueryGroupDetails/Components/QueryGroupSampleQuerySummary.tsx @@ -22,15 +22,20 @@ const PanelItem = ({ label, value }: { label: string; value: string | number }) ); -const QueryGroupSampleQuerySummary = ({ query }: { query: any }) => { +export const QueryGroupSampleQuerySummary = ({ query }: { query: any }) => { const convertTime = (unixTime: number) => { const date = new Date(unixTime); const loc = date.toDateString().split(' '); return `${loc[1]} ${loc[2]}, ${loc[3]} @ ${date.toLocaleTimeString('en-US')}`; }; - - const { timestamp, indices, search_type, node_id, total_shards } = query; + const { + timestamp, + indices, + search_type: searchType, + node_id: nodeId, + total_shards: totalShards, + } = query; return ( @@ -40,12 +45,10 @@ const QueryGroupSampleQuerySummary = ({ query }: { query: any }) => { - - - + + + ); }; - -export default QueryGroupSampleQuerySummary; diff --git a/public/pages/QueryGroupDetails/QueryGroupDetails.test.tsx b/public/pages/QueryGroupDetails/QueryGroupDetails.test.tsx index 145daad..8aa3c7c 100644 --- a/public/pages/QueryGroupDetails/QueryGroupDetails.test.tsx +++ b/public/pages/QueryGroupDetails/QueryGroupDetails.test.tsx @@ -1,6 +1,11 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + import { render, screen, waitFor } from '@testing-library/react'; -import {MemoryRouter, Route} from 'react-router-dom'; -import QueryGroupDetails from './QueryGroupDetails'; +import { MemoryRouter, Route } from 'react-router-dom'; +import { QueryGroupDetails } from './QueryGroupDetails'; import { CoreStart } from 'opensearch-dashboards/public'; import React from 'react'; import { mockQueries } from '../../../test/mocks/mockQueries'; @@ -21,11 +26,11 @@ jest.mock('react-ace', () => ({ })); describe('QueryGroupDetails', () => { - const coreMock = { + const coreMock = ({ chrome: { setBreadcrumbs: jest.fn(), }, - } as unknown as CoreStart; + } as unknown) as CoreStart; const expectedHash = '8c1e50c035663459d567fa11d8eb494d'; @@ -33,7 +38,7 @@ describe('QueryGroupDetails', () => { render( - + ); @@ -43,8 +48,14 @@ describe('QueryGroupDetails', () => { await waitFor(() => { expect(coreMock.chrome.setBreadcrumbs).toHaveBeenCalledWith([ - { text: 'Query insights', href: '/queryInsights' , onClick: expect.any(Function)}, - { text: 'Query group details: Nov 15, 2024 @ 12:36:12 PM' }, + { + text: 'Query insights', + href: '/queryInsights', + onClick: expect.any(Function), + }, + { + text: expect.stringMatching(/^Query group details: .+ @ .+$/), // Matches dynamic date/time format + }, ]); }); }); @@ -53,7 +64,7 @@ describe('QueryGroupDetails', () => { render( - + ); @@ -77,12 +88,10 @@ describe('QueryGroupDetails', () => { it('should find the query based on hash', () => { const expectedQuery = mockQueries.find((q: any) => hash(q) === expectedHash); - expect(expectedQuery).not.toBeUndefined(); - if (expectedQuery) { - expect(expectedQuery.query_hashcode).toBe(expectedHash); - } else { + if (!expectedQuery) { throw new Error(`Query with hash ${expectedHash} was not found in mockQueries`); } + expect(expectedQuery.query_hashcode).toBe(expectedHash); }); it('renders correct breadcrumb based on query hash', async () => { @@ -95,13 +104,14 @@ describe('QueryGroupDetails', () => { ); await waitFor(() => { - expect(coreMock.chrome.setBreadcrumbs).toHaveBeenCalledWith(expect.arrayContaining([ - { text: 'Query insights', href: '/queryInsights' , onClick: expect.any(Function)}, - { text: 'Query group details: Nov 15, 2024 @ 12:36:12 PM' }, - expect.objectContaining({ - text: expect.stringMatching(/^Query group details: .+/) - }) - ])); + expect(coreMock.chrome.setBreadcrumbs).toHaveBeenCalledWith( + expect.arrayContaining([ + { text: 'Query insights', href: '/queryInsights', onClick: expect.any(Function) }, + expect.objectContaining({ + text: expect.stringMatching(/^Query group details: .+/), + }), + ]) + ); }); }); }); diff --git a/public/pages/QueryGroupDetails/QueryGroupDetails.tsx b/public/pages/QueryGroupDetails/QueryGroupDetails.tsx index 58c4125..8a08d31 100644 --- a/public/pages/QueryGroupDetails/QueryGroupDetails.tsx +++ b/public/pages/QueryGroupDetails/QueryGroupDetails.tsx @@ -8,8 +8,7 @@ import { CoreStart } from 'opensearch-dashboards/public'; import Plotly from 'plotly.js-dist'; import hash from 'object-hash'; import { useParams, useHistory, useLocation } from 'react-router-dom'; -import React, {useEffect} from "react"; -import {QUERY_INSIGHTS} from "../TopNQueries/TopNQueries"; +import React, { useEffect } from 'react'; import { EuiButton, EuiCodeBlock, @@ -21,12 +20,13 @@ import { EuiSpacer, EuiText, EuiTitle, - EuiIconTip + EuiIconTip, } from '@elastic/eui'; -import QueryGroupAggregateSummary from "./Components/QueryGroupAggregateSummary"; -import QueryGroupSampleQuerySummary from "./Components/QueryGroupSampleQuerySummary"; +import { QUERY_INSIGHTS } from '../TopNQueries/TopNQueries'; +import { QueryGroupAggregateSummary } from './Components/QueryGroupAggregateSummary'; +import { QueryGroupSampleQuerySummary } from './Components/QueryGroupSampleQuerySummary'; -const QueryGroupDetails = ({ queries, core }: { queries: any; core: CoreStart }) => { +export const QueryGroupDetails = ({ queries, core }: { queries: any; core: CoreStart }) => { const { hashedQuery } = useParams<{ hashedQuery: string }>(); const query = queries.find((q: any) => hash(q) === hashedQuery); @@ -102,18 +102,18 @@ const QueryGroupDetails = ({ queries, core }: { queries: any; core: CoreStart })

Query group details

- + - + - - + +

Sample query details

@@ -125,9 +125,9 @@ const QueryGroupDetails = ({ queries, core }: { queries: any; core: CoreStart }) aria-label="Details tooltip" />
- + - + @@ -175,6 +175,4 @@ const QueryGroupDetails = ({ queries, core }: { queries: any; core: CoreStart }) ); - }; -export default QueryGroupDetails; diff --git a/public/pages/QueryInsights/QueryInsights.tsx b/public/pages/QueryInsights/QueryInsights.tsx index 40fe2f3..ac7df67 100644 --- a/public/pages/QueryInsights/QueryInsights.tsx +++ b/public/pages/QueryInsights/QueryInsights.tsx @@ -15,7 +15,9 @@ import { INDICES, LATENCY, MEMORY_USAGE, - NODE_ID, QUERY_COUNT, QUERY_HASHCODE, + NODE_ID, + QUERY_COUNT, + QUERY_HASHCODE, SEARCH_TYPE, TIMESTAMP, TOTAL_SHARDS, @@ -29,7 +31,7 @@ const SEARCH_TYPE_FIELD = 'search_type'; const NODE_ID_FIELD = 'node_id'; const TOTAL_SHARDS_FIELD = 'total_shards'; const METRIC_DEFAULT_MSG = 'Not enabled'; -const GROUP_BY_FIELD = 'group_by' +const GROUP_BY_FIELD = 'group_by'; const QueryInsights = ({ queries, @@ -77,13 +79,18 @@ const QueryInsights = ({ render: (query: any) => { return ( - { - const route = query.group_by === 'SIMILARITY' ? `/query-group-details/${hash(query)}` : `/query-details/${hash(query)}`; - history.push(route); - }}> - {query.query_hashcode || '-'} - - + { + const route = + query.group_by === 'SIMILARITY' + ? `/query-group-details/${hash(query)}` + : `/query-details/${hash(query)}`; + history.push(route); + }} + > + {query.query_hashcode || '-'} + + ); }, sortable: (query) => query.query_hashcode || '-', @@ -94,13 +101,18 @@ const QueryInsights = ({ render: (query: any) => { return ( - { - const route = query.group_by === 'SIMILARITY' ? `/query-group-details/${hash(query)}` : `/query-details/${hash(query)}`; - history.push(route); - }}> - {query.group_by === 'SIMILARITY' ? 'group' : 'query'} - - + { + const route = + query.group_by === 'SIMILARITY' + ? `/query-group-details/${hash(query)}` + : `/query-details/${hash(query)}`; + history.push(route); + }} + > + {query.group_by === 'SIMILARITY' ? 'group' : 'query'} + + ); }, sortable: (query) => query.group_by || 'query', @@ -109,9 +121,20 @@ const QueryInsights = ({ { field: MEASUREMENTS_FIELD, name: QUERY_COUNT, - render: (measurements: any) => `${measurements?.latency?.count || measurements?.cpu?.count || measurements?.memory?.count || 1}`, + render: (measurements: any) => + `${ + measurements?.latency?.count || + measurements?.cpu?.count || + measurements?.memory?.count || + 1 + }`, sortable: (measurements: any) => { - return Number(measurements?.latency?.count || measurements?.cpu?.count || measurements?.memory?.count || 1); + return Number( + measurements?.latency?.count || + measurements?.cpu?.count || + measurements?.memory?.count || + 1 + ); }, truncateText: true, }, @@ -120,15 +143,13 @@ const QueryInsights = ({ name: TIMESTAMP, render: (query: any) => { const isQuery = query.group_by === 'NONE'; - const linkContent = isQuery ? convertTime(query.timestamp): '-'; + const linkContent = isQuery ? convertTime(query.timestamp) : '-'; const onClickHandler = () => history.push(`/query-details/${hash(query)}`); return ( - - {linkContent} - - + {linkContent} + ); }, sortable: (query) => query.timestamp, @@ -140,9 +161,10 @@ const QueryInsights = ({ render: (measurements: any) => { const latencyValue = measurements?.latency?.number; const latencyCount = measurements?.latency?.count; - const result = latencyValue !== undefined && latencyCount !== undefined - ? (latencyValue / latencyCount).toFixed(2) - : METRIC_DEFAULT_MSG; + const result = + latencyValue !== undefined && latencyCount !== undefined + ? (latencyValue / latencyCount).toFixed(2) + : METRIC_DEFAULT_MSG; return `${result} ms`; }, sortable: true, @@ -154,9 +176,10 @@ const QueryInsights = ({ render: (measurements: any) => { const cpuValue = measurements?.cpu?.number; const cpuCount = measurements?.cpu?.count; - const result = cpuValue !== undefined && cpuCount !== undefined - ? (cpuValue / cpuCount / 1000000).toFixed(2) - : METRIC_DEFAULT_MSG; + const result = + cpuValue !== undefined && cpuCount !== undefined + ? (cpuValue / cpuCount / 1000000).toFixed(2) + : METRIC_DEFAULT_MSG; return `${result} ms`; }, sortable: true, @@ -168,9 +191,10 @@ const QueryInsights = ({ render: (measurements: any) => { const memoryValue = measurements?.memory?.number; const memoryCount = measurements?.memory?.count; - const result = memoryValue !== undefined && memoryCount !== undefined - ? (memoryValue / memoryCount).toFixed(2) - : METRIC_DEFAULT_MSG; + const result = + memoryValue !== undefined && memoryCount !== undefined + ? (memoryValue / memoryCount).toFixed(2) + : METRIC_DEFAULT_MSG; return `${result} B`; }, sortable: true, @@ -255,12 +279,12 @@ const QueryInsights = ({ { value: 'NONE', name: 'query', - view: 'query' + view: 'query', }, { value: 'SIMILARITY', name: 'group', - view: 'group' + view: 'group', }, ], noOptionsMessage: 'No data available for the selected type', // Fallback message when no queries match diff --git a/public/pages/TopNQueries/TopNQueries.tsx b/public/pages/TopNQueries/TopNQueries.tsx index 43e2ced..61edaf6 100644 --- a/public/pages/TopNQueries/TopNQueries.tsx +++ b/public/pages/TopNQueries/TopNQueries.tsx @@ -12,8 +12,7 @@ import QueryInsights from '../QueryInsights/QueryInsights'; import Configuration from '../Configuration/Configuration'; import QueryDetails from '../QueryDetails/QueryDetails'; import { SearchQueryRecord } from '../../../types/types'; -import QueryGroupDetails from "../QueryGroupDetails/QueryGroupDetails"; - +import { QueryGroupDetails } from '../QueryGroupDetails/QueryGroupDetails'; export const QUERY_INSIGHTS = '/queryInsights'; export const CONFIGURATION = '/configuration'; @@ -26,7 +25,7 @@ export interface MetricSettings { } export interface GroupBySettings { - groupBy: string + groupBy: string; } const TopNQueries = ({ @@ -50,21 +49,21 @@ const TopNQueries = ({ isEnabled: false, currTopN: '', currWindowSize: '', - currTimeUnit: 'HOURS' + currTimeUnit: 'HOURS', }); const [cpuSettings, setCpuSettings] = useState({ isEnabled: false, currTopN: '', currWindowSize: '', - currTimeUnit: 'HOURS' + currTimeUnit: 'HOURS', }); const [memorySettings, setMemorySettings] = useState({ isEnabled: false, currTopN: '', currWindowSize: '', - currTimeUnit: 'HOURS' + currTimeUnit: 'HOURS', }); const [groupBySettings, setGroupBySettings] = useState({ groupBy: 'none' }); @@ -189,7 +188,7 @@ const TopNQueries = ({ if (get) { try { const resp = await core.http.get('/api/settings'); - const { latency, cpu, memory, group_by } = + const { latency, cpu, memory, group_by: groupBy } = resp?.response?.persistent?.search?.insights?.top_queries || {}; if (latency !== undefined && latency.enabled === 'true') { const [time, timeUnits] = latency.window_size @@ -224,8 +223,8 @@ const TopNQueries = ({ currTimeUnit: timeUnits === 'm' ? 'MINUTES' : 'HOURS', }); } - if (group_by) { - setGroupBySettings({ groupBy: group_by }); + if (groupBy) { + setGroupBySettings({ groupBy }); } } catch (error) { console.error('Failed to retrieve settings:', error); @@ -238,14 +237,14 @@ const TopNQueries = ({ currWindowSize: newWindowSize, currTimeUnit: newTimeUnit, }); - setGroupBySettings({ groupBy: newGroupBy }) + setGroupBySettings({ groupBy: newGroupBy }); await core.http.put('/api/update_settings', { query: { metric, enabled, top_n_size: newTopN, window_size: `${newWindowSize}${newTimeUnit === 'MINUTES' ? 'm' : 'h'}`, - group_by: newGroupBy + group_by: newGroupBy, }, }); } catch (error) { diff --git a/server/routes/index.ts b/server/routes/index.ts index 93496b7..88525fd 100644 --- a/server/routes/index.ts +++ b/server/routes/index.ts @@ -196,7 +196,7 @@ export function defineRoutes(router: IRouter) { [`search.insights.top_queries.${query.metric}.enabled`]: query.enabled, [`search.insights.top_queries.${query.metric}.top_n_size`]: query.top_n_size, [`search.insights.top_queries.${query.metric}.window_size`]: query.window_size, - [`search.insights.top_queries.group_by`]: query.group_by + [`search.insights.top_queries.group_by`]: query.group_by, }, }, }; diff --git a/test/mocks/mockQueries.ts b/test/mocks/mockQueries.ts index 7e8a9cb..dfd02d6 100644 --- a/test/mocks/mockQueries.ts +++ b/test/mocks/mockQueries.ts @@ -1,3 +1,8 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + export const mockQueries = [ { timestamp: 1731702972708, // Example timestamp in milliseconds diff --git a/types/types.ts b/types/types.ts index 8efc554..e18ef05 100644 --- a/types/types.ts +++ b/types/types.ts @@ -22,7 +22,6 @@ export interface SearchQueryRecord { task_resource_usages: Task[]; query_hashcode: string; group_by: string; - } export interface Measurement { diff --git a/yarn.lock b/yarn.lock index c5c5f59..8e1efaf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2238,7 +2238,7 @@ dayjs@^1.10.4: resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.13.tgz#92430b0139055c3ebb60150aa13e860a4b5a366c" integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg== -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@^4.3.1, debug@^4.3.2: +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@^4.3.1: version "4.3.6" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b" integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg== @@ -2259,6 +2259,13 @@ debug@^3.1.0, debug@^3.2.7: dependencies: ms "^2.1.1" +debug@^4.3.2: + version "4.4.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" + integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== + dependencies: + ms "^2.1.3" + decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -4765,7 +4772,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.1.1: +ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==