mirror of
https://github.com/SigNoz/signoz.git
synced 2026-12-04 22:21:09 +00:00
Compare commits
6 Commits
tvats-log-
...
perf/web-i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a00eb69fe | ||
|
|
f0c1f4bbf9 | ||
|
|
8fad61a8b5 | ||
|
|
ed69006a2a | ||
|
|
649c3a250c | ||
|
|
f7b1383427 |
@@ -113,11 +113,10 @@ CI runs each play once, with its story's own args. Anyone can flip a control in
|
||||
Before writing the clicks, list what has to be on screen for the play's target to exist. Then walk every control the story exposes, the page's own as well as the shared ones, and return early for each value that takes something on that list away. These are the cases plays have missed:
|
||||
|
||||
- An arg the story sets. The story sets it because the play needs what that value renders, and the panel can flip it. On the `mine` view the dashboards Created-by filter opens with a tag to remove; on the other views it opens empty and there is no × to click. Check the tag is there by parsing the route the view resolves to.
|
||||
- The controls every story has. `State` on loading or error renders no rows and no filter suggestions. `Access`, `Permissions` and `Revoked` remove rows, row actions and gated buttons, and the `editor` and `viewer` presets grant telemetry reads only, so a page gated on its own resource shows them nothing. `Check state` on loading disables every gated control, and on error an `AuthZButton` stays enabled while an `AuthZGuardContent` set to fail closed hides what it wraps. `License` and `Banner` decide the plan, so a cloud-only form is gone on the others. `Hold tooltips open` shows a label a second time, inside its tooltip, and fails any check that no tooltip is open.
|
||||
- The controls every story has. `State` on loading or error renders no rows and no filter suggestions. `Access`, `Permissions` and `Revoked` remove rows, row actions and gated buttons, and the `editor` and `viewer` presets grant telemetry reads only, so a page gated on its own resource shows them nothing. `Check state` on loading disables every gated control, and on error an `AuthZButton` stays enabled while an `AuthZGuardContent` set to fail closed hides what it wraps. `License` and `Banner` decide the plan, so a cloud-only form is gone on the others. `Hold tooltips open` shows a label a second time, inside its tooltip.
|
||||
- A count at 0. The page can swap its whole list for an empty state, and the header, filters and column picker go with it.
|
||||
- A view, filter or invalid query that leaves no rows, even when the count is above 0.
|
||||
- A tab without the widget. A filter box that one tab has is not on the next.
|
||||
- A control that moves the widget out of the canvas. Trace details with `Panel position` on dialog renders span details in a floating panel under `document.body`, so a lookup `within(canvasElement)` never finds its tabs. Return early for that value, or search with `screen`.
|
||||
- A second list beside the main one, such as saved views. At 0, loading or failed, its actions are gone.
|
||||
- Text that depends on an arg. A disabled rule offers Enable, not Disable. A write that fails raises a different toast from one that lands, and one left loading raises none. Pick the expected text from the args.
|
||||
- Rows that move. A view, a sort or pinning changes which row is locked, pinned or legacy, so find the row by what it is, not by its index.
|
||||
|
||||
@@ -165,6 +165,7 @@ apiserver:
|
||||
- /api/v1/health
|
||||
- /api/v1/version
|
||||
- /
|
||||
- /assets/
|
||||
|
||||
##################### Querier #####################
|
||||
querier:
|
||||
|
||||
@@ -10445,80 +10445,6 @@ components:
|
||||
- asc
|
||||
- desc
|
||||
type: string
|
||||
Querybuildertypesv5Pattern:
|
||||
properties:
|
||||
count:
|
||||
description: The number of logs of the pattern in the time range, scaled
|
||||
up by sampleRate.
|
||||
minimum: 0
|
||||
type: integer
|
||||
id:
|
||||
description: 'The pattern''s ID: the decimal 64-bit FNV-1a hash of its template.'
|
||||
type: string
|
||||
pattern:
|
||||
description: 'The pattern''s template: the log message with the values that
|
||||
change replaced by <*>. Empty when the template is not known yet.'
|
||||
type: string
|
||||
percent:
|
||||
description: The pattern's count as a percentage of total.
|
||||
format: double
|
||||
type: number
|
||||
trend:
|
||||
description: The number of logs of the pattern in each step of the time
|
||||
range, oldest first. Steps without a log are left out.
|
||||
items:
|
||||
$ref: '#/components/schemas/Querybuildertypesv5PatternTrendPoint'
|
||||
nullable: true
|
||||
type: array
|
||||
required:
|
||||
- id
|
||||
- pattern
|
||||
- count
|
||||
- percent
|
||||
- trend
|
||||
type: object
|
||||
Querybuildertypesv5PatternTrendPoint:
|
||||
properties:
|
||||
count:
|
||||
description: The number of logs of the pattern in the step, scaled up by
|
||||
sampleRate.
|
||||
minimum: 0
|
||||
type: integer
|
||||
timestamp:
|
||||
description: The Unix time in milliseconds the step starts at.
|
||||
format: int64
|
||||
type: integer
|
||||
required:
|
||||
- timestamp
|
||||
- count
|
||||
type: object
|
||||
Querybuildertypesv5PatternsData:
|
||||
properties:
|
||||
patterns:
|
||||
description: The patterns, most logs first.
|
||||
items:
|
||||
$ref: '#/components/schemas/Querybuildertypesv5Pattern'
|
||||
nullable: true
|
||||
type: array
|
||||
queryName:
|
||||
description: The name of the query that produced this result.
|
||||
type: string
|
||||
sampleRate:
|
||||
description: One in sampleRate of the matching logs was read and every count
|
||||
is scaled up by it. 1 means every log was read and the counts are exact.
|
||||
minimum: 0
|
||||
type: integer
|
||||
total:
|
||||
description: The number of matching logs that have a pattern, over every
|
||||
pattern.
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- queryName
|
||||
- sampleRate
|
||||
- total
|
||||
- patterns
|
||||
type: object
|
||||
Querybuildertypesv5PreviewStatement:
|
||||
properties:
|
||||
db.statement.args:
|
||||
@@ -11080,12 +11006,11 @@ components:
|
||||
- $ref: '#/components/schemas/Querybuildertypesv5ScalarData'
|
||||
- $ref: '#/components/schemas/Querybuildertypesv5RawData'
|
||||
- $ref: '#/components/schemas/Querybuildertypesv5DistributionData'
|
||||
- $ref: '#/components/schemas/Querybuildertypesv5PatternsData'
|
||||
properties:
|
||||
results:
|
||||
description: 'One result per enabled query, typed by the request type: TimeSeriesData
|
||||
for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData
|
||||
for distribution and PatternsData for pattern requests.'
|
||||
for time_series and heatmap, ScalarData for scalar, RawData for raw and
|
||||
DistributionData for distribution requests.'
|
||||
items: {}
|
||||
nullable: true
|
||||
type: array
|
||||
@@ -11276,8 +11201,8 @@ components:
|
||||
Querybuildertypesv5QueryRangeResponse:
|
||||
description: 'Response from the v5 query range endpoint. The data.results array
|
||||
contains typed results depending on the requestType: TimeSeriesData for time_series
|
||||
and heatmap, ScalarData for scalar, RawData for raw, DistributionData for
|
||||
distribution, or PatternsData for pattern requests.'
|
||||
and heatmap, ScalarData for scalar, RawData for raw, or DistributionData for
|
||||
distribution requests.'
|
||||
properties:
|
||||
data:
|
||||
allOf:
|
||||
@@ -11374,7 +11299,6 @@ components:
|
||||
- raw_stream
|
||||
- trace
|
||||
- heatmap
|
||||
- pattern
|
||||
- distribution
|
||||
type: string
|
||||
Querybuildertypesv5ScalarData:
|
||||
@@ -14572,9 +14496,8 @@ paths:
|
||||
x-signoz-stability: alpha
|
||||
/api/v1/channels:
|
||||
get:
|
||||
deprecated: true
|
||||
description: 'Deprecated: use GET /api/v2/notification_channels instead. This
|
||||
endpoint lists all notification channels for the organization'
|
||||
deprecated: false
|
||||
description: This endpoint lists all notification channels for the organization
|
||||
operationId: ListChannels
|
||||
responses:
|
||||
"200":
|
||||
@@ -14621,9 +14544,8 @@ paths:
|
||||
- channels
|
||||
x-signoz-stability: alpha
|
||||
post:
|
||||
deprecated: true
|
||||
description: 'Deprecated: use POST /api/v2/notification_channels instead. This
|
||||
endpoint creates a notification channel'
|
||||
deprecated: false
|
||||
description: This endpoint creates a notification channel
|
||||
operationId: CreateChannel
|
||||
requestBody:
|
||||
content:
|
||||
@@ -14680,9 +14602,8 @@ paths:
|
||||
x-signoz-stability: alpha
|
||||
/api/v1/channels/{id}:
|
||||
delete:
|
||||
deprecated: true
|
||||
description: 'Deprecated: use DELETE /api/v2/notification_channels/{id} instead.
|
||||
This endpoint deletes a notification channel by ID'
|
||||
deprecated: false
|
||||
description: This endpoint deletes a notification channel by ID
|
||||
operationId: DeleteChannelByID
|
||||
parameters:
|
||||
- in: path
|
||||
@@ -14727,9 +14648,8 @@ paths:
|
||||
- channels
|
||||
x-signoz-stability: alpha
|
||||
get:
|
||||
deprecated: true
|
||||
description: 'Deprecated: use GET /api/v2/notification_channels/{id} instead.
|
||||
This endpoint returns a notification channel by ID'
|
||||
deprecated: false
|
||||
description: This endpoint returns a notification channel by ID
|
||||
operationId: GetChannelByID
|
||||
parameters:
|
||||
- in: path
|
||||
@@ -14786,9 +14706,8 @@ paths:
|
||||
- channels
|
||||
x-signoz-stability: alpha
|
||||
put:
|
||||
deprecated: true
|
||||
description: 'Deprecated: use PUT /api/v2/notification_channels/{id} instead.
|
||||
This endpoint updates a notification channel by ID'
|
||||
deprecated: false
|
||||
description: This endpoint updates a notification channel by ID
|
||||
operationId: UpdateChannelByID
|
||||
parameters:
|
||||
- in: path
|
||||
@@ -14845,9 +14764,8 @@ paths:
|
||||
x-signoz-stability: alpha
|
||||
/api/v1/channels/test:
|
||||
post:
|
||||
deprecated: true
|
||||
description: 'Deprecated: use POST /api/v2/notification_channels/test instead.
|
||||
This endpoint tests a notification channel by sending a test notification'
|
||||
deprecated: false
|
||||
description: This endpoint tests a notification channel by sending a test notification
|
||||
operationId: TestChannel
|
||||
requestBody:
|
||||
content:
|
||||
|
||||
3
frontend/.gitignore
vendored
3
frontend/.gitignore
vendored
@@ -1,4 +1,7 @@
|
||||
|
||||
# Vite copies public/ unhashed, and the Go server caches /assets/ as immutable
|
||||
/public/assets/
|
||||
|
||||
# Sentry Config File
|
||||
.env.sentry-build-plugin
|
||||
.qodo
|
||||
|
||||
@@ -53,7 +53,6 @@ const EXCLUDED_PLUGINS = [
|
||||
'vite-plugin-checker',
|
||||
'dev-base-path',
|
||||
'dev-boot-data',
|
||||
'signoz:inline-boot-guard',
|
||||
'vite-plugin-compression',
|
||||
];
|
||||
|
||||
|
||||
@@ -42,10 +42,7 @@ const config: Config.InitialOptions = {
|
||||
'<rootDir>/node_modules/@signozhq/$1/dist/$1.js',
|
||||
},
|
||||
extensionsToTreatAsEsm: ['.ts'],
|
||||
testMatch: [
|
||||
'<rootDir>/src/**/*?(*.)(test).(ts|js)?(x)',
|
||||
'<rootDir>/vite-plugins/**/*.test.ts',
|
||||
],
|
||||
testMatch: ['<rootDir>/src/**/*?(*.)(test).(ts|js)?(x)'],
|
||||
preset: 'ts-jest/presets/js-with-ts-esm',
|
||||
transform: {
|
||||
'^.+\\.(ts|tsx)?$': [
|
||||
|
||||
@@ -68,8 +68,7 @@ const withQueryKey = <T extends object, K>(
|
||||
};
|
||||
|
||||
/**
|
||||
* Deprecated: use GET /api/v2/notification_channels instead. This endpoint lists all notification channels for the organization
|
||||
* @deprecated
|
||||
* This endpoint lists all notification channels for the organization
|
||||
* @summary List notification channels
|
||||
*/
|
||||
export const listChannels = (signal?: AbortSignal) => {
|
||||
@@ -115,7 +114,6 @@ export type ListChannelsQueryResult = NonNullable<
|
||||
export type ListChannelsQueryError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @summary List notification channels
|
||||
*/
|
||||
|
||||
@@ -139,7 +137,6 @@ export function useListChannels<
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @summary List notification channels
|
||||
*/
|
||||
export const invalidateListChannels = async (
|
||||
@@ -155,8 +152,7 @@ export const invalidateListChannels = async (
|
||||
};
|
||||
|
||||
/**
|
||||
* Deprecated: use POST /api/v2/notification_channels instead. This endpoint creates a notification channel
|
||||
* @deprecated
|
||||
* This endpoint creates a notification channel
|
||||
* @summary Create notification channel
|
||||
*/
|
||||
export const createChannel = (
|
||||
@@ -218,7 +214,6 @@ export type CreateChannelMutationBody =
|
||||
export type CreateChannelMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @summary Create notification channel
|
||||
*/
|
||||
export const useCreateChannel = <
|
||||
@@ -240,8 +235,7 @@ export const useCreateChannel = <
|
||||
return useMutation(getCreateChannelMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Deprecated: use DELETE /api/v2/notification_channels/{id} instead. This endpoint deletes a notification channel by ID
|
||||
* @deprecated
|
||||
* This endpoint deletes a notification channel by ID
|
||||
* @summary Delete notification channel
|
||||
*/
|
||||
export const deleteChannelByID = (
|
||||
@@ -299,7 +293,6 @@ export type DeleteChannelByIDMutationResult = NonNullable<
|
||||
export type DeleteChannelByIDMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @summary Delete notification channel
|
||||
*/
|
||||
export const useDeleteChannelByID = <
|
||||
@@ -321,8 +314,7 @@ export const useDeleteChannelByID = <
|
||||
return useMutation(getDeleteChannelByIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Deprecated: use GET /api/v2/notification_channels/{id} instead. This endpoint returns a notification channel by ID
|
||||
* @deprecated
|
||||
* This endpoint returns a notification channel by ID
|
||||
* @summary Get notification channel by ID
|
||||
*/
|
||||
export const getChannelByID = (
|
||||
@@ -381,7 +373,6 @@ export type GetChannelByIDQueryResult = NonNullable<
|
||||
export type GetChannelByIDQueryError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @summary Get notification channel by ID
|
||||
*/
|
||||
|
||||
@@ -408,7 +399,6 @@ export function useGetChannelByID<
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @summary Get notification channel by ID
|
||||
*/
|
||||
export const invalidateGetChannelByID = async (
|
||||
@@ -425,8 +415,7 @@ export const invalidateGetChannelByID = async (
|
||||
};
|
||||
|
||||
/**
|
||||
* Deprecated: use PUT /api/v2/notification_channels/{id} instead. This endpoint updates a notification channel by ID
|
||||
* @deprecated
|
||||
* This endpoint updates a notification channel by ID
|
||||
* @summary Update notification channel
|
||||
*/
|
||||
export const updateChannelByID = (
|
||||
@@ -498,7 +487,6 @@ export type UpdateChannelByIDMutationBody =
|
||||
export type UpdateChannelByIDMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @summary Update notification channel
|
||||
*/
|
||||
export const useUpdateChannelByID = <
|
||||
@@ -526,8 +514,7 @@ export const useUpdateChannelByID = <
|
||||
return useMutation(getUpdateChannelByIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Deprecated: use POST /api/v2/notification_channels/test instead. This endpoint tests a notification channel by sending a test notification
|
||||
* @deprecated
|
||||
* This endpoint tests a notification channel by sending a test notification
|
||||
* @summary Test notification channel
|
||||
*/
|
||||
export const testChannel = (
|
||||
@@ -589,7 +576,6 @@ export type TestChannelMutationBody =
|
||||
export type TestChannelMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @summary Test notification channel
|
||||
*/
|
||||
export const useTestChannel = <
|
||||
|
||||
@@ -7270,7 +7270,6 @@ export enum Querybuildertypesv5RequestTypeDTO {
|
||||
raw_stream = 'raw_stream',
|
||||
trace = 'trace',
|
||||
heatmap = 'heatmap',
|
||||
pattern = 'pattern',
|
||||
distribution = 'distribution',
|
||||
}
|
||||
/**
|
||||
@@ -12191,76 +12190,6 @@ export interface Querybuildertypesv5FormatOptionsDTO {
|
||||
formatTableResultForUI?: boolean;
|
||||
}
|
||||
|
||||
export interface Querybuildertypesv5PatternTrendPointDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description The number of logs of the pattern in the step, scaled up by sampleRate.
|
||||
*/
|
||||
count: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @format int64
|
||||
* @description The Unix time in milliseconds the step starts at.
|
||||
*/
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
export interface Querybuildertypesv5PatternDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description The number of logs of the pattern in the time range, scaled up by sampleRate.
|
||||
*/
|
||||
count: number;
|
||||
/**
|
||||
* @type string
|
||||
* @description The pattern's ID: the decimal 64-bit FNV-1a hash of its template.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description The pattern's template: the log message with the values that change replaced by <*>. Empty when the template is not known yet.
|
||||
*/
|
||||
pattern: string;
|
||||
/**
|
||||
* @type number
|
||||
* @format double
|
||||
* @description The pattern's count as a percentage of total.
|
||||
*/
|
||||
percent: number;
|
||||
/**
|
||||
* @type array,null
|
||||
* @description The number of logs of the pattern in each step of the time range, oldest first. Steps without a log are left out.
|
||||
*/
|
||||
trend: Querybuildertypesv5PatternTrendPointDTO[] | null;
|
||||
}
|
||||
|
||||
export interface Querybuildertypesv5PatternsDataDTO {
|
||||
/**
|
||||
* @type array,null
|
||||
* @description The patterns, most logs first.
|
||||
*/
|
||||
patterns: Querybuildertypesv5PatternDTO[] | null;
|
||||
/**
|
||||
* @type string
|
||||
* @description The name of the query that produced this result.
|
||||
*/
|
||||
queryName: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description One in sampleRate of the matching logs was read and every count is scaled up by it. 1 means every log was read and the counts are exact.
|
||||
*/
|
||||
sampleRate: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description The number of matching logs that have a pattern, over every pattern.
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface TelemetrystoretypesIndexStepDTO {
|
||||
/**
|
||||
* @type string
|
||||
@@ -12467,35 +12396,28 @@ export type Querybuildertypesv5QueryDataDTO =
|
||||
| (Querybuildertypesv5TimeSeriesDataDTO & {
|
||||
/**
|
||||
* @type array,null
|
||||
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
|
||||
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw and DistributionData for distribution requests.
|
||||
*/
|
||||
results?: unknown[] | null;
|
||||
})
|
||||
| (Querybuildertypesv5ScalarDataDTO & {
|
||||
/**
|
||||
* @type array,null
|
||||
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
|
||||
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw and DistributionData for distribution requests.
|
||||
*/
|
||||
results?: unknown[] | null;
|
||||
})
|
||||
| (Querybuildertypesv5RawDataDTO & {
|
||||
/**
|
||||
* @type array,null
|
||||
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
|
||||
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw and DistributionData for distribution requests.
|
||||
*/
|
||||
results?: unknown[] | null;
|
||||
})
|
||||
| (Querybuildertypesv5DistributionDataDTO & {
|
||||
/**
|
||||
* @type array,null
|
||||
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
|
||||
*/
|
||||
results?: unknown[] | null;
|
||||
})
|
||||
| (Querybuildertypesv5PatternsDataDTO & {
|
||||
/**
|
||||
* @type array,null
|
||||
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
|
||||
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw and DistributionData for distribution requests.
|
||||
*/
|
||||
results?: unknown[] | null;
|
||||
});
|
||||
@@ -12629,7 +12551,7 @@ export interface Querybuildertypesv5QueryRangeRequestDTO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Response from the v5 query range endpoint. The data.results array contains typed results depending on the requestType: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution, or PatternsData for pattern requests.
|
||||
* Response from the v5 query range endpoint. The data.results array contains typed results depending on the requestType: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, or DistributionData for distribution requests.
|
||||
*/
|
||||
export interface Querybuildertypesv5QueryRangeResponseDTO {
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ApiV5Instance } from 'api';
|
||||
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
|
||||
import { AxiosError } from 'axios';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
|
||||
import {
|
||||
MetricRangePayloadV5,
|
||||
@@ -16,10 +17,24 @@ import {
|
||||
*/
|
||||
export const getQueryRangeV5 = async (
|
||||
props: QueryRangePayloadV5,
|
||||
version: string,
|
||||
signal?: AbortSignal,
|
||||
headers?: Record<string, string>,
|
||||
): Promise<SuccessResponseV2<MetricRangePayloadV5>> => {
|
||||
try {
|
||||
if (version && version === ENTITY_VERSION_V5) {
|
||||
const response = await ApiV5Instance.post('/query_range', props, {
|
||||
signal,
|
||||
headers,
|
||||
});
|
||||
|
||||
return {
|
||||
httpStatusCode: response.status,
|
||||
data: response.data,
|
||||
};
|
||||
}
|
||||
|
||||
// Default V5 behavior
|
||||
const response = await ApiV5Instance.post('/query_range', props, {
|
||||
signal,
|
||||
headers,
|
||||
@@ -27,7 +42,7 @@ export const getQueryRangeV5 = async (
|
||||
|
||||
return {
|
||||
httpStatusCode: response.status,
|
||||
data: response.data,
|
||||
data: response.data.data,
|
||||
};
|
||||
} catch (error) {
|
||||
ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);
|
||||
|
||||
@@ -124,7 +124,7 @@ function isDeprecatedField(fieldName: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
export function getFilter(queryData: IBuilderQuery): Filter {
|
||||
function getFilter(queryData: IBuilderQuery): Filter {
|
||||
const { filter } = queryData;
|
||||
if (filter?.expression) {
|
||||
return {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useAppLocation } from 'lib/router/useAppLocation';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { ViewMenuAction } from 'container/WidgetCard/config';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import GridCard from 'container/WidgetCard/Card';
|
||||
import { Card } from 'container/WidgetCard/styles';
|
||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||
@@ -178,6 +179,7 @@ function CeleryTaskBar({
|
||||
{barState === CeleryTaskState.All && (
|
||||
<GridCard
|
||||
widget={celeryAllStateFilteredData}
|
||||
version={ENTITY_VERSION_V5}
|
||||
headerMenuList={[...ViewMenuAction]}
|
||||
onDragSelect={onDragSelect}
|
||||
isQueryEnabled={queryEnabled}
|
||||
@@ -199,6 +201,7 @@ function CeleryTaskBar({
|
||||
{barState === CeleryTaskState.Failed && (
|
||||
<GridCard
|
||||
widget={celeryFailedStateFilteredData}
|
||||
version={ENTITY_VERSION_V5}
|
||||
headerMenuList={[...ViewMenuAction]}
|
||||
onDragSelect={onDragSelect}
|
||||
isQueryEnabled={queryEnabled}
|
||||
@@ -219,6 +222,7 @@ function CeleryTaskBar({
|
||||
{barState === CeleryTaskState.Retry && (
|
||||
<GridCard
|
||||
widget={celeryRetryStateFilteredData}
|
||||
version={ENTITY_VERSION_V5}
|
||||
headerMenuList={[...ViewMenuAction]}
|
||||
onDragSelect={onDragSelect}
|
||||
isQueryEnabled={queryEnabled}
|
||||
@@ -239,6 +243,7 @@ function CeleryTaskBar({
|
||||
{barState === CeleryTaskState.Successful && (
|
||||
<GridCard
|
||||
widget={celerySuccessStateFilteredData}
|
||||
version={ENTITY_VERSION_V5}
|
||||
headerMenuList={[...ViewMenuAction]}
|
||||
onDragSelect={onDragSelect}
|
||||
isQueryEnabled={queryEnabled}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { navigate } from 'lib/router/navigation';
|
||||
import { useAppLocation } from 'lib/router/useAppLocation';
|
||||
import { QueryParams } from 'constants/query';
|
||||
@@ -136,6 +137,7 @@ function CeleryTaskGraph({
|
||||
isQueryEnabled={queryEnabled}
|
||||
openTracesButton={openTracesButton}
|
||||
onOpenTraceBtnClick={onOpenTraceBtnClick}
|
||||
version={ENTITY_VERSION_V5}
|
||||
customErrorMessage={customErrorMessage}
|
||||
start={start}
|
||||
end={end}
|
||||
|
||||
@@ -9,6 +9,7 @@ import logEvent from 'api/common/logEvent';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { ViewMenuAction } from 'container/WidgetCard/config';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import GridCard from 'container/WidgetCard/Card';
|
||||
import { Card } from 'container/WidgetCard/styles';
|
||||
import { Button } from 'container/MetricsApplication/Tabs/styles';
|
||||
@@ -201,6 +202,7 @@ function CeleryTaskLatencyGraph({
|
||||
</Button>
|
||||
<GridCard
|
||||
widget={updatedWidgetData}
|
||||
version={ENTITY_VERSION_V5}
|
||||
headerMenuList={[...ViewMenuAction]}
|
||||
onDragSelect={onDragSelect}
|
||||
onClickHandler={onGraphClick('Celery_p99_latency')}
|
||||
@@ -222,6 +224,7 @@ function CeleryTaskLatencyGraph({
|
||||
</Button>
|
||||
<GridCard
|
||||
widget={updatedWidgetData}
|
||||
version={ENTITY_VERSION_V5}
|
||||
headerMenuList={[...ViewMenuAction]}
|
||||
onDragSelect={onDragSelect}
|
||||
onClickHandler={onGraphClick('Celery_p95_latency')}
|
||||
@@ -242,6 +245,7 @@ function CeleryTaskLatencyGraph({
|
||||
</Button>
|
||||
<GridCard
|
||||
widget={updatedWidgetData}
|
||||
version={ENTITY_VERSION_V5}
|
||||
headerMenuList={[...ViewMenuAction]}
|
||||
onDragSelect={onDragSelect}
|
||||
onClickHandler={onGraphClick('Celery_p90_latency')}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useCallback } from 'react';
|
||||
import { useQueries } from 'react-query';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useSelector } from 'react-redux';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
||||
import {
|
||||
@@ -41,9 +42,9 @@ export const useGetValueFromWidget = (
|
||||
|
||||
const queries = useQueries(
|
||||
queryPayloads().map((payload) => ({
|
||||
queryKey: [...queryKey, payload],
|
||||
queryKey: [...queryKey, payload, ENTITY_VERSION_V5],
|
||||
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
|
||||
GetMetricQueryRange(payload),
|
||||
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
|
||||
enabled: !!payload,
|
||||
})),
|
||||
);
|
||||
|
||||
@@ -21,4 +21,9 @@
|
||||
line-height: var(--paragraph-small-400-line-height);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&__helper {
|
||||
color: var(--l3-foreground);
|
||||
margin: calc(var(--spacing-2) * -1) 0 var(--spacing-4) 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
.actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-4);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { Fragment } from 'react';
|
||||
|
||||
import type { HeaderAction } from './DetailsHeader';
|
||||
|
||||
import styles from './HeaderActions.module.scss';
|
||||
|
||||
interface HeaderActionsProps {
|
||||
actions: HeaderAction[];
|
||||
}
|
||||
|
||||
function HeaderActions({ actions }: HeaderActionsProps): JSX.Element {
|
||||
return (
|
||||
<div className={styles.actions}>
|
||||
{actions.map((action) => (
|
||||
<Fragment key={action.key}>{action.component}</Fragment>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default HeaderActions;
|
||||
@@ -1,6 +1,4 @@
|
||||
import { Drawer } from '@signozhq/ui/drawer';
|
||||
import type { HeaderAction } from 'components/DetailsPanel/DetailsHeader/DetailsHeader';
|
||||
import HeaderActions from 'components/DetailsPanel/DetailsHeader/HeaderActions';
|
||||
|
||||
import { LogDetailProps } from './LogDetail.interfaces';
|
||||
import LogDetailBody from './LogDetailBody';
|
||||
@@ -36,34 +34,6 @@ function LogDetail({
|
||||
|
||||
const title = useLogTimestamp(shownLog);
|
||||
|
||||
const headerActions: HeaderAction[] = [
|
||||
...(shownLog
|
||||
? [
|
||||
{
|
||||
key: 'log-actions',
|
||||
component: (
|
||||
<LogActions
|
||||
log={shownLog}
|
||||
showOpenInExplorer={!!handleOpenInExplorer}
|
||||
onOpenInExplorer={handleOpenInExplorer}
|
||||
/>
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
key: 'navigation',
|
||||
component: (
|
||||
<LogNavigation
|
||||
onNavigatePrev={goToPrev}
|
||||
onNavigateNext={goToNext}
|
||||
isPrevDisabled={isPrevDisabled}
|
||||
isNextDisabled={isNextDisabled}
|
||||
/>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
type="inspector"
|
||||
@@ -73,7 +43,23 @@ function LogDetail({
|
||||
title={title}
|
||||
width="extra-wide"
|
||||
closePosition="start"
|
||||
headerSuffix={<HeaderActions actions={headerActions} />}
|
||||
headerSuffix={
|
||||
<>
|
||||
{shownLog && (
|
||||
<LogActions
|
||||
log={shownLog}
|
||||
showOpenInExplorer={!!handleOpenInExplorer}
|
||||
onOpenInExplorer={handleOpenInExplorer}
|
||||
/>
|
||||
)}
|
||||
<LogNavigation
|
||||
onNavigatePrev={goToPrev}
|
||||
onNavigateNext={goToNext}
|
||||
isPrevDisabled={isPrevDisabled}
|
||||
isNextDisabled={isNextDisabled}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
testId="log-detail-drawer"
|
||||
>
|
||||
{shownLog && (
|
||||
|
||||
@@ -433,6 +433,7 @@ function QueryAddOns({
|
||||
query={query}
|
||||
onChange={handleChangeOrderByKeys}
|
||||
isRawQuery={isRawQuery}
|
||||
isNewQueryV2
|
||||
panelType={panelType ?? undefined}
|
||||
placeholder={placeholderOf(QueryBuilderField.OrderBy)}
|
||||
/>
|
||||
|
||||
@@ -192,7 +192,8 @@ export const QueryV2 = forwardRef(function QueryV2(
|
||||
!functions.hidden &&
|
||||
(query.dataSource === DataSource.LOGS ||
|
||||
query.dataSource === DataSource.METRICS ||
|
||||
hasQueryFunctions)
|
||||
hasQueryFunctions ||
|
||||
false)
|
||||
}
|
||||
areFunctionsDisabled={functions.disabled}
|
||||
functionsDisabledReason={functions.reason}
|
||||
|
||||
@@ -73,14 +73,6 @@ const formatSingleValue = (v: string | number | boolean): string => {
|
||||
return String(v);
|
||||
};
|
||||
|
||||
/**
|
||||
* Quotes text as a filter expression string literal, escaping backslashes and
|
||||
* single quotes so the text round-trips exactly. Unlike formatValueForExpression,
|
||||
* it never treats the text as already quoted or as a variable.
|
||||
*/
|
||||
export const formatStringLiteralForExpression = (value: string): string =>
|
||||
`'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
|
||||
|
||||
/**
|
||||
* Format a value for the expression string
|
||||
* @param value - The value to format
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
} from '@dnd-kit/sortable';
|
||||
import { CSS } from '@dnd-kit/utilities';
|
||||
import { Button } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||
import { GripVertical } from '@signozhq/icons';
|
||||
import { TelemetryFieldKey } from 'types/api/v5/queryRange';
|
||||
@@ -47,17 +46,7 @@ function SortableFilter({
|
||||
>
|
||||
<div {...attributes} {...listeners} className="drag-handle">
|
||||
{allowDrag && <GripVertical size={16} />}
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="inherit"
|
||||
as="span"
|
||||
display="block"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{filter.name}
|
||||
</Typography>
|
||||
{filter.name}
|
||||
</div>
|
||||
{allowRemove && (
|
||||
<Button
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Button, Skeleton } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import {
|
||||
QuickfiltertypesSourceDTO,
|
||||
TelemetrytypesSourceDTO,
|
||||
@@ -99,17 +98,7 @@ function OtherFilters({
|
||||
|
||||
return otherFilters.map((filter) => (
|
||||
<div key={filter.key} className="qf-filter-item other-filters-item">
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="inherit"
|
||||
as="span"
|
||||
display="block"
|
||||
textOverflow="ellipsis"
|
||||
>
|
||||
{filter.name}
|
||||
</Typography>
|
||||
<div className="qf-filter-key">{filter.name}</div>
|
||||
<Button
|
||||
className="add-filter-btn periscope-btn"
|
||||
size="small"
|
||||
|
||||
@@ -132,11 +132,6 @@
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-grow: 1;
|
||||
min-width: 0;
|
||||
|
||||
> svg {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.qf-filter-content {
|
||||
@@ -163,7 +158,6 @@
|
||||
|
||||
.remove-filter-btn,
|
||||
.add-filter-btn {
|
||||
flex-shrink: 0;
|
||||
padding: 6px 12px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
|
||||
@@ -90,35 +90,6 @@ export const handlers = [
|
||||
fieldValuesHandler(['checkout', 'frontend', 'payments']),
|
||||
];
|
||||
|
||||
const LONG_FILTER_NAME =
|
||||
'gen_ai.response.tool_calls.0.tool_call.function.arguments';
|
||||
|
||||
/** One added and one other filter whose names are wider than the settings panel. */
|
||||
export const longFilterNameHandlers = [
|
||||
rest.get('http://localhost/api/v2/quick_filters/logs', (_req, res, ctx) =>
|
||||
res(
|
||||
ctx.status(200),
|
||||
ctx.json(
|
||||
quickFiltersResponse(QuickfiltertypesSourceDTO.logs, [
|
||||
...customFilters,
|
||||
{
|
||||
name: LONG_FILTER_NAME,
|
||||
fieldDataType: TelemetrytypesFieldDataTypeDTO.string,
|
||||
fieldContext: TelemetrytypesFieldContextDTO.attribute,
|
||||
},
|
||||
]),
|
||||
),
|
||||
),
|
||||
),
|
||||
rest.get('http://localhost/api/v1/fields/keys', (_req, res, ctx) =>
|
||||
res(
|
||||
ctx.status(200),
|
||||
ctx.json(fieldKeysResponse([`${LONG_FILTER_NAME}.raw`])),
|
||||
),
|
||||
),
|
||||
...handlers,
|
||||
];
|
||||
|
||||
export const noSavedFiltersHandler = rest.get(
|
||||
'http://localhost/api/v2/quick_filters/logs',
|
||||
(_req, res, ctx) =>
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
hoverTruncatedTitle,
|
||||
openQueryPicker,
|
||||
openSettings,
|
||||
showsLongFilterNames,
|
||||
} from './__story_mockdata__/quickFilters.play';
|
||||
import {
|
||||
checkboxConfig,
|
||||
@@ -20,7 +19,6 @@ import {
|
||||
handlers,
|
||||
LONG_FILTER_VALUES,
|
||||
loadingFiltersHandlers,
|
||||
longFilterNameHandlers,
|
||||
longTitleConfig,
|
||||
MANY_FILTER_VALUES,
|
||||
queryBuilder,
|
||||
@@ -67,12 +65,6 @@ export const SettingsOpen: GlobalArgsStory = {
|
||||
play: openSettings,
|
||||
};
|
||||
|
||||
/** Settings with filter names wider than the panel: each name is cut with an ellipsis and its action stays in view. */
|
||||
export const SettingsLongFilterNames: GlobalArgsStory = {
|
||||
parameters: { msw: { handlers: longFilterNameHandlers } },
|
||||
play: showsLongFilterNames,
|
||||
};
|
||||
|
||||
/** Mutation: changing the settings list reveals the fixed save and discard footer. */
|
||||
export const SettingsDirtyFooter: GlobalArgsStory = {
|
||||
play: dirtySettings,
|
||||
|
||||
@@ -64,32 +64,6 @@ export const dirtySettings = async (context: PlayContext): Promise<void> => {
|
||||
await screen.findByRole('button', { name: 'Save changes' });
|
||||
};
|
||||
|
||||
/** Every Add and Remove sits inside its list: a long name is cut, not scrolled. */
|
||||
export const showsLongFilterNames = async (
|
||||
context: PlayContext,
|
||||
): Promise<void> => {
|
||||
if (!canManageQuickFilters(context.args)) {
|
||||
return;
|
||||
}
|
||||
|
||||
await openSettings(context);
|
||||
await Promise.all(
|
||||
['quick-filters-added', 'quick-filters-other'].map(async (testId) => {
|
||||
const list = await screen.findByTestId(testId);
|
||||
const actions = await within(list).findAllByRole(
|
||||
'button',
|
||||
{ name: /^(Add|Remove)$/ },
|
||||
UNTIL_LOADED,
|
||||
);
|
||||
const listRight = list.getBoundingClientRect().right;
|
||||
|
||||
actions.forEach((action) => {
|
||||
expect(action.getBoundingClientRect().right).toBeLessThanOrEqual(listRight);
|
||||
});
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
export const hoverTruncatedTitle = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
|
||||
@@ -18,6 +18,18 @@
|
||||
letter-spacing: -0.07px;
|
||||
}
|
||||
|
||||
&__input {
|
||||
height: 32px;
|
||||
background: var(--l2-background);
|
||||
border-color: var(--l1-border);
|
||||
color: var(--l1-foreground);
|
||||
box-shadow: none;
|
||||
|
||||
&::placeholder {
|
||||
color: var(--l3-foreground);
|
||||
}
|
||||
}
|
||||
|
||||
&__datepicker {
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
@@ -88,4 +100,11 @@
|
||||
text-transform: uppercase;
|
||||
margin-bottom: var(--spacing-4);
|
||||
}
|
||||
|
||||
&__learn-more {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-1);
|
||||
color: var(--primary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ export enum QueryParams {
|
||||
tab = 'tab',
|
||||
thresholds = 'thresholds',
|
||||
selectedExplorerView = 'selectedExplorerView',
|
||||
logsExplorerView = 'logsExplorerView',
|
||||
variables = 'variables',
|
||||
version = 'version',
|
||||
source = 'source',
|
||||
|
||||
@@ -12,7 +12,6 @@ export const REACT_QUERY_KEY = {
|
||||
GET_PUBLIC_DASHBOARD_WIDGET_DATA: 'GET_PUBLIC_DASHBOARD_WIDGET_DATA',
|
||||
GET_ALL_LICENCES: 'GET_ALL_LICENCES',
|
||||
GET_QUERY_RANGE: 'GET_QUERY_RANGE',
|
||||
GET_LOG_PATTERNS: 'GET_LOG_PATTERNS',
|
||||
GET_ALL_DASHBOARDS: 'GET_ALL_DASHBOARDS',
|
||||
GET_TRIGGERED_ALERTS: 'GET_TRIGGERED_ALERTS',
|
||||
DASHBOARD_BY_ID: 'DASHBOARD_BY_ID',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import QuerySearch from 'components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch';
|
||||
import { combineInitialAndUserExpression } from 'components/QueryBuilderV2/QueryV2/QuerySearch/utils';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import {
|
||||
getAllEndpointsWidgetData,
|
||||
getGroupByExpressionFromRowData,
|
||||
@@ -155,6 +156,7 @@ function AllEndPoints({
|
||||
customOnDragSelect={(): void => {}}
|
||||
customTimeRange={timeRange}
|
||||
customOnRowClick={onRowClick}
|
||||
version={ENTITY_VERSION_V5}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useCallback, useMemo } from 'react';
|
||||
import { useQueries } from 'react-query';
|
||||
import QuerySearch from 'components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch';
|
||||
import { combineInitialAndUserExpression } from 'components/QueryBuilderV2/QueryV2/QuerySearch/utils';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import {
|
||||
END_POINT_DETAILS_QUERY_KEYS_ARRAY,
|
||||
@@ -92,9 +93,13 @@ function EndPointDetails({
|
||||
|
||||
const endPointDetailsDataQueries = useQueries(
|
||||
endPointDetailsQueryPayload.map((payload, index) => ({
|
||||
queryKey: [END_POINT_DETAILS_QUERY_KEYS_ARRAY[index], payload],
|
||||
queryKey: [
|
||||
END_POINT_DETAILS_QUERY_KEYS_ARRAY[index],
|
||||
payload,
|
||||
ENTITY_VERSION_V5,
|
||||
],
|
||||
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
|
||||
GetMetricQueryRange(payload),
|
||||
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
|
||||
enabled: !!payload,
|
||||
// Keeps the table's rows, and so its height, while a new filter loads
|
||||
keepPreviousData:
|
||||
|
||||
@@ -9,6 +9,7 @@ import { MetricRangePayloadV5, ScalarData } from 'api/v5/v5';
|
||||
import { useNavigateToExplorer } from 'components/CeleryTask/useNavigateToExplorer';
|
||||
import { combineInitialAndUserExpression } from 'components/QueryBuilderV2/QueryV2/QuerySearch/utils';
|
||||
import { withErrorBoundary } from 'components/ErrorBoundaryHOC';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import {
|
||||
formatTopErrorsDataForTable,
|
||||
@@ -75,12 +76,13 @@ function TopErrors({
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.GET_TOP_ERRORS_BY_DOMAIN,
|
||||
queryPayload,
|
||||
ENTITY_VERSION_V5,
|
||||
showStatusCodeErrors,
|
||||
],
|
||||
queryFn: ({
|
||||
signal,
|
||||
}: QueryFunctionContext): Promise<SuccessResponseV2<MetricRangePayloadV5>> =>
|
||||
getQueryRangeV5(queryPayload, signal),
|
||||
getQueryRangeV5(queryPayload, ENTITY_VERSION_V5, signal),
|
||||
enabled: !!queryPayload,
|
||||
staleTime: 0,
|
||||
cacheTime: 0,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { QueryClient, QueryClientProvider } from 'react-query';
|
||||
import { render, screen, waitFor } from 'tests/test-utils';
|
||||
import { TraceAggregation } from 'api/v5/v5';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
||||
import { MetricQueryRangeSuccessResponse } from 'types/api/metrics/getQueryRange';
|
||||
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
||||
|
||||
import { SPAN_ATTRIBUTES } from '../constants';
|
||||
import DomainMetrics from './DomainMetrics';
|
||||
@@ -13,33 +12,6 @@ jest.mock('lib/dashboard/getQueryResults', () => ({
|
||||
GetMetricQueryRange: jest.fn(),
|
||||
}));
|
||||
|
||||
const mockGetMetricQueryRange = jest.mocked(GetMetricQueryRange);
|
||||
|
||||
const buildResponse = (
|
||||
rows: { data: Record<string, string> }[],
|
||||
): MetricQueryRangeSuccessResponse => ({
|
||||
statusCode: 200,
|
||||
message: 'success',
|
||||
error: null,
|
||||
payload: {
|
||||
data: {
|
||||
resultType: '',
|
||||
newResult: { data: { result: [], resultType: '' } },
|
||||
result: [
|
||||
{ queryName: 'A', metric: {}, values: [], table: { rows, columns: [] } },
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const findQuery = (queryData: IBuilderQuery[], name: string): IBuilderQuery => {
|
||||
const query = queryData.find((q) => q.queryName === name);
|
||||
if (!query) {
|
||||
throw new Error(`Query ${name} missing from the payload`);
|
||||
}
|
||||
return query;
|
||||
};
|
||||
|
||||
// Mock ErrorState component
|
||||
jest.mock('./ErrorState', () => ({
|
||||
__esModule: true,
|
||||
@@ -64,16 +36,30 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
|
||||
domainListFilterExpression: '',
|
||||
};
|
||||
|
||||
const mockSuccessResponse = buildResponse([
|
||||
{
|
||||
const mockSuccessResponse = {
|
||||
statusCode: 200,
|
||||
error: null,
|
||||
payload: {
|
||||
data: {
|
||||
A: '150',
|
||||
B: '125000000',
|
||||
D: '2021-01-01T23:00:00Z',
|
||||
F1: '5.5',
|
||||
result: [
|
||||
{
|
||||
table: {
|
||||
rows: [
|
||||
{
|
||||
data: {
|
||||
A: '150',
|
||||
B: '125000000',
|
||||
D: '2021-01-01T23:00:00Z',
|
||||
F1: '5.5',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
queryClient = new QueryClient({
|
||||
@@ -100,7 +86,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
|
||||
|
||||
describe('1. V5 Query Payload with Filters', () => {
|
||||
it('sends correct V5 payload structure with domain name filters', async () => {
|
||||
mockGetMetricQueryRange.mockResolvedValue(mockSuccessResponse);
|
||||
(GetMetricQueryRange as jest.Mock).mockResolvedValue(mockSuccessResponse);
|
||||
|
||||
renderComponent();
|
||||
|
||||
@@ -108,7 +94,10 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
|
||||
expect(GetMetricQueryRange).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
const [payload] = mockGetMetricQueryRange.mock.calls[0];
|
||||
const [payload, version] = (GetMetricQueryRange as jest.Mock).mock.calls[0];
|
||||
|
||||
// Verify it's using V5
|
||||
expect(version).toBe(ENTITY_VERSION_V5);
|
||||
|
||||
// Verify time range
|
||||
expect(payload.start).toBe(1758259531000);
|
||||
@@ -122,60 +111,64 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
|
||||
const queryData = payload.query.builder.queryData;
|
||||
|
||||
// Verify Query A - count with URL filter
|
||||
const queryA = findQuery(queryData, 'A');
|
||||
const queryA = queryData.find((q: any) => q.queryName === 'A');
|
||||
expect(queryA).toBeDefined();
|
||||
expect(queryA.dataSource).toBe('traces');
|
||||
expect(queryA.aggregations?.[0]).toBeDefined();
|
||||
expect((queryA.aggregations?.[0] as TraceAggregation)?.expression).toBe(
|
||||
'count()',
|
||||
);
|
||||
// Verify exact domain filter expression structure
|
||||
expect(queryA.filter?.expression).toContain("http_host = '0.0.0.0'");
|
||||
expect(queryA.filter?.expression).toContain(
|
||||
expect(queryA.filter.expression).toContain("http_host = '0.0.0.0'");
|
||||
expect(queryA.filter.expression).toContain(
|
||||
`${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
|
||||
);
|
||||
|
||||
// Verify Query B - p99 latency
|
||||
const queryB = findQuery(queryData, 'B');
|
||||
const queryB = queryData.find((q: any) => q.queryName === 'B');
|
||||
expect(queryB).toBeDefined();
|
||||
expect(queryB.aggregateOperator).toBe('p99');
|
||||
expect(queryB.aggregations?.[0]).toBeDefined();
|
||||
expect((queryB.aggregations?.[0] as TraceAggregation)?.expression).toBe(
|
||||
'p99(duration_nano)',
|
||||
);
|
||||
// Verify exact domain filter expression structure
|
||||
expect(queryB.filter?.expression).toContain("http_host = '0.0.0.0'");
|
||||
expect(queryB.filter.expression).toContain("http_host = '0.0.0.0'");
|
||||
|
||||
// Verify Query C - error count (disabled)
|
||||
const queryC = findQuery(queryData, 'C');
|
||||
const queryC = queryData.find((q: any) => q.queryName === 'C');
|
||||
expect(queryC).toBeDefined();
|
||||
expect(queryC.disabled).toBe(true);
|
||||
expect(queryC.filter?.expression).toContain("http_host = '0.0.0.0'");
|
||||
expect(queryC.filter.expression).toContain("http_host = '0.0.0.0'");
|
||||
expect(queryC.aggregations?.[0]).toBeDefined();
|
||||
expect((queryC.aggregations?.[0] as TraceAggregation)?.expression).toBe(
|
||||
'count()',
|
||||
);
|
||||
|
||||
expect(queryC.filter?.expression).toContain('has_error = true');
|
||||
expect(queryC.filter.expression).toContain('has_error = true');
|
||||
|
||||
// Verify Query D - max timestamp
|
||||
const queryD = findQuery(queryData, 'D');
|
||||
const queryD = queryData.find((q: any) => q.queryName === 'D');
|
||||
expect(queryD).toBeDefined();
|
||||
expect(queryD.aggregateOperator).toBe('max');
|
||||
expect(queryD.aggregations?.[0]).toBeDefined();
|
||||
expect((queryD.aggregations?.[0] as TraceAggregation)?.expression).toBe(
|
||||
'max(timestamp)',
|
||||
);
|
||||
// Verify exact domain filter expression structure
|
||||
expect(queryD.filter?.expression).toContain("http_host = '0.0.0.0'");
|
||||
expect(queryD.filter.expression).toContain("http_host = '0.0.0.0'");
|
||||
|
||||
// Verify Formula F1 - error rate calculation
|
||||
const formulas = payload.query.builder.queryFormulas;
|
||||
expect(formulas).toBeDefined();
|
||||
expect(formulas.length).toBeGreaterThan(0);
|
||||
const formulaF1 = formulas.find((f) => f.queryName === 'F1');
|
||||
const formulaF1 = formulas.find((f: any) => f.queryName === 'F1');
|
||||
expect(formulaF1).toBeDefined();
|
||||
expect(formulaF1?.expression).toBe('(C/A)*100');
|
||||
expect(formulaF1.expression).toBe('(C/A)*100');
|
||||
});
|
||||
|
||||
it('includes custom filters in filter expressions', async () => {
|
||||
mockGetMetricQueryRange.mockResolvedValue(mockSuccessResponse);
|
||||
(GetMetricQueryRange as jest.Mock).mockResolvedValue(mockSuccessResponse);
|
||||
|
||||
const customFilterExpression =
|
||||
"service.name = 'my-service' AND deployment.environment = 'production'";
|
||||
@@ -189,21 +182,24 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
|
||||
expect(GetMetricQueryRange).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
const [payload] = mockGetMetricQueryRange.mock.calls[0];
|
||||
const [payload] = (GetMetricQueryRange as jest.Mock).mock.calls[0];
|
||||
const queryData = payload.query.builder.queryData;
|
||||
|
||||
// Verify all queries include the custom filters
|
||||
const expressions = queryData.map((query) => query.filter?.expression);
|
||||
expect(expressions).toHaveLength(4);
|
||||
expressions.forEach((expression) => {
|
||||
expect(expression).toContain(customFilterExpression);
|
||||
queryData.forEach((query: any) => {
|
||||
if (query.filter && query.filter.expression) {
|
||||
expect(query.filter.expression).toContain('service.name');
|
||||
expect(query.filter.expression).toContain('my-service');
|
||||
expect(query.filter.expression).toContain('deployment.environment');
|
||||
expect(query.filter.expression).toContain('production');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('2. Data Display State', () => {
|
||||
it('displays metrics when data is successfully loaded', async () => {
|
||||
mockGetMetricQueryRange.mockResolvedValue(mockSuccessResponse);
|
||||
(GetMetricQueryRange as jest.Mock).mockResolvedValue(mockSuccessResponse);
|
||||
|
||||
renderComponent();
|
||||
|
||||
@@ -224,9 +220,23 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
|
||||
|
||||
describe('3. Empty/Missing Data State', () => {
|
||||
it('displays "-" for missing data values', async () => {
|
||||
const emptyResponse = buildResponse([]);
|
||||
const emptyResponse = {
|
||||
statusCode: 200,
|
||||
error: null,
|
||||
payload: {
|
||||
data: {
|
||||
result: [
|
||||
{
|
||||
table: {
|
||||
rows: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
mockGetMetricQueryRange.mockResolvedValue(emptyResponse);
|
||||
(GetMetricQueryRange as jest.Mock).mockResolvedValue(emptyResponse);
|
||||
|
||||
renderComponent();
|
||||
|
||||
@@ -238,7 +248,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
|
||||
|
||||
describe('4. Error State', () => {
|
||||
it('displays error state when API call fails', async () => {
|
||||
mockGetMetricQueryRange.mockRejectedValue(new Error('API Error'));
|
||||
(GetMetricQueryRange as jest.Mock).mockRejectedValue(new Error('API Error'));
|
||||
|
||||
renderComponent();
|
||||
|
||||
@@ -251,7 +261,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
|
||||
|
||||
it('retries API call when retry button is clicked', async () => {
|
||||
let callCount = 0;
|
||||
mockGetMetricQueryRange.mockImplementation(() => {
|
||||
(GetMetricQueryRange as jest.Mock).mockImplementation(() => {
|
||||
callCount += 1;
|
||||
if (callCount === 1) {
|
||||
return Promise.reject(new Error('API Error'));
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useQueries } from 'react-query';
|
||||
import { Skeleton, Tooltip } from 'antd';
|
||||
import { Progress } from '@signozhq/ui/progress';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import {
|
||||
DomainMetricsResponseRow,
|
||||
@@ -40,9 +41,13 @@ function DomainMetrics({
|
||||
// Since only one query here
|
||||
const domainMetricsDataQueries = useQueries(
|
||||
queryPayloads.map((payload) => ({
|
||||
queryKey: [REACT_QUERY_KEY.GET_DOMAIN_METRICS_DATA, payload],
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.GET_DOMAIN_METRICS_DATA,
|
||||
payload,
|
||||
ENTITY_VERSION_V5,
|
||||
],
|
||||
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
|
||||
GetMetricQueryRange(payload),
|
||||
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
|
||||
enabled: !!payload,
|
||||
staleTime: 60 * 1000, // 1 minute stale time : optimize this part
|
||||
})),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useQuery } from 'react-query';
|
||||
import { Combobox, type ComboboxItemType } from '@signozhq/ui/combobox';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import {
|
||||
getEndPointDropDownQueryPayload,
|
||||
@@ -43,8 +44,12 @@ function EndPointPicker({
|
||||
);
|
||||
|
||||
const { data, isLoading, isFetching } = useQuery({
|
||||
queryKey: [REACT_QUERY_KEY.GET_ENDPOINT_DROPDOWN_DATA, payload],
|
||||
queryFn: () => GetMetricQueryRange(payload),
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.GET_ENDPOINT_DROPDOWN_DATA,
|
||||
payload,
|
||||
ENTITY_VERSION_V5,
|
||||
],
|
||||
queryFn: () => GetMetricQueryRange(payload, ENTITY_VERSION_V5),
|
||||
staleTime: 60 * 1000,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Card } from 'antd';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import GridCard from 'container/WidgetCard/Card';
|
||||
import { Widgets } from 'types/api/widgets/widget';
|
||||
|
||||
@@ -22,6 +23,7 @@ function MetricOverTimeGraph({
|
||||
customOnDragSelect={(): void => {}}
|
||||
customTimeRange={timeRange}
|
||||
customTimeRangeWindowForCoRelation="5m"
|
||||
version={ENTITY_VERSION_V5}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
@@ -8,6 +8,7 @@ import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
|
||||
import QueryCancelledPlaceholder from 'components/QueryCancelledPlaceholder';
|
||||
import Spinner from 'components/Spinner';
|
||||
import WarningPopover from 'components/WarningPopover/WarningPopover';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
@@ -176,6 +177,7 @@ function ChartPreview({
|
||||
},
|
||||
originalGraphType: graphType,
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.ALERT_RULES_CHART_PREVIEW,
|
||||
|
||||
@@ -20,6 +20,7 @@ import Header from 'components/Header/Header';
|
||||
import HeaderRightSection from 'components/HeaderRightSection/HeaderRightSection';
|
||||
import NoAuthBanner from 'components/NoAuthBanner/NoAuthBanner';
|
||||
import { getIsNoAuthMode } from 'utils/noAuthMode';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { ORG_PREFERENCES } from 'constants/orgPreferences';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
@@ -101,6 +102,7 @@ export default function Home(): JSX.Element {
|
||||
},
|
||||
formatForWeb: false,
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.GET_QUERY_RANGE,
|
||||
@@ -125,6 +127,7 @@ export default function Home(): JSX.Element {
|
||||
},
|
||||
formatForWeb: false,
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.GET_QUERY_RANGE,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { QueryKey } from 'react-query';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { Button, Select, Skeleton, Table } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import ROUTES from 'constants/routes';
|
||||
import {
|
||||
getQueryRangeRequestData,
|
||||
@@ -225,23 +226,27 @@ function ServiceMetrics({
|
||||
[globalSelectedInterval, topLevelOperations],
|
||||
);
|
||||
|
||||
const dataQueries = useGetQueriesRange(queryRangeRequestData, {
|
||||
queryKey: useMemo(
|
||||
() => [
|
||||
`GetMetricsQueryRange-home-${globalSelectedInterval}`,
|
||||
timeRange.endTime,
|
||||
timeRange.startTime,
|
||||
globalSelectedInterval,
|
||||
],
|
||||
[globalSelectedInterval, timeRange.endTime, timeRange.startTime],
|
||||
),
|
||||
keepPreviousData: true,
|
||||
enabled: true,
|
||||
refetchOnMount: false,
|
||||
onError: () => {
|
||||
setIsError(true);
|
||||
const dataQueries = useGetQueriesRange(
|
||||
queryRangeRequestData,
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey: useMemo(
|
||||
() => [
|
||||
`GetMetricsQueryRange-home-${globalSelectedInterval}`,
|
||||
timeRange.endTime,
|
||||
timeRange.startTime,
|
||||
globalSelectedInterval,
|
||||
],
|
||||
[globalSelectedInterval, timeRange.endTime, timeRange.startTime],
|
||||
),
|
||||
keepPreviousData: true,
|
||||
enabled: true,
|
||||
refetchOnMount: false,
|
||||
onError: () => {
|
||||
setIsError(true);
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
|
||||
const isLoading = useMemo(
|
||||
() => dataQueries.some((query) => query.isLoading),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useQuery, useQueryClient } from 'react-query';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
||||
import { ILog } from 'types/api/logs/log';
|
||||
@@ -76,7 +77,7 @@ export function useEntityEvents({
|
||||
offset,
|
||||
pageSize,
|
||||
});
|
||||
return GetMetricQueryRange(query, undefined, signal);
|
||||
return GetMetricQueryRange(query, ENTITY_VERSION_V5, undefined, signal);
|
||||
},
|
||||
enabled: !!expression?.trim(),
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useInfiniteQuery, useQueryClient } from 'react-query';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import { DEFAULT_PER_PAGE_VALUE } from 'container/Controls/config';
|
||||
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
||||
@@ -62,7 +63,7 @@ export function useInfiniteEntityLogs({
|
||||
offset: pageParam as number,
|
||||
pageSize: DEFAULT_PER_PAGE_VALUE,
|
||||
});
|
||||
return GetMetricQueryRange(query, undefined, signal);
|
||||
return GetMetricQueryRange(query, ENTITY_VERSION_V5, undefined, signal);
|
||||
},
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
const list = lastPage?.payload?.data?.newResult?.data?.result?.[0]?.list;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useMemo } from 'react';
|
||||
import { QueryFunctionContext, useQueries, UseQueryResult } from 'react-query';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import { InfraMonitoringEntity } from 'container/InfraMonitoringK8sV2/constants';
|
||||
@@ -50,12 +51,18 @@ export function useEntityMetrics<T>({
|
||||
const queries = useQueries(
|
||||
queryPayloads.map((payload, index) => ({
|
||||
// TODO: remove AUTO_REFRESH_QUERY when migrating to date time selection v3
|
||||
queryKey: [REACT_QUERY_KEY.AUTO_REFRESH_QUERY, queryKey, payload, category],
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.AUTO_REFRESH_QUERY,
|
||||
queryKey,
|
||||
payload,
|
||||
ENTITY_VERSION_V5,
|
||||
category,
|
||||
],
|
||||
queryFn: ({
|
||||
signal,
|
||||
}: QueryFunctionContext): Promise<
|
||||
SuccessResponse<MetricRangePayloadProps>
|
||||
> => GetMetricQueryRange(payload, undefined, signal),
|
||||
> => GetMetricQueryRange(payload, ENTITY_VERSION_V5, undefined, signal),
|
||||
enabled: !!payload && visibilities[index],
|
||||
keepPreviousData: true,
|
||||
})),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useQuery, useQueryClient } from 'react-query';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
||||
|
||||
@@ -67,7 +68,7 @@ export function useEntityTraces({
|
||||
offset,
|
||||
pageSize,
|
||||
});
|
||||
return GetMetricQueryRange(query, undefined, signal);
|
||||
return GetMetricQueryRange(query, ENTITY_VERSION_V5, undefined, signal);
|
||||
},
|
||||
enabled: !!expression?.trim(),
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ import logEvent from 'api/common/logEvent';
|
||||
import ListViewOrderBy from 'components/OrderBy/ListViewOrderBy';
|
||||
import { SavedviewtypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
|
||||
import type { TableColumnDef } from 'components/TanStackTableView/types';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import { initialQueryAIWithType, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
@@ -144,6 +145,7 @@ function ListView({
|
||||
selectColumns,
|
||||
},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey,
|
||||
enabled:
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useSelector } from 'react-redux';
|
||||
import Space from 'periscope/components/Space/Space';
|
||||
import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
|
||||
import ExportMenu from 'components/ExportMenu/ExportMenu';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import { QueryTable } from 'container/QueryTable';
|
||||
@@ -70,6 +71,7 @@ function TableView({
|
||||
dataSource: 'traces',
|
||||
},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey,
|
||||
enabled: !!stagedQuery && panelType === PANEL_TYPES.TABLE,
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
import { QueryKey } from 'react-query';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useSelector } from 'react-redux';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import TimeSeriesView from 'container/TimeSeriesView/TimeSeriesView';
|
||||
@@ -88,6 +89,7 @@ function TimeSeriesViewContainer({
|
||||
dataSource,
|
||||
},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey,
|
||||
enabled: !!stagedQuery && panelType === PANEL_TYPES.TIME_SERIES,
|
||||
|
||||
@@ -14,6 +14,7 @@ import logEvent from 'api/common/logEvent';
|
||||
import ListViewOrderBy from 'components/OrderBy/ListViewOrderBy';
|
||||
import { SavedviewtypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
|
||||
import type { TableColumnDef } from 'components/TanStackTableView/types';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import { initialQueryAIWithType, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
@@ -139,6 +140,7 @@ function TracesView({
|
||||
pagination: paginationQueryData,
|
||||
},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey,
|
||||
enabled: !!stagedQuery && panelType === PANEL_TYPES.TRACE,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { LIVE_TAIL_GRAPH_INTERVAL } from 'constants/liveTail';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import LogsExplorerChart from 'container/LogsExplorerChart';
|
||||
@@ -56,6 +57,7 @@ function LiveLogsListChart({
|
||||
const { data, isFetching } = useGetExplorerQueryRange(
|
||||
listChartQuery,
|
||||
PANEL_TYPES.TIME_SERIES,
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
enabled: isConnectionOpen,
|
||||
refetchInterval: LIVE_TAIL_GRAPH_INTERVAL,
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
useMemo,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import {
|
||||
getOrderByTimestamp,
|
||||
@@ -130,6 +131,7 @@ export const useContextLogData = ({
|
||||
const { isError, isFetching } = useGetExplorerQueryRange(
|
||||
requestData,
|
||||
PANEL_TYPES.LIST,
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
keepPreviousData: true,
|
||||
enabled: !!requestData,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Card, Skeleton } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import cx from 'classnames';
|
||||
import Uplot from 'components/Uplot';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import dayjs from 'dayjs';
|
||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||
import { useResizeObserver } from 'hooks/useDimensions';
|
||||
@@ -59,9 +60,9 @@ function NodeMetrics({
|
||||
const widgetInfo = nodeName ? nodeWidgetInfo : hostWidgetInfo;
|
||||
const queries = useQueries(
|
||||
queryPayloads.map((payload) => ({
|
||||
queryKey: ['metrics', payload, 'NODE'],
|
||||
queryKey: ['metrics', payload, ENTITY_VERSION_V5, 'NODE'],
|
||||
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
|
||||
GetMetricQueryRange(payload),
|
||||
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
|
||||
enabled: !!payload,
|
||||
})),
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Card, Skeleton } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import cx from 'classnames';
|
||||
import Uplot from 'components/Uplot';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import dayjs from 'dayjs';
|
||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||
import { useResizeObserver } from 'hooks/useDimensions';
|
||||
@@ -56,9 +57,9 @@ function PodMetrics({
|
||||
);
|
||||
const queries = useQueries(
|
||||
queryPayloads.map((payload) => ({
|
||||
queryKey: ['metrics', payload, 'POD'],
|
||||
queryKey: ['metrics', payload, ENTITY_VERSION_V5, 'POD'],
|
||||
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
|
||||
GetMetricQueryRange(payload),
|
||||
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
|
||||
enabled: !!payload,
|
||||
})),
|
||||
);
|
||||
|
||||
@@ -34,10 +34,7 @@ function LogExplorerQuerySection({
|
||||
isRawQuery={panelTypes === PANEL_TYPES.LIST}
|
||||
config={{ initialDataSource: DataSource.LOGS, queryVariant: 'static' }}
|
||||
panelType={panelTypes}
|
||||
showOnlyWhereClause={
|
||||
selectedView === ExplorerViews.LIST ||
|
||||
selectedView === ExplorerViews.PATTERNS
|
||||
}
|
||||
showOnlyWhereClause={selectedView === ExplorerViews.LIST}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import { useSelector } from 'react-redux';
|
||||
import getFromLocalstorage from 'api/browser/localstorage/get';
|
||||
import setToLocalstorage from 'api/browser/localstorage/set';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import {
|
||||
@@ -151,6 +152,7 @@ function LogsExplorerViewsContainer({
|
||||
} = useGetExplorerQueryRange(
|
||||
listChartQuery,
|
||||
PANEL_TYPES.TIME_SERIES,
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
enabled:
|
||||
showFrequencyChart &&
|
||||
@@ -168,6 +170,7 @@ function LogsExplorerViewsContainer({
|
||||
useGetExplorerQueryRange(
|
||||
requestData,
|
||||
selectedPanelType,
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
keepPreviousData: true,
|
||||
enabled: !isLimit && !!requestData,
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
.patternsView {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
gap: var(--spacing-4);
|
||||
padding: var(--spacing-4) 0;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 var(--spacing-8);
|
||||
}
|
||||
|
||||
.table {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.patternCell {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: var(--spacing-4);
|
||||
}
|
||||
|
||||
.template {
|
||||
/* stylelint-disable property-disallowed-list -- Typography's code variant has line height 1, too tight for templates that wrap */
|
||||
font-family: var(--code-base-400-font-family);
|
||||
font-size: var(--code-base-400-font-size);
|
||||
line-height: var(--paragraph-base-400-line-height);
|
||||
/* stylelint-enable property-disallowed-list */
|
||||
color: var(--l1-foreground);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.share {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-2);
|
||||
}
|
||||
|
||||
.sparkline {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
import { Dispatch, MutableRefObject, SetStateAction, useEffect } from 'react';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
|
||||
import TanStackTable from 'components/TanStackTableView';
|
||||
import EmptyLogsSearch from 'container/EmptyLogsSearch/EmptyLogsSearch';
|
||||
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
|
||||
import NoLogs from 'container/NoLogs/NoLogs';
|
||||
import { ChangeViewFunctionType } from 'hooks/useHandleExplorerTabChange';
|
||||
import { DataSource } from 'types/common/queryBuilder';
|
||||
|
||||
import { useLogsPatterns } from './useLogsPatterns';
|
||||
import { usePatternColumns } from './usePatternColumns';
|
||||
import { useShowPatternLogs } from './useShowPatternLogs';
|
||||
import { getPatternRowKey } from './utils';
|
||||
|
||||
import styles from './LogsPatternsView.module.scss';
|
||||
|
||||
interface LogsPatternsViewProps {
|
||||
queryKeyRef: MutableRefObject<unknown>;
|
||||
handleChangeSelectedView: ChangeViewFunctionType;
|
||||
setIsLoadingQueries: Dispatch<SetStateAction<boolean>>;
|
||||
}
|
||||
|
||||
function LogsPatternsView({
|
||||
queryKeyRef,
|
||||
handleChangeSelectedView,
|
||||
setIsLoadingQueries,
|
||||
}: LogsPatternsViewProps): JSX.Element {
|
||||
const {
|
||||
rows,
|
||||
sampleRate,
|
||||
isFilterApplied,
|
||||
isLoading,
|
||||
isFetching,
|
||||
error,
|
||||
queryKey,
|
||||
} = useLogsPatterns();
|
||||
const showPatternLogs = useShowPatternLogs(handleChangeSelectedView);
|
||||
const columns = usePatternColumns(showPatternLogs);
|
||||
|
||||
useEffect(() => {
|
||||
queryKeyRef.current = queryKey;
|
||||
}, [queryKey, queryKeyRef]);
|
||||
|
||||
useEffect(() => {
|
||||
setIsLoadingQueries(isLoading || isFetching);
|
||||
}, [isLoading, isFetching, setIsLoadingQueries]);
|
||||
|
||||
useEffect(() => (): void => setIsLoadingQueries(false), [setIsLoadingQueries]);
|
||||
|
||||
if (isLoading || (isFetching && rows.length === 0)) {
|
||||
return <LogsLoading />;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return <ErrorInPlace error={error} data-testid="logs-patterns-error" />;
|
||||
}
|
||||
|
||||
if (rows.length === 0) {
|
||||
return (
|
||||
<div className={styles.patternsView} data-testid="logs-patterns-empty">
|
||||
{isFilterApplied ? (
|
||||
<EmptyLogsSearch dataSource={DataSource.LOGS} panelType="LIST" />
|
||||
) : (
|
||||
<NoLogs dataSource={DataSource.LOGS} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.patternsView} data-testid="logs-patterns-view">
|
||||
{sampleRate > 1 && (
|
||||
<div className={styles.header}>
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="small"
|
||||
weight="regular"
|
||||
color="secondary"
|
||||
as="span"
|
||||
textOverflow="wrap"
|
||||
testId="logs-patterns-sample-note"
|
||||
>
|
||||
Counts are estimated from a 1-in-{sampleRate.toLocaleString('en-US')}{' '}
|
||||
sample of the matching logs.
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.table}>
|
||||
<TanStackTable
|
||||
data={rows}
|
||||
columns={columns}
|
||||
getRowKey={getPatternRowKey}
|
||||
disableVirtualScroll
|
||||
testId="logs-patterns-table"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default LogsPatternsView;
|
||||
@@ -1,49 +0,0 @@
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import Uplot from 'components/Uplot';
|
||||
|
||||
import { PatternRow } from './types';
|
||||
|
||||
import styles from './LogsPatternsView.module.scss';
|
||||
|
||||
const WIDTH = 120;
|
||||
const HEIGHT = 24;
|
||||
|
||||
const OPTIONS: uPlot.Options = {
|
||||
width: WIDTH,
|
||||
height: HEIGHT,
|
||||
legend: { show: false },
|
||||
cursor: { show: false },
|
||||
padding: [2, 0, 2, 0],
|
||||
scales: {
|
||||
x: { time: false },
|
||||
y: { range: (_u, _min, max): uPlot.Range.MinMax => [0, Math.max(max, 1)] },
|
||||
},
|
||||
series: [
|
||||
{},
|
||||
{
|
||||
stroke: Color.BG_ROBIN_500,
|
||||
fill: 'rgba(78, 116, 248, 0.20)',
|
||||
width: 1.2,
|
||||
points: { show: false },
|
||||
},
|
||||
],
|
||||
axes: [{ show: false }, { show: false }],
|
||||
};
|
||||
|
||||
interface PatternSparklineProps {
|
||||
trend: PatternRow['trend'];
|
||||
testId: string;
|
||||
}
|
||||
|
||||
function PatternSparkline({
|
||||
trend,
|
||||
testId,
|
||||
}: PatternSparklineProps): JSX.Element {
|
||||
return (
|
||||
<div className={styles.sparkline} data-testid={testId}>
|
||||
<Uplot data={trend} options={OPTIONS} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default PatternSparkline;
|
||||
@@ -1,235 +0,0 @@
|
||||
import type {
|
||||
Querybuildertypesv5PatternsDataDTO,
|
||||
Querybuildertypesv5QueryRangeRequestDTO,
|
||||
} from 'api/generated/services/sigNoz.schemas';
|
||||
import { ENVIRONMENT } from 'constants/env';
|
||||
import { initialQueriesMap } from 'constants/queryBuilder';
|
||||
import { ChangeViewFunctionType } from 'hooks/useHandleExplorerTabChange';
|
||||
import { server } from 'mocks-server/server';
|
||||
import { ExplorerViews } from 'pages/LogsExplorer/utils';
|
||||
import { rest } from 'msw';
|
||||
import {
|
||||
NO_DELAY_USER_EVENT,
|
||||
render,
|
||||
screen,
|
||||
userEvent,
|
||||
} from 'tests/test-utils';
|
||||
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||
import { QueryBuilderContextType } from 'types/common/queryBuilder';
|
||||
|
||||
import LogsPatternsView from '../LogsPatternsView';
|
||||
|
||||
const QUERY_RANGE_URL = `${ENVIRONMENT.baseURL}/api/v5/query_range`;
|
||||
const FILTER = "service.name = 'api'";
|
||||
|
||||
const stagedQuery: Query = {
|
||||
...initialQueriesMap.logs,
|
||||
id: 'staged-1',
|
||||
builder: {
|
||||
...initialQueriesMap.logs.builder,
|
||||
queryData: [
|
||||
{
|
||||
...initialQueriesMap.logs.builder.queryData[0],
|
||||
filter: { expression: FILTER },
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const patternsData = (
|
||||
overrides: Partial<Querybuildertypesv5PatternsDataDTO> = {},
|
||||
): Querybuildertypesv5PatternsDataDTO => ({
|
||||
queryName: 'A',
|
||||
sampleRate: 1,
|
||||
total: 1500,
|
||||
patterns: [
|
||||
{
|
||||
id: '11',
|
||||
pattern: 'GET <*> 200',
|
||||
count: 1234,
|
||||
percent: 82.27,
|
||||
trend: [],
|
||||
},
|
||||
{ id: '22', pattern: '', count: 266, percent: 17.73, trend: null },
|
||||
],
|
||||
...overrides,
|
||||
});
|
||||
|
||||
function mockPatterns(
|
||||
data: Querybuildertypesv5PatternsDataDTO,
|
||||
requests: Querybuildertypesv5QueryRangeRequestDTO[] = [],
|
||||
): void {
|
||||
server.use(
|
||||
rest.post(QUERY_RANGE_URL, async (req, res, ctx) => {
|
||||
requests.push(await req.json());
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
status: 'success',
|
||||
data: { type: 'pattern', data: { results: [data] } },
|
||||
}),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const updateQueriesData: QueryBuilderContextType['updateQueriesData'] = (
|
||||
query,
|
||||
type,
|
||||
updateCallback,
|
||||
) => ({
|
||||
...query,
|
||||
builder: { ...query.builder, [type]: query.builder[type].map(updateCallback) },
|
||||
});
|
||||
|
||||
const handleChangeSelectedView =
|
||||
jest.fn() as jest.MockedFunction<ChangeViewFunctionType>;
|
||||
|
||||
const renderView = (): void => {
|
||||
render(
|
||||
<LogsPatternsView
|
||||
queryKeyRef={{ current: null }}
|
||||
handleChangeSelectedView={handleChangeSelectedView}
|
||||
setIsLoadingQueries={jest.fn()}
|
||||
/>,
|
||||
undefined,
|
||||
{
|
||||
queryBuilderOverrides: {
|
||||
stagedQuery,
|
||||
updateQueriesData,
|
||||
} as Partial<QueryBuilderContextType>,
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
describe('LogsPatternsView', () => {
|
||||
it('requests the patterns of the staged filter', async () => {
|
||||
const requests: Querybuildertypesv5QueryRangeRequestDTO[] = [];
|
||||
mockPatterns(patternsData(), requests);
|
||||
|
||||
renderView();
|
||||
|
||||
await screen.findByTestId('logs-patterns-table');
|
||||
expect(requests).toHaveLength(1);
|
||||
const [request] = requests;
|
||||
expect(request.requestType).toBe('pattern');
|
||||
expect(request.compositeQuery?.queries).toStrictEqual([
|
||||
{
|
||||
type: 'builder_query',
|
||||
spec: {
|
||||
name: 'A',
|
||||
signal: 'logs',
|
||||
limit: 100,
|
||||
stepInterval: Math.ceil(
|
||||
((request.end ?? 0) - (request.start ?? 0)) / 1000 / 60,
|
||||
),
|
||||
filter: { expression: FILTER },
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('shows each pattern with its count and share', async () => {
|
||||
mockPatterns(patternsData());
|
||||
|
||||
renderView();
|
||||
|
||||
await expect(
|
||||
screen.findByTestId('pattern-template-11'),
|
||||
).resolves.toHaveTextContent('GET <*> 200');
|
||||
expect(screen.getByTestId('pattern-count-11')).toHaveTextContent('1,234');
|
||||
expect(screen.getByTestId('pattern-share-11')).toHaveTextContent('82.3%');
|
||||
expect(screen.getByTestId('pattern-trend-11')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('labels a pattern without a template as unknown', async () => {
|
||||
mockPatterns(patternsData());
|
||||
|
||||
renderView();
|
||||
|
||||
await expect(
|
||||
screen.findByTestId('pattern-template-22'),
|
||||
).resolves.toHaveTextContent('Unknown pattern');
|
||||
});
|
||||
|
||||
it('shows the logs of a pattern in the list view, filtered on its template', async () => {
|
||||
const user = userEvent.setup(NO_DELAY_USER_EVENT);
|
||||
mockPatterns(patternsData());
|
||||
|
||||
renderView();
|
||||
|
||||
await user.click(await screen.findByTestId('pattern-show-logs-11'));
|
||||
|
||||
expect(handleChangeSelectedView).toHaveBeenCalledTimes(1);
|
||||
const [view, queryData] = handleChangeSelectedView.mock.calls[0];
|
||||
expect(view).toBe(ExplorerViews.LIST);
|
||||
expect(queryData?.query.builder.queryData[0].filter).toStrictEqual({
|
||||
expression: "service.name = 'api' AND pattern('GET <*> 200')",
|
||||
});
|
||||
});
|
||||
|
||||
it('offers no logs for a pattern without a template', async () => {
|
||||
mockPatterns(patternsData());
|
||||
|
||||
renderView();
|
||||
|
||||
await screen.findByTestId('pattern-template-22');
|
||||
expect(screen.queryByTestId('pattern-show-logs-22')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('notes that counts are estimated when the logs were sampled', async () => {
|
||||
mockPatterns(patternsData({ sampleRate: 1200 }));
|
||||
|
||||
renderView();
|
||||
|
||||
await expect(
|
||||
screen.findByTestId('logs-patterns-sample-note'),
|
||||
).resolves.toHaveTextContent(
|
||||
'Counts are estimated from a 1-in-1,200 sample of the matching logs.',
|
||||
);
|
||||
});
|
||||
|
||||
it('has no sample note when every log was read', async () => {
|
||||
mockPatterns(patternsData());
|
||||
|
||||
renderView();
|
||||
|
||||
await screen.findByTestId('logs-patterns-table');
|
||||
expect(
|
||||
screen.queryByTestId('logs-patterns-sample-note'),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows the empty search state when no pattern matches the filter', async () => {
|
||||
mockPatterns(patternsData({ patterns: [], total: 0 }));
|
||||
|
||||
renderView();
|
||||
|
||||
await expect(
|
||||
screen.findByTestId('logs-patterns-empty'),
|
||||
).resolves.toHaveTextContent('This query had no results.');
|
||||
});
|
||||
|
||||
it('shows the error from the server', async () => {
|
||||
server.use(
|
||||
rest.post(QUERY_RANGE_URL, (_req, res, ctx) =>
|
||||
res(
|
||||
ctx.status(400),
|
||||
ctx.json({
|
||||
status: 'error',
|
||||
error: {
|
||||
code: 'invalid_input',
|
||||
message: 'pattern requests take one logs builder query',
|
||||
},
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
renderView();
|
||||
|
||||
await expect(
|
||||
screen.findByTestId('logs-patterns-error'),
|
||||
).resolves.toHaveTextContent('pattern requests take one logs builder query');
|
||||
});
|
||||
});
|
||||
@@ -1,72 +0,0 @@
|
||||
import {
|
||||
addPatternToExpression,
|
||||
formatPatternShare,
|
||||
getPatternsTimeRange,
|
||||
getTrendSeries,
|
||||
} from '../utils';
|
||||
|
||||
const MS_TO_NS = 1_000_000;
|
||||
|
||||
describe('getPatternsTimeRange', () => {
|
||||
it('picks the smallest step that keeps the trend within 60 steps', () => {
|
||||
expect(getPatternsTimeRange(0, 3_600_000 * MS_TO_NS)).toStrictEqual({
|
||||
startMs: 0,
|
||||
endMs: 3_600_000,
|
||||
stepSeconds: 60,
|
||||
});
|
||||
expect(getPatternsTimeRange(0, 3_601_000 * MS_TO_NS).stepSeconds).toBe(61);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTrendSeries', () => {
|
||||
it('fills the steps the server left out with zero', () => {
|
||||
const range = { startMs: 1000, endMs: 1000 + 4 * 60_000, stepSeconds: 60 };
|
||||
|
||||
expect(
|
||||
getTrendSeries(
|
||||
[
|
||||
{ timestamp: 1000 + 60_000, count: 5 },
|
||||
{ timestamp: 1000 + 3 * 60_000, count: 2 },
|
||||
],
|
||||
range,
|
||||
),
|
||||
).toStrictEqual([
|
||||
[1000, 61_000, 121_000, 181_000],
|
||||
[0, 5, 0, 2],
|
||||
]);
|
||||
});
|
||||
|
||||
it('returns a flat line for a pattern without a trend', () => {
|
||||
const range = { startMs: 0, endMs: 120_000, stepSeconds: 60 };
|
||||
|
||||
expect(getTrendSeries(null, range)).toStrictEqual([
|
||||
[0, 60_000],
|
||||
[0, 0],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatPatternShare', () => {
|
||||
it('keeps a tiny share from reading as zero', () => {
|
||||
expect(formatPatternShare(0.02)).toBe('<0.1%');
|
||||
expect(formatPatternShare(12.345)).toBe('12.3%');
|
||||
});
|
||||
});
|
||||
|
||||
describe('addPatternToExpression', () => {
|
||||
it('sets the pattern filter when there is no expression', () => {
|
||||
expect(addPatternToExpression(' ', 'auth <*>')).toBe("pattern('auth <*>')");
|
||||
});
|
||||
|
||||
it('escapes backslashes and single quotes in the template', () => {
|
||||
expect(addPatternToExpression('', "it's C:\\tmp")).toBe(
|
||||
"pattern('it\\'s C:\\\\tmp')",
|
||||
);
|
||||
});
|
||||
|
||||
it('keeps an OR expression grouped under the added AND', () => {
|
||||
expect(addPatternToExpression("a = '1' OR b = '2'", 'x')).toBe(
|
||||
"(a = '1' OR b = '2') AND pattern('x')",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
export interface PatternRow {
|
||||
id: string;
|
||||
pattern: string;
|
||||
count: number;
|
||||
percent: number;
|
||||
trend: [number[], number[]];
|
||||
}
|
||||
|
||||
export interface PatternsTimeRange {
|
||||
startMs: number;
|
||||
endMs: number;
|
||||
stepSeconds: number;
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useQuery } from 'react-query';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useSelector } from 'react-redux';
|
||||
import { queryRangeV5 } from 'api/generated/services/querier';
|
||||
import {
|
||||
QueryRangeV5200,
|
||||
RenderErrorResponseDTO,
|
||||
} from 'api/generated/services/sigNoz.schemas';
|
||||
import { ErrorType } from 'api/generatedAPIInstance';
|
||||
import { getFilter } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import { getListQuery } from 'container/LogsExplorerViews/explorerUtils';
|
||||
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||
import { AppState } from 'store/reducers';
|
||||
import APIError from 'types/api/error';
|
||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||
import { toAPIError } from 'utils/errorUtils';
|
||||
|
||||
import { PatternRow } from './types';
|
||||
import {
|
||||
buildPatternsRequest,
|
||||
getPatternsData,
|
||||
getPatternsTimeRange,
|
||||
toPatternRows,
|
||||
} from './utils';
|
||||
|
||||
interface UseLogsPatterns {
|
||||
rows: PatternRow[];
|
||||
sampleRate: number;
|
||||
isFilterApplied: boolean;
|
||||
isLoading: boolean;
|
||||
isFetching: boolean;
|
||||
error: APIError | null;
|
||||
queryKey: unknown[];
|
||||
}
|
||||
|
||||
export function useLogsPatterns(): UseLogsPatterns {
|
||||
const { stagedQuery } = useQueryBuilder();
|
||||
const { minTime, maxTime } = useSelector<AppState, GlobalReducer>(
|
||||
(state) => state.globalTime,
|
||||
);
|
||||
|
||||
const listQuery = useMemo(() => getListQuery(stagedQuery), [stagedQuery]);
|
||||
const filterExpression = listQuery ? getFilter(listQuery).expression : '';
|
||||
|
||||
const timeRange = useMemo(
|
||||
() => getPatternsTimeRange(minTime, maxTime),
|
||||
[minTime, maxTime],
|
||||
);
|
||||
|
||||
const request = useMemo(
|
||||
() =>
|
||||
buildPatternsRequest(
|
||||
listQuery?.queryName || 'A',
|
||||
filterExpression,
|
||||
timeRange,
|
||||
),
|
||||
[listQuery?.queryName, filterExpression, timeRange],
|
||||
);
|
||||
|
||||
// The staged query id changes on every Run Query, so an unchanged filter refetches too.
|
||||
const queryKey = useMemo(
|
||||
() => [REACT_QUERY_KEY.GET_LOG_PATTERNS, request, stagedQuery?.id],
|
||||
[request, stagedQuery?.id],
|
||||
);
|
||||
|
||||
const { data, isLoading, isIdle, isFetching, error } = useQuery<
|
||||
QueryRangeV5200,
|
||||
ErrorType<RenderErrorResponseDTO>
|
||||
>({
|
||||
queryKey,
|
||||
queryFn: ({ signal }) => queryRangeV5(request, signal),
|
||||
enabled: !!listQuery,
|
||||
});
|
||||
|
||||
const patternsData = useMemo(() => getPatternsData(data), [data]);
|
||||
const rows = useMemo(
|
||||
() => toPatternRows(patternsData, timeRange),
|
||||
[patternsData, timeRange],
|
||||
);
|
||||
const apiError = useMemo(() => (error ? toAPIError(error) : null), [error]);
|
||||
|
||||
return {
|
||||
rows,
|
||||
sampleRate: patternsData?.sampleRate ?? 1,
|
||||
isFilterApplied: filterExpression.trim() !== '',
|
||||
isLoading: isLoading || isIdle,
|
||||
isFetching,
|
||||
error: apiError,
|
||||
queryKey,
|
||||
};
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Progress } from '@signozhq/ui/progress';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import TanStackTable from 'components/TanStackTableView';
|
||||
import type { TableColumnDef } from 'components/TanStackTableView/types';
|
||||
|
||||
import PatternSparkline from './PatternSparkline';
|
||||
import { PatternRow } from './types';
|
||||
import { formatPatternCount, formatPatternShare } from './utils';
|
||||
|
||||
import styles from './LogsPatternsView.module.scss';
|
||||
|
||||
export function usePatternColumns(
|
||||
onShowLogs: (template: string) => void,
|
||||
): TableColumnDef<PatternRow>[] {
|
||||
return useMemo(
|
||||
(): TableColumnDef<PatternRow>[] => [
|
||||
{
|
||||
id: 'count',
|
||||
header: 'Count',
|
||||
accessorKey: 'count',
|
||||
width: { fixed: 120 },
|
||||
cell: ({ row }): JSX.Element => (
|
||||
<TanStackTable.Text data-testid={`pattern-count-${row.id}`}>
|
||||
{formatPatternCount(row.count)}
|
||||
</TanStackTable.Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'share',
|
||||
header: 'Share',
|
||||
accessorKey: 'percent',
|
||||
width: { fixed: 140 },
|
||||
cell: ({ row }): JSX.Element => (
|
||||
<div className={styles.share}>
|
||||
<TanStackTable.Text data-testid={`pattern-share-${row.id}`}>
|
||||
{formatPatternShare(row.percent)}
|
||||
</TanStackTable.Text>
|
||||
<Progress
|
||||
percent={row.percent}
|
||||
color="primary"
|
||||
aria-label="Share of logs"
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'trend',
|
||||
header: 'Trend',
|
||||
width: { fixed: 150 },
|
||||
cell: ({ row }): JSX.Element => (
|
||||
<PatternSparkline trend={row.trend} testId={`pattern-trend-${row.id}`} />
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'pattern',
|
||||
header: 'Pattern',
|
||||
accessorKey: 'pattern',
|
||||
width: { min: 320 },
|
||||
cell: ({ row }): JSX.Element =>
|
||||
row.pattern ? (
|
||||
<div className={styles.patternCell}>
|
||||
<span
|
||||
className={styles.template}
|
||||
data-testid={`pattern-template-${row.id}`}
|
||||
>
|
||||
{row.pattern}
|
||||
</span>
|
||||
<Button
|
||||
variant="link"
|
||||
color="primary"
|
||||
size="sm"
|
||||
onClick={(): void => onShowLogs(row.pattern)}
|
||||
testId={`pattern-show-logs-${row.id}`}
|
||||
aria-label={`Show logs of pattern ${row.pattern}`}
|
||||
>
|
||||
Show logs
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="tertiary"
|
||||
as="span"
|
||||
textOverflow="wrap"
|
||||
data-testid={`pattern-template-${row.id}`}
|
||||
>
|
||||
Unknown pattern
|
||||
</Typography>
|
||||
),
|
||||
},
|
||||
],
|
||||
[onShowLogs],
|
||||
);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
import { useCallback } from 'react';
|
||||
import { getFilter } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
|
||||
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||
import { ChangeViewFunctionType } from 'hooks/useHandleExplorerTabChange';
|
||||
import { ExplorerViews } from 'pages/LogsExplorer/utils';
|
||||
|
||||
import { addPatternToExpression } from './utils';
|
||||
|
||||
export function useShowPatternLogs(
|
||||
handleChangeSelectedView: ChangeViewFunctionType,
|
||||
): (template: string) => void {
|
||||
const { stagedQuery, updateQueriesData } = useQueryBuilder();
|
||||
|
||||
return useCallback(
|
||||
(template: string): void => {
|
||||
if (!stagedQuery || !template) {
|
||||
return;
|
||||
}
|
||||
|
||||
const query = updateQueriesData(stagedQuery, 'queryData', (item, index) =>
|
||||
index === 0
|
||||
? {
|
||||
...item,
|
||||
filter: {
|
||||
expression: addPatternToExpression(
|
||||
getFilter(item).expression,
|
||||
template,
|
||||
),
|
||||
},
|
||||
}
|
||||
: item,
|
||||
);
|
||||
|
||||
handleChangeSelectedView(ExplorerViews.LIST, { query });
|
||||
},
|
||||
[stagedQuery, updateQueriesData, handleChangeSelectedView],
|
||||
);
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
import {
|
||||
Querybuildertypesv5PatternDTO,
|
||||
Querybuildertypesv5PatternsDataDTO,
|
||||
Querybuildertypesv5QueryBuilderQueryGithubComSigNozSignozPkgTypesQuerybuildertypesQuerybuildertypesv5LogAggregationDTOSignal as LogSignal,
|
||||
Querybuildertypesv5QueryEnvelopeBuilderDTOType,
|
||||
Querybuildertypesv5QueryRangeRequestDTO,
|
||||
Querybuildertypesv5RequestTypeDTO,
|
||||
QueryRangeV5200,
|
||||
} from 'api/generated/services/sigNoz.schemas';
|
||||
import { formatStringLiteralForExpression } from 'components/QueryBuilderV2/utils';
|
||||
import { NANO_SECOND_MULTIPLIER } from 'store/globalTime';
|
||||
|
||||
import { PatternRow, PatternsTimeRange } from './types';
|
||||
|
||||
export const PATTERNS_LIMIT = 100;
|
||||
|
||||
// The backend caps a pattern's trend at 60 steps.
|
||||
const MAX_TREND_STEPS = 60;
|
||||
|
||||
export function getPatternsTimeRange(
|
||||
minTimeNs: number,
|
||||
maxTimeNs: number,
|
||||
): PatternsTimeRange {
|
||||
const startMs = Math.floor(minTimeNs / NANO_SECOND_MULTIPLIER);
|
||||
const endMs = Math.floor(maxTimeNs / NANO_SECOND_MULTIPLIER);
|
||||
const stepSeconds = Math.max(
|
||||
1,
|
||||
Math.ceil((endMs - startMs) / 1000 / MAX_TREND_STEPS),
|
||||
);
|
||||
return { startMs, endMs, stepSeconds };
|
||||
}
|
||||
|
||||
export function buildPatternsRequest(
|
||||
queryName: string,
|
||||
filterExpression: string,
|
||||
{ startMs, endMs, stepSeconds }: PatternsTimeRange,
|
||||
): Querybuildertypesv5QueryRangeRequestDTO {
|
||||
return {
|
||||
schemaVersion: 'v1',
|
||||
start: startMs,
|
||||
end: endMs,
|
||||
requestType: Querybuildertypesv5RequestTypeDTO.pattern,
|
||||
compositeQuery: {
|
||||
queries: [
|
||||
{
|
||||
type: Querybuildertypesv5QueryEnvelopeBuilderDTOType.builder_query,
|
||||
spec: {
|
||||
name: queryName,
|
||||
signal: LogSignal.logs,
|
||||
limit: PATTERNS_LIMIT,
|
||||
stepInterval: stepSeconds,
|
||||
filter: { expression: filterExpression },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function getPatternsData(
|
||||
response: QueryRangeV5200 | undefined,
|
||||
): Querybuildertypesv5PatternsDataDTO | null {
|
||||
const result = response?.data?.data?.results?.[0];
|
||||
if (!result || typeof result !== 'object' || !('sampleRate' in result)) {
|
||||
return null;
|
||||
}
|
||||
return result as Querybuildertypesv5PatternsDataDTO;
|
||||
}
|
||||
|
||||
// The backend leaves out steps without logs; fill them with zero on the request's step grid.
|
||||
export function getTrendSeries(
|
||||
trend: Querybuildertypesv5PatternDTO['trend'],
|
||||
{ startMs, endMs, stepSeconds }: PatternsTimeRange,
|
||||
): [number[], number[]] {
|
||||
const stepMs = stepSeconds * 1000;
|
||||
const steps = Math.max(1, Math.ceil((endMs - startMs) / stepMs));
|
||||
const xs = Array.from({ length: steps }, (_, i) => startMs + i * stepMs);
|
||||
const ys = new Array<number>(steps).fill(0);
|
||||
(trend ?? []).forEach(({ timestamp, count }) => {
|
||||
const index = Math.round((timestamp - startMs) / stepMs);
|
||||
if (index >= 0 && index < steps) {
|
||||
ys[index] += count;
|
||||
}
|
||||
});
|
||||
return [xs, ys];
|
||||
}
|
||||
|
||||
export function toPatternRows(
|
||||
data: Querybuildertypesv5PatternsDataDTO | null,
|
||||
timeRange: PatternsTimeRange,
|
||||
): PatternRow[] {
|
||||
return (data?.patterns ?? []).map((item) => ({
|
||||
id: item.id,
|
||||
pattern: item.pattern,
|
||||
count: item.count,
|
||||
percent: item.percent,
|
||||
trend: getTrendSeries(item.trend, timeRange),
|
||||
}));
|
||||
}
|
||||
|
||||
export function getPatternRowKey(row: PatternRow): string {
|
||||
return row.id;
|
||||
}
|
||||
|
||||
export function formatPatternCount(count: number): string {
|
||||
return count.toLocaleString('en-US');
|
||||
}
|
||||
|
||||
export function formatPatternShare(percent: number): string {
|
||||
if (percent > 0 && percent < 0.1) {
|
||||
return '<0.1%';
|
||||
}
|
||||
return `${percent.toFixed(1)}%`;
|
||||
}
|
||||
|
||||
// Parenthesised when it has an OR, which binds looser than the added AND.
|
||||
export function addPatternToExpression(
|
||||
expression: string,
|
||||
template: string,
|
||||
): string {
|
||||
const patternFilter = `pattern(${formatStringLiteralForExpression(template)})`;
|
||||
const base = expression.trim();
|
||||
if (!base) {
|
||||
return patternFilter;
|
||||
}
|
||||
const scoped = /\bor\b/i.test(base) ? `(${base})` : base;
|
||||
return `${scoped} AND ${patternFilter}`;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ function Section(section: MetricSection): JSX.Element {
|
||||
$panelType={PANEL_TYPES.BAR}
|
||||
className="meter-graph"
|
||||
>
|
||||
<GridCard widget={widget} onDragSelect={onDragSelect} />
|
||||
<GridCard widget={widget} onDragSelect={onDragSelect} version="v5" />
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { useQueries } from 'react-query';
|
||||
import { isAxiosError } from 'axios';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { initialQueryMeterWithType, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { MAX_QUERY_RETRIES } from 'constants/reactQuery';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
@@ -71,6 +72,7 @@ export function useTimeSeriesQueries({
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.GET_QUERY_RANGE,
|
||||
payload,
|
||||
ENTITY_VERSION_V5,
|
||||
globalSelectedTime,
|
||||
maxTime,
|
||||
minTime,
|
||||
@@ -91,6 +93,7 @@ export function useTimeSeriesQueries({
|
||||
dataSource: DataSource.METRICS,
|
||||
},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
undefined,
|
||||
signal,
|
||||
),
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useAppLocation } from 'lib/router/useAppLocation';
|
||||
import { useAppParams } from 'lib/router/useAppParams';
|
||||
import Col from 'periscope/components/Col/Col';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import Graph from 'container/WidgetCard/Card';
|
||||
@@ -200,6 +201,7 @@ function DBCall(): JSX.Element {
|
||||
);
|
||||
}}
|
||||
onDragSelect={onDragSelect}
|
||||
version={ENTITY_VERSION_V5}
|
||||
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
|
||||
/>
|
||||
</GraphContainer>
|
||||
@@ -238,6 +240,7 @@ function DBCall(): JSX.Element {
|
||||
);
|
||||
}}
|
||||
onDragSelect={onDragSelect}
|
||||
version={ENTITY_VERSION_V5}
|
||||
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
|
||||
/>
|
||||
</GraphContainer>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useAppLocation } from 'lib/router/useAppLocation';
|
||||
import { useAppParams } from 'lib/router/useAppParams';
|
||||
import Col from 'periscope/components/Col/Col';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import Graph from 'container/WidgetCard/Card';
|
||||
@@ -272,6 +273,7 @@ function External(): JSX.Element {
|
||||
);
|
||||
}}
|
||||
onDragSelect={onDragSelect}
|
||||
version={ENTITY_VERSION_V5}
|
||||
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
|
||||
/>
|
||||
</GraphContainer>
|
||||
@@ -315,6 +317,7 @@ function External(): JSX.Element {
|
||||
);
|
||||
}}
|
||||
onDragSelect={onDragSelect}
|
||||
version={ENTITY_VERSION_V5}
|
||||
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
|
||||
/>
|
||||
</GraphContainer>
|
||||
@@ -359,6 +362,7 @@ function External(): JSX.Element {
|
||||
)
|
||||
}
|
||||
onDragSelect={onDragSelect}
|
||||
version={ENTITY_VERSION_V5}
|
||||
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
|
||||
/>
|
||||
</GraphContainer>
|
||||
@@ -402,6 +406,7 @@ function External(): JSX.Element {
|
||||
);
|
||||
}}
|
||||
onDragSelect={onDragSelect}
|
||||
version={ENTITY_VERSION_V5}
|
||||
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
|
||||
/>
|
||||
</GraphContainer>
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
apDexToolTipUrl,
|
||||
apDexToolTipUrlText,
|
||||
} from 'constants/apDex';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import Graph from 'container/WidgetCard/Card';
|
||||
import DisplayThreshold from 'container/WidgetCard/Header/DisplayThreshold';
|
||||
@@ -97,6 +98,7 @@ function ApDexMetrics({
|
||||
onClickHandler={handleGraphClick('ApDex')}
|
||||
threshold={threshold}
|
||||
isQueryEnabled={isQueryEnabled}
|
||||
version={ENTITY_VERSION_V5}
|
||||
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useAppParams } from 'lib/router/useAppParams';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { FeatureKeys } from 'constants/features';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import Graph from 'container/WidgetCard/Card';
|
||||
@@ -118,6 +119,7 @@ function ServiceOverview({
|
||||
widget={latencyWidget}
|
||||
onClickHandler={handleGraphClick('Service')}
|
||||
isQueryEnabled={isQueryEnabled}
|
||||
version={ENTITY_VERSION_V5}
|
||||
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
|
||||
/>
|
||||
</GraphContainer>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import axios from 'axios';
|
||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import Graph from 'container/WidgetCard/Card';
|
||||
import { SERVICE_DETAIL_DRILLDOWN_ENABLED } from 'container/MetricsApplication/constant';
|
||||
import { Card, GraphContainer } from 'container/MetricsApplication/styles';
|
||||
@@ -39,6 +40,7 @@ function TopLevelOperation({
|
||||
onClickHandler={handleGraphClick(opName)}
|
||||
onDragSelect={onDragSelect}
|
||||
isQueryEnabled={!topLevelOperationsIsLoading}
|
||||
version={ENTITY_VERSION_V5}
|
||||
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
|
||||
/>
|
||||
</GraphContainer>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { ReactNode, useMemo } from 'react';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useAppParams } from 'lib/router/useAppParams';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { topOperationMetricsDownloadOptions } from 'container/MetricsApplication/constant';
|
||||
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
|
||||
@@ -70,6 +71,7 @@ function TopOperationMetrics(): JSX.Element {
|
||||
globalSelectedInterval,
|
||||
variables: {},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey: [
|
||||
`GetMetricsQueryRange-${keyOperationWidget?.timePreferance}-${globalSelectedInterval}-${keyOperationWidget?.id}`,
|
||||
|
||||
@@ -16,6 +16,7 @@ import classNames from 'classnames';
|
||||
import QueryCancelledPlaceholder from 'components/QueryCancelledPlaceholder';
|
||||
import YAxisUnitSelector from 'components/YAxisUnitSelector';
|
||||
import { YAxisSource } from 'components/YAxisUnitSelector/types';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { MAX_QUERY_RETRIES } from 'constants/reactQuery';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
@@ -101,6 +102,7 @@ function TimeSeries({
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.GET_QUERY_RANGE,
|
||||
payload,
|
||||
ENTITY_VERSION_V5,
|
||||
globalSelectedTime,
|
||||
maxTime,
|
||||
minTime,
|
||||
@@ -121,6 +123,7 @@ function TimeSeries({
|
||||
dataSource: DataSource.METRICS,
|
||||
},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
undefined,
|
||||
signal,
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import {
|
||||
initialFilters,
|
||||
initialQueriesMap,
|
||||
@@ -26,12 +27,15 @@ function LogsCountInInterval({
|
||||
return q;
|
||||
}, [filter]);
|
||||
|
||||
const result = useGetQueryRange({
|
||||
graphType: PANEL_TYPES.TABLE,
|
||||
query,
|
||||
selectedTime: 'GLOBAL_TIME',
|
||||
globalSelectedInterval: timeInterval,
|
||||
});
|
||||
const result = useGetQueryRange(
|
||||
{
|
||||
graphType: PANEL_TYPES.TABLE,
|
||||
query,
|
||||
selectedTime: 'GLOBAL_TIME',
|
||||
globalSelectedInterval: timeInterval,
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
);
|
||||
|
||||
const count = useMemo(() => {
|
||||
const table = result.data?.payload?.data?.result?.[0]?.table;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import {
|
||||
initialFilters,
|
||||
initialQueriesMap,
|
||||
@@ -42,12 +43,15 @@ const useSampleLogs = ({
|
||||
return q;
|
||||
}, [count, filter]);
|
||||
|
||||
const response = useGetQueryRange({
|
||||
graphType: PANEL_TYPES.LIST,
|
||||
query,
|
||||
selectedTime: 'GLOBAL_TIME',
|
||||
globalSelectedInterval: timeInterval,
|
||||
});
|
||||
const response = useGetQueryRange(
|
||||
{
|
||||
graphType: PANEL_TYPES.LIST,
|
||||
query,
|
||||
selectedTime: 'GLOBAL_TIME',
|
||||
globalSelectedInterval: timeInterval,
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
);
|
||||
|
||||
const { isFetching: isLoading, data } = response;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
SquareMousePointer,
|
||||
Terminal,
|
||||
Binoculars,
|
||||
Layers,
|
||||
} from '@signozhq/icons';
|
||||
import { Button, Tooltip } from 'antd';
|
||||
import cx from 'classnames';
|
||||
@@ -30,7 +29,7 @@ export default function LeftToolbarActions({
|
||||
showFilter,
|
||||
handleFilterVisibilityChange,
|
||||
}: LeftToolbarActionsProps): JSX.Element {
|
||||
const { clickhouse, list, timeseries, table, trace, patterns } = items;
|
||||
const { clickhouse, list, timeseries, table, trace } = items;
|
||||
|
||||
return (
|
||||
<div className="left-toolbar">
|
||||
@@ -135,25 +134,6 @@ export default function LeftToolbarActions({
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{patterns?.show && (
|
||||
<Tooltip title="Patterns">
|
||||
<Button
|
||||
disabled={patterns.disabled}
|
||||
className={cx(
|
||||
'patterns-view-tab',
|
||||
'explorer-view-option',
|
||||
selectedView === patterns.key ? activeTab : '',
|
||||
)}
|
||||
onClick={(): void => onChangeSelectedView(patterns.key)}
|
||||
data-testid="explorer-view-patterns"
|
||||
aria-pressed={selectedView === patterns.key}
|
||||
>
|
||||
<Layers size={14} />
|
||||
Patterns
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -8,6 +8,7 @@ export type OrderByFilterProps = {
|
||||
query: IBuilderQuery;
|
||||
onChange: (values: OrderByPayload[]) => void;
|
||||
isRawQuery?: boolean;
|
||||
isNewQueryV2?: boolean;
|
||||
placeholder?: string;
|
||||
/** A logs or traces heatmap aggregates a field, which Order by then offers. */
|
||||
panelType?: PANEL_TYPES;
|
||||
|
||||
@@ -20,6 +20,7 @@ export function OrderByFilter({
|
||||
query,
|
||||
onChange,
|
||||
isRawQuery = false,
|
||||
isNewQueryV2 = false,
|
||||
placeholder,
|
||||
panelType,
|
||||
}: OrderByFilterProps): JSX.Element {
|
||||
@@ -27,6 +28,7 @@ export function OrderByFilter({
|
||||
const {
|
||||
debouncedSearchText,
|
||||
selectedValue,
|
||||
aggregationOptions,
|
||||
generateOptions,
|
||||
createOptions,
|
||||
handleChange,
|
||||
@@ -48,10 +50,11 @@ export function OrderByFilter({
|
||||
},
|
||||
);
|
||||
|
||||
// Get parsed aggregation options using createAggregation
|
||||
// Get parsed aggregation options using createAggregation only for QueryV2
|
||||
const parsedAggregationOptions = useMemo(
|
||||
() => getParsedAggregationOptionsForOrderBy(query, panelType),
|
||||
[query, panelType],
|
||||
() =>
|
||||
isNewQueryV2 ? getParsedAggregationOptionsForOrderBy(query, panelType) : [],
|
||||
[query, isNewQueryV2, panelType],
|
||||
);
|
||||
|
||||
const optionsData = useMemo(() => {
|
||||
@@ -64,7 +67,10 @@ export function OrderByFilter({
|
||||
const options =
|
||||
query.aggregateOperator === MetricAggregateOperator.NOOP
|
||||
? keyOptions
|
||||
: [...groupByOptions, ...aggregationOptionsFromParsed];
|
||||
: [
|
||||
...groupByOptions,
|
||||
...(isNewQueryV2 ? aggregationOptionsFromParsed : aggregationOptions),
|
||||
];
|
||||
|
||||
return generateOptions(options);
|
||||
}, [
|
||||
@@ -73,7 +79,9 @@ export function OrderByFilter({
|
||||
query.groupBy,
|
||||
query.aggregateOperator,
|
||||
parsedAggregationOptions,
|
||||
aggregationOptions,
|
||||
generateOptions,
|
||||
isNewQueryV2,
|
||||
]);
|
||||
|
||||
const isDisabledSelect =
|
||||
|
||||
@@ -39,6 +39,7 @@ function setup(query: Partial<IBuilderQuery>): { onChange: jest.Mock } {
|
||||
}
|
||||
onChange={onChange}
|
||||
isRawQuery
|
||||
isNewQueryV2
|
||||
/>,
|
||||
);
|
||||
return { onChange };
|
||||
|
||||
@@ -22,6 +22,7 @@ export type UseOrderByFilterResult = {
|
||||
searchText: string;
|
||||
debouncedSearchText: string;
|
||||
selectedValue: IOption[];
|
||||
aggregationOptions: IOption[];
|
||||
generateOptions: (options: IOption[]) => IOption[];
|
||||
createOptions: (keys: string[]) => IOption[];
|
||||
handleChange: (values: IOption[]) => void;
|
||||
@@ -122,10 +123,29 @@ export const useOrderByFilter = ({
|
||||
[],
|
||||
);
|
||||
|
||||
const aggregationOptions = useMemo(
|
||||
() => [
|
||||
{
|
||||
label: `${query.aggregateOperator}(${query.aggregateAttribute?.key}) ${
|
||||
ORDERBY_FILTERS.ASC
|
||||
}`,
|
||||
value: `${SIGNOZ_VALUE}${orderByValueDelimiter}${ORDERBY_FILTERS.ASC}`,
|
||||
},
|
||||
{
|
||||
label: `${query.aggregateOperator}(${query.aggregateAttribute?.key}) ${
|
||||
ORDERBY_FILTERS.DESC
|
||||
}`,
|
||||
value: `${SIGNOZ_VALUE}${orderByValueDelimiter}${ORDERBY_FILTERS.DESC}`,
|
||||
},
|
||||
],
|
||||
[query],
|
||||
);
|
||||
|
||||
return {
|
||||
searchText,
|
||||
debouncedSearchText,
|
||||
selectedValue,
|
||||
aggregationOptions,
|
||||
createOptions,
|
||||
handleChange,
|
||||
handleSearchKeys,
|
||||
|
||||
@@ -36,3 +36,7 @@
|
||||
border: 1px solid var(--danger-background);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.jsonEditorErrorMessage {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,45 @@
|
||||
padding-bottom: var(--spacing-8);
|
||||
}
|
||||
|
||||
.permissionEditorCollapsedSection {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.permissionEditorCollapsedHeader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-4);
|
||||
width: 100%;
|
||||
padding: var(--spacing-4) var(--spacing-6);
|
||||
background: var(--l3-background);
|
||||
border: 1px dashed var(--l2-border);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--l2-background);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: 2px solid var(--primary);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
}
|
||||
|
||||
.permissionEditorCollapsedLabel {
|
||||
color: var(--l2-foreground);
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.permissionEditorCollapsedCount {
|
||||
color: var(--primary);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.permissionEditorCollapseAction {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
|
||||
@@ -139,6 +139,19 @@
|
||||
|
||||
:global(.ant-pagination-total-text) {
|
||||
margin-right: auto;
|
||||
|
||||
.numbers {
|
||||
font-family: Inter;
|
||||
font-size: 12px;
|
||||
color: var(--foreground);
|
||||
}
|
||||
|
||||
.total {
|
||||
font-family: Inter;
|
||||
font-size: 12px;
|
||||
color: var(--foreground);
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,3 +47,141 @@
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rolesDescriptionTooltip {
|
||||
max-height: none;
|
||||
overflow-y: visible;
|
||||
}
|
||||
|
||||
.rolesListingTable {
|
||||
margin-top: 12px;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.rolesTableScrollContainer {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.rolesTableInner {
|
||||
min-width: 850px;
|
||||
}
|
||||
|
||||
.rolesTableHeader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 16px;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.rolesTableHeaderCell {
|
||||
color: var(--foreground);
|
||||
}
|
||||
|
||||
.rolesTableHeaderCellName {
|
||||
flex: 0 0 180px;
|
||||
}
|
||||
|
||||
.rolesTableHeaderCellDescription {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rolesTableHeaderCellCreatedAt {
|
||||
flex: 0 0 180px;
|
||||
}
|
||||
|
||||
.rolesTableHeaderCellUpdatedAt {
|
||||
flex: 0 0 180px;
|
||||
}
|
||||
|
||||
.rolesTableSectionHeader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
height: 32px;
|
||||
padding: 0 16px;
|
||||
background: color-mix(in srgb, var(--bg-robin-200) 4%, transparent);
|
||||
border-top: 1px solid var(--secondary);
|
||||
border-bottom: 1px solid var(--secondary);
|
||||
color: var(--foreground);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.rolesTableSectionHeaderCount {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 20px;
|
||||
height: 18px;
|
||||
padding: 0 6px;
|
||||
border-radius: 9px;
|
||||
background: var(--l3-background);
|
||||
color: var(--foreground);
|
||||
}
|
||||
|
||||
.rolesTableRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 16px;
|
||||
background: color-mix(in srgb, var(--bg-robin-200) 2%, transparent);
|
||||
border-bottom: 1px solid var(--secondary);
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.rolesTableRowClickable {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: color-mix(in srgb, var(--bg-robin-200) 5%, transparent);
|
||||
}
|
||||
}
|
||||
|
||||
.rolesTableCell {
|
||||
color: var(--foreground);
|
||||
}
|
||||
|
||||
.rolesTableCellName {
|
||||
flex: 0 0 180px;
|
||||
}
|
||||
|
||||
.rolesTableCellDescription {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.rolesTableCellCreatedAt {
|
||||
flex: 0 0 180px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.rolesTableCellUpdatedAt {
|
||||
flex: 0 0 180px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.rolesTableEmpty {
|
||||
padding: 24px 16px;
|
||||
color: var(--foreground);
|
||||
}
|
||||
|
||||
.rolesTablePagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding: 8px 16px;
|
||||
|
||||
:global(.ant-pagination-total-text) {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
:global(.ant-pagination-total-text .numbers) {
|
||||
color: var(--foreground);
|
||||
}
|
||||
|
||||
:global(.ant-pagination-total-text .total) {
|
||||
color: var(--foreground);
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
gap: var(--spacing-6);
|
||||
}
|
||||
|
||||
.unsavedText {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.viewRolePageContent {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -64,6 +68,12 @@
|
||||
color: var(--l2-foreground);
|
||||
}
|
||||
|
||||
.viewRolePageDivider {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background: var(--l1-border);
|
||||
}
|
||||
|
||||
// The one grid row stretches the Tabs root to the height left on the page.
|
||||
.roleTabs {
|
||||
display: grid;
|
||||
|
||||
@@ -15,3 +15,7 @@
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-10);
|
||||
}
|
||||
|
||||
.errorText {
|
||||
padding: var(--spacing-4);
|
||||
}
|
||||
|
||||
@@ -29,3 +29,13 @@ export interface RolePermissionsData {
|
||||
roleDescription: string;
|
||||
resources: ResourcePermissions[];
|
||||
}
|
||||
|
||||
export interface SelectableItem {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface ResourceItemsResult {
|
||||
items: SelectableItem[];
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { SolidAlertTriangle } from '@signozhq/icons';
|
||||
import Flex from 'periscope/components/Flex/Flex';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { ResizeTable } from 'components/ResizeTable';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { MAX_RPS_LIMIT } from 'constants/global';
|
||||
import ResourceAttributesFilter from 'container/ResourceAttributesFilter';
|
||||
import { useGetQueriesRange } from 'hooks/queryBuilder/useGetQueriesRange';
|
||||
@@ -39,7 +40,7 @@ function ServiceMetricTable({
|
||||
const { isFetchingActiveLicense, trialInfo } = useAppContext();
|
||||
const { isCloudUser: isCloudUserVal } = useGetTenantLicense();
|
||||
|
||||
const queries = useGetQueriesRange(queryRangeRequestData, {
|
||||
const queries = useGetQueriesRange(queryRangeRequestData, ENTITY_VERSION_V5, {
|
||||
queryKey: [
|
||||
`GetMetricsQueryRange-${queryRangeRequestData[0]?.selectedTime}-${globalSelectedInterval}`,
|
||||
maxTime,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { QueryKey, useInfiniteQuery } from 'react-query';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { DEFAULT_PER_PAGE_VALUE } from 'container/Controls/config';
|
||||
import { TracesTableRow } from 'container/TracesExplorer/TracesTable/getFieldColumn';
|
||||
@@ -63,6 +64,7 @@ export function useListViewInfiniteQuery({
|
||||
},
|
||||
},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
undefined,
|
||||
signal,
|
||||
),
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useSelector } from 'react-redux';
|
||||
import Space from 'periscope/components/Space/Space';
|
||||
import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
|
||||
import ExportMenu from 'components/ExportMenu/ExportMenu';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import { QueryTable } from 'container/QueryTable';
|
||||
@@ -70,6 +71,7 @@ function TableView({
|
||||
dataSource: 'traces',
|
||||
},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey,
|
||||
enabled: !!stagedQuery && panelType === PANEL_TYPES.TABLE,
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useSelector } from 'react-redux';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import DownloadOptionsMenu from 'components/DownloadOptionsMenu/DownloadOptionsMenu';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
@@ -101,6 +102,7 @@ function TracesView({
|
||||
pagination: pagination.request,
|
||||
},
|
||||
},
|
||||
ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey,
|
||||
keepPreviousData: true,
|
||||
|
||||
@@ -19,6 +19,7 @@ import QueryCancelledPlaceholder from 'components/QueryCancelledPlaceholder';
|
||||
import Spinner from 'components/Spinner';
|
||||
import TimePreference from 'components/TimePreferenceDropDown';
|
||||
import WarningPopover from 'components/WarningPopover/WarningPopover';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { PanelMode } from 'lib/visualization/panels/types';
|
||||
@@ -54,6 +55,7 @@ import 'container/WidgetCard/Card/FullView/WidgetFullView.styles.scss';
|
||||
function FullView({
|
||||
widget,
|
||||
fullViewOptions = true,
|
||||
version,
|
||||
originalName,
|
||||
tableProcessedDataRef,
|
||||
isDependedDataLoaded = false,
|
||||
@@ -168,11 +170,18 @@ function FullView({
|
||||
}, [selectedPanelType]);
|
||||
|
||||
const queryRangeKey = useMemo(
|
||||
() => [widget?.query, selectedPanelType, requestData, minTime, maxTime],
|
||||
[widget?.query, selectedPanelType, requestData, minTime, maxTime],
|
||||
() => [
|
||||
widget?.query,
|
||||
selectedPanelType,
|
||||
requestData,
|
||||
version,
|
||||
minTime,
|
||||
maxTime,
|
||||
],
|
||||
[widget?.query, selectedPanelType, requestData, version, minTime, maxTime],
|
||||
);
|
||||
|
||||
const response = useGetQueryRange(requestData, {
|
||||
const response = useGetQueryRange(requestData, ENTITY_VERSION_V5, {
|
||||
queryKey: queryRangeKey,
|
||||
enabled: !isDependedDataLoaded,
|
||||
keepPreviousData: true,
|
||||
|
||||
@@ -24,6 +24,7 @@ export interface FullViewProps {
|
||||
customOnDragSelect?: (start: number, end: number) => void;
|
||||
name: string;
|
||||
tableProcessedDataRef: MutableRefObject<RowData[]>;
|
||||
version?: string;
|
||||
originalName: string;
|
||||
yAxisUnit?: string;
|
||||
isDependedDataLoaded?: boolean;
|
||||
|
||||
@@ -141,6 +141,7 @@ const mockProps: WidgetGraphComponentProps = {
|
||||
remove: jest.fn(),
|
||||
},
|
||||
errorMessage: '',
|
||||
version: 'v4',
|
||||
headerMenuList: [
|
||||
MenuItemKeys.View,
|
||||
MenuItemKeys.Clone,
|
||||
@@ -169,6 +170,7 @@ describe('WidgetGraphComponent', () => {
|
||||
widget={mockProps.widget}
|
||||
queryResponse={mockProps.queryResponse}
|
||||
errorMessage={mockProps.errorMessage}
|
||||
version={mockProps.version}
|
||||
headerMenuList={mockProps.headerMenuList}
|
||||
isWarning={mockProps.isWarning}
|
||||
isFetchingResponse={mockProps.isFetchingResponse}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { RefObject, useEffect, useRef, useState } from 'react';
|
||||
import { useAppLocation } from 'lib/router/useAppLocation';
|
||||
import { Skeleton, Tooltip } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import cx from 'classnames';
|
||||
import { useNavigateToExplorer } from 'components/CeleryTask/useNavigateToExplorer';
|
||||
import { ToggleGraphProps } from 'components/Graph/types';
|
||||
@@ -37,6 +38,7 @@ import 'container/WidgetCard/WidgetCard.styles.scss';
|
||||
function WidgetGraphComponent({
|
||||
widget,
|
||||
queryResponse,
|
||||
version,
|
||||
threshold,
|
||||
headerMenuList,
|
||||
isWarning,
|
||||
@@ -49,6 +51,7 @@ function WidgetGraphComponent({
|
||||
openTracesButton,
|
||||
onOpenTraceBtnClick,
|
||||
customSeries,
|
||||
customErrorMessage,
|
||||
customOnRowClick,
|
||||
customTimeRangeWindowForCoRelation,
|
||||
enableDrillDown,
|
||||
@@ -206,6 +209,7 @@ function WidgetGraphComponent({
|
||||
>
|
||||
<FullView
|
||||
name={`${widget.id}expanded`}
|
||||
version={version}
|
||||
originalName={widget.id}
|
||||
widget={widget}
|
||||
yAxisUnit={widget.yAxisUnit}
|
||||
@@ -235,6 +239,21 @@ function WidgetGraphComponent({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{queryResponse.error && customErrorMessage && (
|
||||
<div className="error-message-container">
|
||||
<Typography
|
||||
variant="paragraph"
|
||||
size="base"
|
||||
weight="regular"
|
||||
color="warning"
|
||||
as="span"
|
||||
textOverflow="wrap"
|
||||
>
|
||||
{customErrorMessage}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{queryResponse.isLoading && widget.panelTypes !== PANEL_TYPES.LIST && (
|
||||
<div data-testid="widget-graph-loading">
|
||||
<Skeleton />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { prepareQueryRangePayloadV5 } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
|
||||
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
||||
@@ -86,6 +87,7 @@ describe('GridCardGraph', () => {
|
||||
<GridCardGraph
|
||||
widget={widgetFiltering('name in []')}
|
||||
isQueryEnabled={enabledBefore}
|
||||
version={ENTITY_VERSION_V5}
|
||||
/>,
|
||||
);
|
||||
|
||||
@@ -93,6 +95,7 @@ describe('GridCardGraph', () => {
|
||||
<GridCardGraph
|
||||
widget={widgetFiltering("name in ['GET /']")}
|
||||
isQueryEnabled
|
||||
version={ENTITY_VERSION_V5}
|
||||
/>,
|
||||
);
|
||||
|
||||
@@ -110,7 +113,10 @@ describe('GridCardGraph', () => {
|
||||
widgetFiltering(expression, DataSource.LOGS, PANEL_TYPES.LIST);
|
||||
|
||||
const { rerender } = render(
|
||||
<GridCardGraph widget={logsList("severity_text = 'ERROR'")} />,
|
||||
<GridCardGraph
|
||||
widget={logsList("severity_text = 'ERROR'")}
|
||||
version={ENTITY_VERSION_V5}
|
||||
/>,
|
||||
);
|
||||
|
||||
await user.click(
|
||||
@@ -121,7 +127,12 @@ describe('GridCardGraph', () => {
|
||||
await user.click(await screen.findByText('50 / page'));
|
||||
await waitFor(() => expect(lastRequestedLimit()).toBe(50));
|
||||
|
||||
rerender(<GridCardGraph widget={logsList("severity_text = 'WARN'")} />);
|
||||
rerender(
|
||||
<GridCardGraph
|
||||
widget={logsList("severity_text = 'WARN'")}
|
||||
version={ENTITY_VERSION_V5}
|
||||
/>,
|
||||
);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(requestedFilters()).toContain("severity_text = 'WARN'"),
|
||||
|
||||
@@ -2,6 +2,7 @@ import { memo, useEffect, useMemo, useRef, useState } from 'react';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import { QueryParams } from 'constants/query';
|
||||
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { useScrollWidgetIntoView } from 'lib/visualization/hooks/useScrollWidgetIntoView';
|
||||
@@ -14,6 +15,7 @@ import getTimeString from 'lib/getTimeString';
|
||||
import isEmpty from 'lodash-es/isEmpty';
|
||||
import { UpdateTimeInterval } from 'store/actions';
|
||||
import { AppState } from 'store/reducers';
|
||||
import APIError from 'types/api/error';
|
||||
import { DataSource } from 'types/common/queryBuilder';
|
||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||
import { getGraphType } from 'utils/getGraphType';
|
||||
@@ -39,6 +41,7 @@ function GridCardGraph({
|
||||
headerMenuList = [MenuItemKeys.View],
|
||||
isQueryEnabled,
|
||||
threshold,
|
||||
version,
|
||||
onClickHandler,
|
||||
onDragSelect,
|
||||
customOnDragSelect,
|
||||
@@ -59,6 +62,8 @@ function GridCardGraph({
|
||||
}: GridCardGraphProps): JSX.Element {
|
||||
const dispatch = useDispatch();
|
||||
const [errorMessage, setErrorMessage] = useState<string>();
|
||||
const [isInternalServerError, setIsInternalServerError] =
|
||||
useState<boolean>(false);
|
||||
const {
|
||||
minTime,
|
||||
maxTime,
|
||||
@@ -166,6 +171,7 @@ function GridCardGraph({
|
||||
end: customTimeRange?.endTime || end,
|
||||
originalGraphType: widget?.panelTypes,
|
||||
},
|
||||
version || ENTITY_VERSION_V5,
|
||||
{
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.DASHBOARD_GRID_CARD_QUERY_RANGE,
|
||||
@@ -182,7 +188,16 @@ function GridCardGraph({
|
||||
? [customTimeRange.startTime, customTimeRange.endTime]
|
||||
: []),
|
||||
],
|
||||
retry: 2,
|
||||
retry(failureCount, error): boolean {
|
||||
if (
|
||||
String(error).includes('status: error') &&
|
||||
String(error).includes('i/o timeout')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return failureCount < 2;
|
||||
},
|
||||
keepPreviousData: true,
|
||||
cacheTime: isAutoRefreshDisabled
|
||||
? DASHBOARD_CACHE_TIME
|
||||
@@ -190,11 +205,21 @@ function GridCardGraph({
|
||||
enabled: queryEnabledCondition,
|
||||
refetchOnMount: false,
|
||||
onError: (error) => {
|
||||
setErrorMessage(errorDetails(error));
|
||||
if (customErrorMessage && analyticsEvent) {
|
||||
void logEvent(analyticsEvent, {
|
||||
error: error.message,
|
||||
});
|
||||
const errorMessage =
|
||||
version === ENTITY_VERSION_V5
|
||||
? errorDetails(error as APIError)
|
||||
: error.message;
|
||||
|
||||
setErrorMessage(errorMessage);
|
||||
if (customErrorMessage) {
|
||||
setIsInternalServerError(
|
||||
String(error.message).includes('API responded with 500'),
|
||||
);
|
||||
if (analyticsEvent) {
|
||||
void logEvent(analyticsEvent, {
|
||||
error: error.message,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onSettled: (data) => {
|
||||
@@ -237,6 +262,7 @@ function GridCardGraph({
|
||||
queryResponse={queryResponse}
|
||||
errorMessage={errorMessage}
|
||||
isWarning={!isEmpty(queryResponse.data?.warning)}
|
||||
version={version}
|
||||
threshold={threshold}
|
||||
headerMenuList={menuList}
|
||||
isFetchingResponse={queryResponse.isFetching}
|
||||
@@ -248,6 +274,7 @@ function GridCardGraph({
|
||||
openTracesButton={openTracesButton}
|
||||
onOpenTraceBtnClick={onOpenTraceBtnClick}
|
||||
customSeries={customSeries}
|
||||
customErrorMessage={isInternalServerError ? customErrorMessage : undefined}
|
||||
customOnRowClick={customOnRowClick}
|
||||
customTimeRangeWindowForCoRelation={customTimeRangeWindowForCoRelation}
|
||||
enableDrillDown={enableDrillDown}
|
||||
@@ -263,6 +290,7 @@ GridCardGraph.defaultProps = {
|
||||
isQueryEnabled: true,
|
||||
threshold: undefined,
|
||||
headerMenuList: [MenuItemKeys.View],
|
||||
version: ENTITY_VERSION_V5,
|
||||
analyticsEvent: undefined,
|
||||
customTimeRangeWindowForCoRelation: undefined,
|
||||
enableDrillDown: false,
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface WidgetGraphComponentProps {
|
||||
widget: Widgets;
|
||||
queryResponse: UseQueryResult<MetricQueryRangeSuccessResponse, Error>;
|
||||
errorMessage: string | undefined;
|
||||
version?: string;
|
||||
threshold?: ReactNode;
|
||||
headerMenuList: MenuItemKeys[];
|
||||
isWarning: boolean;
|
||||
@@ -35,6 +36,7 @@ export interface WidgetGraphComponentProps {
|
||||
openTracesButton?: boolean;
|
||||
onOpenTraceBtnClick?: (record: RowData) => void;
|
||||
customSeries?: (data: QueryData[]) => uPlot.Series[];
|
||||
customErrorMessage?: string;
|
||||
customOnRowClick?: (record: RowData) => void;
|
||||
customTimeRangeWindowForCoRelation?: string | undefined;
|
||||
enableDrillDown?: boolean;
|
||||
@@ -48,6 +50,7 @@ export interface GridCardGraphProps {
|
||||
headerMenuList?: WidgetGraphComponentProps['headerMenuList'];
|
||||
onClickHandler?: OnClickPluginOpts['onClick'];
|
||||
isQueryEnabled: boolean;
|
||||
version?: string;
|
||||
onDragSelect: (start: number, end: number) => void;
|
||||
customOnDragSelect?: (start: number, end: number) => void;
|
||||
customTooltipElement?: HTMLDivElement;
|
||||
|
||||
@@ -15,7 +15,7 @@ function ValuePanelWrapper({
|
||||
?.rows?.[0]?.data || {},
|
||||
);
|
||||
|
||||
// a value panel gets a scalar response, which has no series, only a table row
|
||||
// this is for handling both query_range v3 and v5 responses
|
||||
const gridValueData = data?.[0].length > 0 ? data : [[0], dataNew];
|
||||
|
||||
return (
|
||||
|
||||
@@ -24,6 +24,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
.error-message-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding-top: 0;
|
||||
padding-bottom: 32px;
|
||||
}
|
||||
|
||||
.row-settings {
|
||||
.ant-popover-inner {
|
||||
width: 191px;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user