Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: Move 3rd party apis to QB V5 (#9042)

Abhi kumar0ac5d974957e
diff --git a/frontend/src/api/thirdPartyApis/listOverview.ts b/frontend/src/api/thirdPartyApis/listOverview.ts
new file mode 100644
index 0000000000..303ee03ae0
--- /dev/null
+++ b/frontend/src/api/thirdPartyApis/listOverview.ts
@@ -0,0 +1,31 @@
+import { ApiBaseInstance } from 'api';
+import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
+import { AxiosError } from 'axios';
+import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
+import { PayloadProps, Props } from 'types/api/thirdPartyApis/listOverview';
+
+const listOverview = async (
+ props: Props,
+): Promise<SuccessResponseV2<PayloadProps>> => {
+ const { start, end, show_ip: showIp, filter } = props;
+ try {
+ const response = await ApiBaseInstance.post(
+ `/third-party-apis/overview/list`,
+ {
+ start,
+ end,
+ show_ip: showIp,
+ filter,
+ },
+ );
+
+ return {
+ httpStatusCode: response.status,
+ data: response.data,
+ };
+ } catch (error) {
+ ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
+ }
+};
+
+export default listOverview;
diff --git a/frontend/src/components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch.tsx b/frontend/src/components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch.tsx
index aab2cd2d91..f93a6ba6ee 100644
--- a/frontend/src/components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch.tsx
+++ b/frontend/src/components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch.tsx
@@ -80,16 +80,20 @@ const stopEventsExtension = EditorView.domEventHandlers({
});
function QuerySearch({
+ placeholder,
onChange,
queryData,
dataSource,
onRun,
signalSource,
+ hardcodedAttributeKeys,
}: {
+ placeholder?: string;
onChange: (value: string) => void;
queryData: IBuilderQuery;
dataSource: DataSource;
signalSource?: string;
+ hardcodedAttributeKeys?: QueryKeyDataSuggestionsProps[];
onRun?: (query: string) => void;
}): JSX.Element {
const isDarkMode = useIsDarkMode();
@@ -239,6 +243,11 @@ function QuerySearch({
return;
}
+ if (hardcodedAttributeKeys) {
+ setKeySuggestions(hardcodedAttributeKeys);
+ return;
+ }
+
lastFetchedKeyRef.current = searchText || '';
const response = await getKeySuggestions({
@@ -274,6 +283,7 @@ function QuerySearch({
toggleSuggestions,
queryData.aggregateAttribute?.key,
signalSource,
+ hardcodedAttributeKeys,
],
);
@@ -1378,7 +1388,7 @@ function QuerySearch({
]),
),
]}
- placeholder="Enter your filter query (e.g., http.status_code >= 500 AND service.name = 'frontend')"
+ placeholder={placeholder}
basicSetup={{
lineNumbers: false,
}}
@@ -1530,6 +1540,9 @@ function QuerySearch({
QuerySearch.defaultProps = {
onRun: undefined,
signalSource: '',
+ hardcodedAttributeKeys: undefined,
+ placeholder:
+ "Enter your filter query (e.g., http.status_code >= 500 AND service.name = 'frontend')",
};
export default QuerySearch;
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/DomainDetails.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/DomainDetails.tsx
index 6f0eb19b80..b5c110b973 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/DomainDetails.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainDetails/DomainDetails.tsx
@@ -157,9 +157,12 @@ function DomainDetails({
<div className="domain-details-drawer-header">
<div className="domain-details-drawer-header-title">
<Divider type="vertical" />
- <Typography.Text className="title">
- {domainData.domainName}
- </Typography.Text>
+
+ {domainData?.domainName && (
+ <Typography.Text className="title">
+ {domainData.domainName}
+ </Typography.Text>
+ )}
</div>
<div className="domain-details-drawer-header-right-container">
<DateTimeSelectionV2
diff --git a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainList.tsx b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainList.tsx
index 69557df7c5..e1b55edf50 100644
--- a/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainList.tsx
+++ b/frontend/src/container/ApiMonitoring/Explorer/Domains/DomainList.tsx
@@ -2,36 +2,29 @@ import '../Explorer.styles.scss';
import { LoadingOutlined } from '@ant-design/icons';
import { Spin, Table, Typography } from 'antd';
-import axios from 'api';
import logEvent from 'api/common/logEvent';
-import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
-import { AxiosError } from 'axios';
import cx from 'classnames';
+import QuerySearch from 'components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch';
import { initialQueriesMap } from 'constants/queryBuilder';
-import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import RightToolbarActions from 'container/QueryBuilder/components/ToolbarActions/RightToolbarActions';
-import QueryBuilderSearchV2 from 'container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2';
import Toolbar from 'container/Toolbar/Toolbar';
import { useGetCompositeQueryParam } from 'hooks/queryBuilder/useGetCompositeQueryParam';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { useQueryOperations } from 'hooks/queryBuilder/useQueryBuilderOperations';
import { useShareBuilderUrl } from 'hooks/queryBuilder/useShareBuilderUrl';
+import { useListOverview } from 'hooks/thirdPartyApis/useListOverview';
+import { get } from 'lodash-es';
import { useCallback, useEffect, useMemo, useState } from 'react';
-import { useQuery } from 'react-query';
import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers';
-import { ErrorResponse, SuccessResponse } from 'types/api';
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
-import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
+import { HandleChangeQueryDataV5 } from 'types/common/operations.types';
import { DataSource } from 'types/common/queryBuilder';
import { GlobalReducer } from 'types/reducer/globalTime';
+import { ApiMonitoringHardcodedAttributeKeys } from '../../constants';
import { DEFAULT_PARAMS, useApiMonitoringParams } from '../../queryParams';
-import {
- columnsConfig,
- formatDataForTable,
- hardcodedAttributeKeys,
-} from '../../utils';
+import { columnsConfig, formatDataForTable } from '../../utils';
import DomainDetails from './DomainDetails/DomainDetails';
function DomainList(): JSX.Element {
@@ -53,6 +46,21 @@ function DomainList(): JSX.Element {
entityVersion: '',
});
+ const compositeData = useGetCompositeQueryParam();
+
+ const { data, isLoading, isFetching } = useListOverview({
+ start: minTime,
+ end: maxTime,
+ show_ip: Boolean(showIP),
+ filter: {
+ expression: `kind_string = 'Client' ${get(
+ compositeData,
+ 'builder.queryData[0].filter.expression',
+ '',
+ )}`,
+ },
+ });
+
// initialise tab with default query.
useShareBuilderUrl({
defaultValue: {
@@ -74,63 +82,21 @@ function DomainList(): JSX.Element {
},
});
- const compositeData = useGetCompositeQueryParam();
-
- const handleChangeTagFilters = useCallback(
- (value: IBuilderQuery['filters']) => {
- handleChangeQueryData('filters', value);
+ const handleSearchChange = useCallback(
+ (value: string) => {
+ (handleChangeQueryData as HandleChangeQueryDataV5)('filter', {
+ expression: value,
+ });
},
[handleChangeQueryData],
);
- const fetchApiOverview = async (): Promise<
- SuccessResponse<any> | ErrorResponse
- > => {
- const requestBody = {
- start: minTime,
- end: maxTime,
- show_ip: showIP,
- filters: {
- op: 'AND',
- items: [
- {
- id: '212678b9',
- key: {
- key: 'kind_string',
- dataType: 'string',
- type: '',
- },
- op: '=',
- value: 'Client',
- },
- ...(compositeData?.builder?.queryData[0]?.filters?.items || []),
- ],
- },
- };
-
- try {
- const response = await axios.post(
- '/third-party-apis/overview/list',
- requestBody,
- );
- return {
- statusCode: 200,
- error: null,
- message: response.data.status,
- payload: response.data,
- };
- } catch (error) {
- return ErrorResponseHandler(error as AxiosError);
- }
- };
-
- const { data, isLoading, isFetching } = useQuery(
- [REACT_QUERY_KEY.GET_DOMAINS_LIST, minTime, maxTime, compositeData, showIP],
- fetchApiOverview,
- );
-
const formattedDataForTable = useMemo(
- () => formatDataForTable(data?.payload?.data?.result[0]?.table?.rows),
+ () =>
+ formatDataForTable(
+ data?.data?.data?.data.results[0]?.data || [],
+ data?.data?.data?.data.results[0]?.columns || [],
+ ),
[data],
);
@@ -150,13 +116,13 @@ function DomainList(): JSX.Element {
showAutoRefresh={false}
rightActions={<RightToolbarActions onStageRunQuery={handleRunQuery} />}
/>
- {/* add bottom border here */}
<div className={cx('api-monitoring-list-header')}>
- <QueryBuilderSearchV2
- query={query}
- onChange={handleChangeTagFilters}
- placeholder="Search filters..."
- hardcodedAttributeKeys={hardcodedAttributeKeys}
+ <QuerySearch
+ dataSource={DataSource.TRACES}
+ queryData={query}
+ onChange={handleSearchChange}
+ placeholder="Enter your filter query (e.g., deployment.environment = 'otel-demo' AND service.name = 'frontend')"
+ hardcodedAttributeKeys={ApiMonitoringHardcodedAttributeKeys}
/>
</div>
<Table
diff --git a/frontend/src/container/ApiMonitoring/APIMonitoringUtils.test.tsx b/frontend/src/container/ApiMonitoring/__tests__/APIMonitoringUtils.test.tsx
similarity index 96%
rename from frontend/src/container/ApiMonitoring/APIMonitoringUtils.test.tsx
rename to frontend/src/container/ApiMonitoring/__tests__/APIMonitoringUtils.test.tsx
index 4c7a192dcf..e2507282bc 100644
--- a/frontend/src/container/ApiMonitoring/APIMonitoringUtils.test.tsx
+++ b/frontend/src/container/ApiMonitoring/__tests__/APIMonitoringUtils.test.tsx
@@ -3,10 +3,11 @@ import { PANEL_TYPES } from 'constants/queryBuilder';
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
-import { SPAN_ATTRIBUTES } from './Explorer/Domains/DomainDetails/constants';
+import { SPAN_ATTRIBUTES } from '../Explorer/Domains/DomainDetails/constants';
import {
endPointStatusCodeColumns,
extractPortAndEndpoint,
+ formatDataForTable,
formatTopErrorsDataForTable,
getAllEndpointsWidgetData,
getCustomFiltersForBarChart,
@@ -24,7 +25,8 @@ import {
getTopErrorsCoRelationQueryFilters,
getTopErrorsQueryPayload,
TopErrorsResponseRow,
-} from './utils';
+} from '../utils';
+import { APIMonitoringColumnsMock } from './mock';
// Mock or define DataTypes since it seems to be missing from imports
const DataTypes = {
@@ -34,9 +36,9 @@ const DataTypes = {
};
// Mock the external utils dependencies that are used within our tested functions
-jest.mock('./utils', () => {
+jest.mock('../utils', () => {
// Import the actual module to partial mock
- const originalModule = jest.requireActual('./utils');
+ const originalModule = jest.requireActual('../utils');
// Return a mocked version
return {
@@ -157,6 +159,54 @@ describe('API Monitoring Utils', () => {
});
});
+ // New tests for formatDataForTable
+ describe('formatDataForTable', () => {
+ it('should format rows correctly with valid data', () => {
+ const columns = APIMonitoringColumnsMock;
+ const data = [
+ [
+ 'test-domain', // domainName
+ '10', // endpoints
+ '25', // rps
+ '2.5', // error_rate
+ '15000000', // p99 (ns) -> 15 ms
+ '2025-09-17T12:54:17.040Z', // lastseen
+ ],
+ ];
+
+ const result = formatDataForTable(data as any, columns as any);
+
+ expect(result).toHaveLength(1);
+ expect(result[0].domainName).toBe('test-domain');
+ expect(result[0].endpointCount).toBe('10');
+ expect(result[0].rate).toBe('25');
+ expect(result[0].errorRate).toBe('2.5');
+ expect(result[0].latency).toBe(15);
+ expect(result[0].lastUsed).toBe('2025-09-17T12:54:17.040Z');
+ });
+
+ it('should handle n/a and undefined values', () => {
+ const columns = APIMonitoringColumnsMock;
+ const data = [
+ [
+ 'test-domain',
+ 'n/a', // endpoints -> 0
+ 'n/a', // rps -> '-'
+ 'n/a', // error_rate -> 0
+ 'n/a', // p99 -> '-'
+ 'n/a', // lastseen -> '-'
+ ],
+ ];
+
+ const result = formatDataForTable(data as any, columns as any);
+
+ expect(result[0].endpointCount).toBe(0);
+ expect(result[0].rate).toBe('-');
+ expect(result[0].errorRate).toBe(0);
+ expect(result[0].latency).toBe('-');
+ expect(result[0].lastUsed).toBe('-');
+ });
+ });
describe('getGroupByFiltersFromGroupByValues', () => {
it('should convert row data to filters correctly', () => {
// Arrange
@@ -1288,7 +1338,7 @@ describe('API Monitoring Utils', () => {
// Setup a mock
jest
.spyOn(
- jest.requireActual('./utils'),
+ jest.requireActual('../utils'),
'getFormattedEndPointStatusCodeChartData',
)
.mockReturnValue({
diff --git a/frontend/src/container/ApiMonitoring/__tests__/mock.ts b/frontend/src/container/ApiMonitoring/__tests__/mock.ts
new file mode 100644
index 0000000000..f88c83137f
--- /dev/null
+++ b/frontend/src/container/ApiMonitoring/__tests__/mock.ts
@@ -0,0 +1,65 @@
+import { domainNameKey } from '../constants';
+import { APIMonitoringResponseColumn } from '../types';
+
+export const APIMonitoringColumnsMock: APIMonitoringResponseColumn[] = [
+ {
+ name: domainNameKey,
+ signal: 'traces',
+ fieldContext: '',
+ fieldDataType: 'string',
+ queryName: '',
+ aggregationIndex: 0,
+ meta: {},
+ columnType: 'attribute',
+ },
+ {
+ name: 'endpoints',
+ signal: 'traces',
+ fieldContext: '',
+ fieldDataType: 'number',
+ queryName: 'endpoints',
+ aggregationIndex: 0,
+ meta: {},
+ columnType: 'metric',
+ },
+ {
+ name: 'rps',
+ signal: 'traces',
+ fieldContext: '',
+ fieldDataType: 'number',
+ queryName: 'rps',
+ aggregationIndex: 0,
+ meta: {},
+ columnType: 'metric',
+ },
+ {
+ name: 'error_rate',
+ signal: 'traces',
+ fieldContext: '',
+ fieldDataType: 'number',
+ queryName: 'error_rate',
+ aggregationIndex: 0,
+ meta: {},
+ columnType: 'metric',
+ },
+ {
+ name: 'p99',
+ signal: 'traces',
+ fieldContext: '',
+ fieldDataType: 'number',
+ queryName: 'p99',
+ aggregationIndex: 0,
+ meta: {},
+ columnType: 'metric',
+ },
+ {
+ name: 'lastseen',
+ signal: 'traces',
+ fieldContext: '',
+ fieldDataType: 'number',
+ queryName: 'lastseen',
+ aggregationIndex: 0,
+ meta: {},
+ columnType: 'metric',
+ },
+];
diff --git a/frontend/src/container/ApiMonitoring/constants.ts b/frontend/src/container/ApiMonitoring/constants.ts
new file mode 100644
index 0000000000..aadce55de6
--- /dev/null
+++ b/frontend/src/container/ApiMonitoring/constants.ts
@@ -0,0 +1,30 @@
+import { QUERY_BUILDER_KEY_TYPES } from 'constants/antlrQueryConstants';
+import { QueryKeyDataSuggestionsProps } from 'types/api/querySuggestions/types';
+
+import { SPAN_ATTRIBUTES } from './Explorer/Domains/DomainDetails/constants';
+
+export const ApiMonitoringHardcodedAttributeKeys: QueryKeyDataSuggestionsProps[] = [
+ {
+ label: 'deployment.environment',
+ type: 'resource',
+ name: 'deployment.environment',
+ signal: 'traces',
+ fieldDataType: QUERY_BUILDER_KEY_TYPES.STRING,
+ },
+ {
+ label: 'service.name',
+ type: 'resource',
+ name: 'service.name',
+ signal: 'traces',
+ fieldDataType: QUERY_BUILDER_KEY_TYPES.STRING,
+ },
+ {
+ label: 'rpc.method',
+ type: 'tag',
+ name: 'rpc.method',
+ signal: 'traces',
+ fieldDataType: QUERY_BUILDER_KEY_TYPES.STRING,
+ },
+];
+
+export const domainNameKey = SPAN_ATTRIBUTES.SERVER_NAME;
diff --git a/frontend/src/container/ApiMonitoring/types.ts b/frontend/src/container/ApiMonitoring/types.ts
new file mode 100644
index 0000000000..ea38c5c416
--- /dev/null
+++ b/frontend/src/container/ApiMonitoring/types.ts
@@ -0,0 +1,39 @@
+import { domainNameKey } from './constants';
+
+export interface APIMonitoringResponseRow {
+ data: {
+ endpoints: number | string;
+ error_rate: number | string;
+ lastseen: number | string;
+ [domainNameKey]: string;
+ p99: number | string;
+ rps: number | string;
+ };
+}
+
+export interface APIMonitoringResponseColumn {
+ name: string;
+ signal: string;
+ fieldContext: string;
+ fieldDataType: string;
+ queryName: string;
+ aggregationIndex: number;
+ meta: Record<string, any>;
+ columnType: string;
+}
+
+export interface EndPointsResponseRow {
+ data: {
+ [key: string]: string | number | undefined;
+ };
+}
+
+export interface APIDomainsRowData {
+ key: string;
+ domainName: string;
+ endpointCount: number | string;
+ rate: number | string;
+ errorRate: number | string;
+ latency: number | string;
+ lastUsed: string;
+}
diff --git a/frontend/src/container/ApiMonitoring/utils.tsx b/frontend/src/container/ApiMonitoring/utils.tsx
index bb68d12248..136dc937f1 100644
--- a/frontend/src/container/ApiMonitoring/utils.tsx
+++ b/frontend/src/container/ApiMonitoring/utils.tsx
@@ -32,7 +32,13 @@ import { EQueryType } from 'types/common/dashboard';
import { DataSource } from 'types/common/queryBuilder';
import { v4 } from 'uuid';
+import { domainNameKey } from './constants';
import { SPAN_ATTRIBUTES } from './Explorer/Domains/DomainDetails/constants';
+import {
+ APIDomainsRowData,
+ APIMonitoringResponseColumn,
+ EndPointsResponseRow,
+} from './types';
export const ApiMonitoringQuickFiltersConfig: IQuickFiltersConfig[] = [
{
@@ -243,84 +249,47 @@ export const columnsConfig: ColumnType<APIDomainsRowData>[] = [
},
];
-// Rename this to a proper name
-export const hardcodedAttributeKeys: BaseAutocompleteData[] = [
- {
- key: 'deployment.environment',
- dataType: DataTypes.String,
- type: 'resource',
- },
- {
- key: 'service.name',
- dataType: DataTypes.String,
- type: 'resource',
- },
- {
- key: 'rpc.method',
- dataType: DataTypes.String,
- type: 'tag',
- },
-];
-
-const domainNameKey = SPAN_ATTRIBUTES.SERVER_NAME;
-
-interface APIMonitoringResponseRow {
- data: {
- endpoints: number | string;
- error_rate: number | string;
- lastseen: number | string;
- [domainNameKey]: string;
- p99: number | string;
- rps: number | string;
- };
-}
-
-interface EndPointsResponseRow {
- data: {
- [key: string]: string | number | undefined;
- };
-}
-
-export interface APIDomainsRowData {
- key: string;
- domainName: string;
- endpointCount: number | string;
- rate: number | string;
- errorRate: number | string;
- latency: number | string;
- lastUsed: string;
-}
-
-// Rename this to a proper name
export const formatDataForTable = (
- data: APIMonitoringResponseRow[],
-): APIDomainsRowData[] =>
- data?.map((domain) => ({
- key: v4(),
- domainName: domain?.data[domainNameKey] || '-',
- endpointCount:
- domain?.data?.endpoints === 'n/a' || domain?.data?.endpoints === undefined
- ? 0
- : domain?.data?.endpoints,
- rate:
- domain?.data?.rps === 'n/a' || domain?.data?.rps === undefined
- ? '-'
- : domain?.data?.rps,
- errorRate:
- domain?.data?.error_rate === 'n/a' || domain?.data?.error_rate === undefined
- ? 0
- : domain?.data?.error_rate,
- latency:
- domain?.data?.p99 === 'n/a' || domain?.data?.p99 === undefined
- ? '-'
- : Math.round(Number(domain?.data?.p99) / 1000000), // Convert from nanoseconds to milliseconds
- lastUsed:
- domain?.data?.lastseen === 'n/a' || domain?.data?.lastseen === undefined
- ? '-'
- : new Date(
- Math.floor(Number(domain?.data?.lastseen) / 1000000),
- ).toISOString(), // Convert from nanoseconds to milliseconds
- }));
+ data: string[][],
+ columns: APIMonitoringResponseColumn[],
+): APIDomainsRowData[] => {
+ const indexMap = columns.reduce((acc, column, index) => {
+ if (column.name === domainNameKey) {
+ acc[column.name] = index;
+ } else {
+ acc[column.queryName] = index;
+ }
+ return acc;
+ }, {} as Record<string, number>);
+
+ return data.map((row) => {
+ const rowData: APIDomainsRowData = {
+ key: v4(),
+ domainName: row[indexMap[domainNameKey]],
+ endpointCount:
+ row[indexMap.endpoints] === 'n/a' || row[indexMap.endpoints] === undefined
+ ? 0
+ : row[indexMap.endpoints],
+ rate:
+ row[indexMap.rps] === 'n/a' || row[indexMap.rps] === undefined
+ ? '-'
+ : row[indexMap.rps],
+ errorRate:
+ row[indexMap.error_rate] === 'n/a' || row[indexMap.error_rate] === undefined
+ ? 0
+ : row[indexMap.error_rate],
+ latency:
+ row[indexMap.p99] === 'n/a' || row[indexMap.p99] === undefined
+ ? '-'
+ : Math.round(Number(row[indexMap.p99]) / 1000000),
+ lastUsed:
+ row[indexMap.lastseen] === 'n/a' || row[indexMap.lastseen] === undefined
+ ? '-'
+ : new Date(row[indexMap.lastseen]).toISOString(),
+ };
+ return rowData;
+ });
+};
export const getDomainMetricsQueryPayload = (
domainName: string,
diff --git a/frontend/src/hooks/thirdPartyApis/useListOverview.ts b/frontend/src/hooks/thirdPartyApis/useListOverview.ts
new file mode 100644
index 0000000000..67c5483ba3
--- /dev/null
+++ b/frontend/src/hooks/thirdPartyApis/useListOverview.ts
@@ -0,0 +1,31 @@
+import listOverview from 'api/thirdPartyApis/listOverview';
+import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
+import { useQuery, UseQueryResult } from 'react-query';
+import { SuccessResponseV2 } from 'types/api';
+import APIError from 'types/api/error';
+import {
+ PayloadProps,
+ Props as ListOverviewProps,
+} from 'types/api/thirdPartyApis/listOverview';
+
+export const useListOverview = (
+ props: ListOverviewProps,
+): UseQueryResult<SuccessResponseV2<PayloadProps>, APIError> => {
+ const { start, end, show_ip: showIp, filter } = props;
+ return useQuery<SuccessResponseV2<PayloadProps>, APIError>({
+ queryKey: [
+ REACT_QUERY_KEY.GET_DOMAINS_LIST,
+ start,
+ end,
+ showIp,
+ filter.expression,
+ ],
+ queryFn: () =>
+ listOverview({
+ start,
+ end,
+ show_ip: showIp,
+ filter,
+ }),
+ });
+};
diff --git a/frontend/src/types/api/thirdPartyApis/listOverview.ts b/frontend/src/types/api/thirdPartyApis/listOverview.ts
new file mode 100644
index 0000000000..453d00785e
--- /dev/null
+++ b/frontend/src/types/api/thirdPartyApis/listOverview.ts
@@ -0,0 +1,30 @@
+import { APIMonitoringResponseColumn } from 'container/ApiMonitoring/types';
+
+import { RequestType } from '../v5/queryRange';
+
+export interface Props {
+ start: number;
+ end: number;
+ show_ip: boolean;
+ filter: {
+ expression: string;
+ };
+}
+
+export interface PayloadProps {
+ data: {
+ data: {
+ results: {
+ columns: APIMonitoringResponseColumn[];
+ data: string[][];
+ }[];
+ };
+ meta: {
+ rowsScanned: number;
+ bytesScanned: number;
+ durationMs: number;
+ };
+ type: RequestType;
+ };
+ status: string;
+}