Compare commits

..

10 Commits

Author SHA1 Message Date
Vinícius Lourenço
802830aa41 perf(web): serve precompressed gzip twins of the frontend files 2026-12-02 09:26:20 -03:00
Vinícius Lourenço
21a2096ccd perf(http): swap gorilla compress handler for klauspost gzhttp 2026-12-02 09:26:20 -03:00
Vinícius Lourenço
3040b402d7 test(e2e): disable response compression on the e2e server 2026-12-02 09:26:20 -03:00
Vinícius Lourenço
08dea1fb8d feat(apiserver): add apiserver.compression.enabled 2026-12-02 09:26:19 -03:00
Vinícius Lourenço
3a00eb69fe Merge remote-tracking branch 'origin/main' into perf/web-immutable-assets 2026-12-02 09:26:04 -03:00
Vinícius Lourenço
f0c1f4bbf9 test(http): name the cache control table loop variable testCase 2026-12-01 10:37:24 -03:00
Vinícius Lourenço
8fad61a8b5 Merge remote-tracking branch 'origin/main' into perf/web-immutable-assets
# Conflicts:
#	frontend/vite.config.ts
2026-12-01 10:22:46 -03:00
Vinícius Lourenço
ed69006a2a refactor(web): set the immutable cache header from the cache middleware on an /assets/ route 2026-12-01 10:21:58 -03:00
Vinícius Lourenço
649c3a250c build(web): pin hashed asset names that the immutable cache relies on 2026-11-23 22:46:11 -03:00
Vinícius Lourenço
f7b1383427 perf(web): cache hashed frontend assets as immutable 2026-11-23 22:46:09 -03:00
379 changed files with 5309 additions and 10546 deletions

View File

@@ -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.

36
.github/CODEOWNERS vendored
View File

@@ -113,21 +113,21 @@ go.mod @therealpandey
/pkg/modules/role/ @therealpandey
/pkg/types/coretypes/ @therealpandey @vikrantgupta25
/frontend/src/lib/authz/ @SigNoz/frontend-maintainers
/frontend/src/container/RolesSettings/ @SigNoz/frontend-maintainers
/frontend/src/components/RolesSelect/ @SigNoz/frontend-maintainers
/frontend/src/pages/MembersSettings/ @SigNoz/frontend-maintainers
/frontend/src/container/MembersSettings/ @SigNoz/frontend-maintainers
/frontend/src/components/MembersTable/ @SigNoz/frontend-maintainers
/frontend/src/components/EditMemberDrawer/ @SigNoz/frontend-maintainers
/frontend/src/components/InviteMembersModal/ @SigNoz/frontend-maintainers
/frontend/src/hooks/member/ @SigNoz/frontend-maintainers
/frontend/src/pages/ServiceAccountsSettings/ @SigNoz/frontend-maintainers
/frontend/src/container/ServiceAccountsSettings/ @SigNoz/frontend-maintainers
/frontend/src/components/ServiceAccountsTable/ @SigNoz/frontend-maintainers
/frontend/src/components/ServiceAccountDrawer/ @SigNoz/frontend-maintainers
/frontend/src/components/CreateServiceAccountModal/ @SigNoz/frontend-maintainers
/frontend/src/hooks/serviceAccount/ @SigNoz/frontend-maintainers
/frontend/src/lib/authz/ @H4ad
/frontend/src/container/RolesSettings/ @H4ad
/frontend/src/components/RolesSelect/ @H4ad
/frontend/src/pages/MembersSettings/ @H4ad
/frontend/src/container/MembersSettings/ @H4ad
/frontend/src/components/MembersTable/ @H4ad
/frontend/src/components/EditMemberDrawer/ @H4ad
/frontend/src/components/InviteMembersModal/ @H4ad
/frontend/src/hooks/member/ @H4ad
/frontend/src/pages/ServiceAccountsSettings/ @H4ad
/frontend/src/container/ServiceAccountsSettings/ @H4ad
/frontend/src/components/ServiceAccountsTable/ @H4ad
/frontend/src/components/ServiceAccountDrawer/ @H4ad
/frontend/src/components/CreateServiceAccountModal/ @H4ad
/frontend/src/hooks/serviceAccount/ @H4ad
# IdentN Owners
@@ -308,9 +308,9 @@ go.mod @therealpandey
/frontend/src/container/BottomStrip/ @aks07
## Storybook
/frontend/.storybook/ @SigNoz/frontend-maintainers
/frontend/src/storybook/ @SigNoz/frontend-maintainers
/.claude/skills/signoz-page-story/ @SigNoz/frontend-maintainers
/frontend/.storybook/ @H4ad
/frontend/src/storybook/ @H4ad
/.claude/skills/signoz-page-story/ @H4ad
## AI Assistant
/frontend/src/container/AIAssistant/ @SigNoz/nerve @SigNoz/frontend-maintainers

View File

@@ -138,7 +138,6 @@ func runGenerateAuthz(_ context.Context) error {
coretypes.NewResourceRef(coretypes.ResourceMetaResourceRule).String(): true,
coretypes.NewResourceRef(coretypes.ResourceMetaResourceRoutePolicy).String(): true,
coretypes.NewResourceRef(coretypes.ResourceMetaResourcePlannedMaintenance).String(): true,
coretypes.NewResourceRef(coretypes.ResourceTelemetryResourceAuditLogs).String(): true,
}
allowedTypes := map[string]bool{}

View File

@@ -165,6 +165,11 @@ apiserver:
- /api/v1/health
- /api/v1/version
- /
- /assets/
compression:
# Gzip responses on the fly. Turn off when a proxy in front already compresses.
# Web files shipped with a .gz twin are served precompressed either way.
enabled: true
##################### Querier #####################
querier:

View File

@@ -13065,12 +13065,6 @@ components:
additionalProperties: {}
description: All of them for a span read by ID; the selected ones in a list.
type: object
db_name:
description: Omitted when empty, and in a list unless selected.
type: string
db_operation:
description: Omitted when empty, and in a list unless selected.
type: string
duration_nano:
minimum: 0
type: integer
@@ -13079,26 +13073,8 @@ components:
items:
$ref: '#/components/schemas/SpantypesEvent'
type: array
external_http_method:
description: Method of an outgoing HTTP call. Omitted when empty, and in
a list unless selected.
type: string
external_http_url:
description: Host of an outgoing HTTP call. Omitted when empty, and in a
list unless selected.
type: string
has_error:
type: boolean
http_host:
description: Host or server address. Omitted when empty, and in a list unless
selected.
type: string
http_method:
description: Omitted when empty, and in a list unless selected.
type: string
http_url:
description: Omitted when empty, and in a list unless selected.
type: string
kind_string:
description: For example Server, Client or Internal.
type: string
@@ -13121,11 +13097,6 @@ components:
response_status_code:
description: HTTP or gRPC status code, for example 404.
type: string
scope:
allOf:
- $ref: '#/components/schemas/SpantypesScope'
description: Instrumentation scope. Omitted when empty, and in a list unless
selected.
span_id:
type: string
status_code_string:
@@ -13139,9 +13110,6 @@ components:
type: integer
trace_id:
type: string
trace_state:
description: W3C trace state. Omitted when empty, and in a list unless selected.
type: string
required:
- span_id
- trace_id
@@ -14528,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":
@@ -14577,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:
@@ -14636,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
@@ -14683,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
@@ -14742,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
@@ -14801,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:
@@ -16319,15 +16281,15 @@ paths:
- $ref: '#/components/schemas/TelemetrytypesSignal'
description: 'The signal to look up keys in: traces, logs or metrics. Empty
searches every signal.'
- description: The data source within the signal. Use audit for audit logs or
meter for Cost Meter metrics; empty means the default source.
- description: The data source within the signal. Use meter for Cost Meter metrics;
empty means the default source.
in: query
name: source
schema:
allOf:
- $ref: '#/components/schemas/TelemetrytypesSource'
description: The data source within the signal. Use audit for audit logs
or meter for Cost Meter metrics; empty means the default source.
description: The data source within the signal. Use meter for Cost Meter
metrics; empty means the default source.
- description: Maximum number of results per signal. Defaults to 1000 for keys
and 50 for values. For keys, intrinsic and materialized fields are added
on top, and an empty signal applies the limit to traces, logs and metrics
@@ -16341,31 +16303,27 @@ paths:
metrics separately, so the response can exceed it.
type: integer
- description: Start of the lookup window in Unix milliseconds, rounded down
to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30 day
lookback) and meter lookups; trace and log values apply it at calendar-day
granularity; metric attribute values and relatedValues apply it. Omit for
no lower bound.
to a 6 hour boundary. Ignored for key lookups and meter lookups; trace and
log values apply it at calendar-day granularity; metric attribute values
and relatedValues apply it. Omit for no lower bound.
in: query
name: startUnixMilli
schema:
description: Start of the lookup window in Unix milliseconds, rounded down
to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30
day lookback) and meter lookups; trace and log values apply it at calendar-day
granularity; metric attribute values and relatedValues apply it. Omit
for no lower bound.
to a 6 hour boundary. Ignored for key lookups and meter lookups; trace
and log values apply it at calendar-day granularity; metric attribute
values and relatedValues apply it. Omit for no lower bound.
format: int64
type: integer
- description: End of the lookup window in Unix milliseconds. Ignored for key
lookups, trace and log value lookups, audit lookups (fixed 30 day lookback)
and meter lookups; applied to metric attribute values and relatedValues.
Omit for no upper bound.
lookups, trace and log value lookups and meter lookups; applied to metric
attribute values and relatedValues. Omit for no upper bound.
in: query
name: endUnixMilli
schema:
description: End of the lookup window in Unix milliseconds. Ignored for
key lookups, trace and log value lookups, audit lookups (fixed 30 day
lookback) and meter lookups; applied to metric attribute values and relatedValues.
Omit for no upper bound.
key lookups, trace and log value lookups and meter lookups; applied to
metric attribute values and relatedValues. Omit for no upper bound.
format: int64
type: integer
- description: 'Restricts keys to one context: resource, attribute, scope, span,
@@ -16473,15 +16431,15 @@ paths:
- $ref: '#/components/schemas/TelemetrytypesSignal'
description: 'The signal to look up keys in: traces, logs or metrics. Empty
searches every signal.'
- description: The data source within the signal. Use audit for audit logs or
meter for Cost Meter metrics; empty means the default source.
- description: The data source within the signal. Use meter for Cost Meter metrics;
empty means the default source.
in: query
name: source
schema:
allOf:
- $ref: '#/components/schemas/TelemetrytypesSource'
description: The data source within the signal. Use audit for audit logs
or meter for Cost Meter metrics; empty means the default source.
description: The data source within the signal. Use meter for Cost Meter
metrics; empty means the default source.
- description: Maximum number of results per signal. Defaults to 1000 for keys
and 50 for values. For keys, intrinsic and materialized fields are added
on top, and an empty signal applies the limit to traces, logs and metrics
@@ -16495,31 +16453,27 @@ paths:
metrics separately, so the response can exceed it.
type: integer
- description: Start of the lookup window in Unix milliseconds, rounded down
to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30 day
lookback) and meter lookups; trace and log values apply it at calendar-day
granularity; metric attribute values and relatedValues apply it. Omit for
no lower bound.
to a 6 hour boundary. Ignored for key lookups and meter lookups; trace and
log values apply it at calendar-day granularity; metric attribute values
and relatedValues apply it. Omit for no lower bound.
in: query
name: startUnixMilli
schema:
description: Start of the lookup window in Unix milliseconds, rounded down
to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30
day lookback) and meter lookups; trace and log values apply it at calendar-day
granularity; metric attribute values and relatedValues apply it. Omit
for no lower bound.
to a 6 hour boundary. Ignored for key lookups and meter lookups; trace
and log values apply it at calendar-day granularity; metric attribute
values and relatedValues apply it. Omit for no lower bound.
format: int64
type: integer
- description: End of the lookup window in Unix milliseconds. Ignored for key
lookups, trace and log value lookups, audit lookups (fixed 30 day lookback)
and meter lookups; applied to metric attribute values and relatedValues.
Omit for no upper bound.
lookups, trace and log value lookups and meter lookups; applied to metric
attribute values and relatedValues. Omit for no upper bound.
in: query
name: endUnixMilli
schema:
description: End of the lookup window in Unix milliseconds. Ignored for
key lookups, trace and log value lookups, audit lookups (fixed 30 day
lookback) and meter lookups; applied to metric attribute values and relatedValues.
Omit for no upper bound.
key lookups, trace and log value lookups and meter lookups; applied to
metric attribute values and relatedValues. Omit for no upper bound.
format: int64
type: integer
- description: 'Restricts keys to one context: resource, attribute, scope, span,
@@ -29606,15 +29560,15 @@ paths:
- $ref: '#/components/schemas/TelemetrytypesSignal'
description: 'The signal to look up keys in: traces, logs or metrics. Empty
searches every signal.'
- description: The data source within the signal. Use audit for audit logs or
meter for Cost Meter metrics; empty means the default source.
- description: The data source within the signal. Use meter for Cost Meter metrics;
empty means the default source.
in: query
name: source
schema:
allOf:
- $ref: '#/components/schemas/TelemetrytypesSource'
description: The data source within the signal. Use audit for audit logs
or meter for Cost Meter metrics; empty means the default source.
description: The data source within the signal. Use meter for Cost Meter
metrics; empty means the default source.
- description: Maximum number of results per signal. Defaults to 1000 for keys
and 50 for values. For keys, intrinsic and materialized fields are added
on top, and an empty signal applies the limit to traces, logs and metrics
@@ -29628,31 +29582,27 @@ paths:
metrics separately, so the response can exceed it.
type: integer
- description: Start of the lookup window in Unix milliseconds, rounded down
to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30 day
lookback) and meter lookups; trace and log values apply it at calendar-day
granularity; metric attribute values and relatedValues apply it. Omit for
no lower bound.
to a 6 hour boundary. Ignored for key lookups and meter lookups; trace and
log values apply it at calendar-day granularity; metric attribute values
and relatedValues apply it. Omit for no lower bound.
in: query
name: startUnixMilli
schema:
description: Start of the lookup window in Unix milliseconds, rounded down
to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30
day lookback) and meter lookups; trace and log values apply it at calendar-day
granularity; metric attribute values and relatedValues apply it. Omit
for no lower bound.
to a 6 hour boundary. Ignored for key lookups and meter lookups; trace
and log values apply it at calendar-day granularity; metric attribute
values and relatedValues apply it. Omit for no lower bound.
format: int64
type: integer
- description: End of the lookup window in Unix milliseconds. Ignored for key
lookups, trace and log value lookups, audit lookups (fixed 30 day lookback)
and meter lookups; applied to metric attribute values and relatedValues.
Omit for no upper bound.
lookups, trace and log value lookups and meter lookups; applied to metric
attribute values and relatedValues. Omit for no upper bound.
in: query
name: endUnixMilli
schema:
description: End of the lookup window in Unix milliseconds. Ignored for
key lookups, trace and log value lookups, audit lookups (fixed 30 day
lookback) and meter lookups; applied to metric attribute values and relatedValues.
Omit for no upper bound.
key lookups, trace and log value lookups and meter lookups; applied to
metric attribute values and relatedValues. Omit for no upper bound.
format: int64
type: integer
- description: 'Restricts keys to one context: resource, attribute, scope, span,
@@ -29784,15 +29734,15 @@ paths:
- $ref: '#/components/schemas/TelemetrytypesSignal'
description: 'The signal to look up keys in: traces, logs or metrics. Empty
searches every signal.'
- description: The data source within the signal. Use audit for audit logs or
meter for Cost Meter metrics; empty means the default source.
- description: The data source within the signal. Use meter for Cost Meter metrics;
empty means the default source.
in: query
name: source
schema:
allOf:
- $ref: '#/components/schemas/TelemetrytypesSource'
description: The data source within the signal. Use audit for audit logs
or meter for Cost Meter metrics; empty means the default source.
description: The data source within the signal. Use meter for Cost Meter
metrics; empty means the default source.
- description: Maximum number of results per signal. Defaults to 1000 for keys
and 50 for values. For keys, intrinsic and materialized fields are added
on top, and an empty signal applies the limit to traces, logs and metrics
@@ -29806,31 +29756,27 @@ paths:
metrics separately, so the response can exceed it.
type: integer
- description: Start of the lookup window in Unix milliseconds, rounded down
to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30 day
lookback) and meter lookups; trace and log values apply it at calendar-day
granularity; metric attribute values and relatedValues apply it. Omit for
no lower bound.
to a 6 hour boundary. Ignored for key lookups and meter lookups; trace and
log values apply it at calendar-day granularity; metric attribute values
and relatedValues apply it. Omit for no lower bound.
in: query
name: startUnixMilli
schema:
description: Start of the lookup window in Unix milliseconds, rounded down
to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30
day lookback) and meter lookups; trace and log values apply it at calendar-day
granularity; metric attribute values and relatedValues apply it. Omit
for no lower bound.
to a 6 hour boundary. Ignored for key lookups and meter lookups; trace
and log values apply it at calendar-day granularity; metric attribute
values and relatedValues apply it. Omit for no lower bound.
format: int64
type: integer
- description: End of the lookup window in Unix milliseconds. Ignored for key
lookups, trace and log value lookups, audit lookups (fixed 30 day lookback)
and meter lookups; applied to metric attribute values and relatedValues.
Omit for no upper bound.
lookups, trace and log value lookups and meter lookups; applied to metric
attribute values and relatedValues. Omit for no upper bound.
in: query
name: endUnixMilli
schema:
description: End of the lookup window in Unix milliseconds. Ignored for
key lookups, trace and log value lookups, audit lookups (fixed 30 day
lookback) and meter lookups; applied to metric attribute values and relatedValues.
Omit for no upper bound.
key lookups, trace and log value lookups and meter lookups; applied to
metric attribute values and relatedValues. Omit for no upper bound.
format: int64
type: integer
- description: 'Restricts keys to one context: resource, attribute, scope, span,

3
frontend/.gitignore vendored
View File

@@ -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

View File

@@ -53,7 +53,6 @@ const EXCLUDED_PLUGINS = [
'vite-plugin-checker',
'dev-base-path',
'dev-boot-data',
'signoz:inline-boot-guard',
'vite-plugin-compression',
];

View File

@@ -190,7 +190,6 @@ const preview: Preview = {
['Overview', 'Kafka', 'Kafka Detail', 'Celery'],
'Onboarding',
['Questionnaire', 'Add Data Source'],
'Audit Logs',
'Settings',
[
'Workspace',

View File

@@ -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)?$': [

View File

@@ -61,6 +61,5 @@
"AI_OBSERVABILITY_OVERVIEW": "SigNoz | AI Observability Overview",
"AI_OBSERVABILITY_EXPLORER": "SigNoz | AI Observability Explorer",
"AI_OBSERVABILITY_CONFIGURATION": "SigNoz | AI Observability Configuration",
"AI_OBSERVABILITY_ATTRIBUTE_MAPPING": "SigNoz | AI Observability Attribute Mapping",
"AUDIT_LOGS": "SigNoz | Audit Logs"
"AI_OBSERVABILITY_ATTRIBUTE_MAPPING": "SigNoz | AI Observability Attribute Mapping"
}

View File

@@ -82,6 +82,5 @@
"AI_OBSERVABILITY_OVERVIEW": "SigNoz | AI Observability Overview",
"AI_OBSERVABILITY_EXPLORER": "SigNoz | AI Observability Explorer",
"AI_OBSERVABILITY_CONFIGURATION": "SigNoz | AI Observability Configuration",
"AI_OBSERVABILITY_ATTRIBUTE_MAPPING": "SigNoz | AI Observability Attribute Mapping",
"AUDIT_LOGS": "SigNoz | Audit Logs"
"AI_OBSERVABILITY_ATTRIBUTE_MAPPING": "SigNoz | AI Observability Attribute Mapping"
}

View File

@@ -1768,7 +1768,6 @@ describe('PrivateRoute', () => {
deniedRoles: DENIED_ROLES,
},
BILLING: { path: ROUTES.BILLING, deniedRoles: DENIED_ROLES },
AUDIT_LOGS: { path: ROUTES.AUDIT_LOGS, deniedRoles: DENIED_ROLES },
};
const authzRouteRolePairs: [string, string, ROLES][] = Object.entries(

View File

@@ -292,10 +292,3 @@ export const LLMObservabilityPage = Loadable(
/* webpackChunkName: "LLM Observability Page" */ 'pages/LLMObservability'
),
);
export const AuditLogsPage = Loadable(
() =>
import(
/* webpackChunkName: "Audit Logs Page" */ 'pages/AuditLogsModule/AuditLogsModule'
),
);

View File

@@ -7,7 +7,6 @@ import {
AlertOverview,
AllErrors,
ApiMonitoring,
AuditLogsPage,
ChannelsEdit,
ChannelsNew,
CreateNewAlerts,
@@ -409,12 +408,6 @@ const routes: AppRoutes[] = [
key: 'AI_OBSERVABILITY_CONFIGURATION',
isPrivate: true,
},
{
path: ROUTES.AUDIT_LOGS,
component: AuditLogsPage,
key: 'AUDIT_LOGS',
isPrivate: true,
},
];
export const SUPPORT_ROUTE: AppRoutes = {

View File

@@ -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 = <

View File

@@ -14681,16 +14681,6 @@ export interface SpantypesSpanDTO {
* @description All of them for a span read by ID; the selected ones in a list.
*/
attributes: SpantypesSpanDTOAttributes;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
db_name?: string;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
db_operation?: string;
/**
* @type integer
* @minimum 0
@@ -14701,35 +14691,10 @@ export interface SpantypesSpanDTO {
* @description All of them for a span read by ID; none in a list.
*/
events: SpantypesEventDTO[];
/**
* @type string
* @description Method of an outgoing HTTP call. Omitted when empty, and in a list unless selected.
*/
external_http_method?: string;
/**
* @type string
* @description Host of an outgoing HTTP call. Omitted when empty, and in a list unless selected.
*/
external_http_url?: string;
/**
* @type boolean
*/
has_error: boolean;
/**
* @type string
* @description Host or server address. Omitted when empty, and in a list unless selected.
*/
http_host?: string;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
http_method?: string;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
http_url?: string;
/**
* @type string
* @description For example Server, Client or Internal.
@@ -14759,10 +14724,6 @@ export interface SpantypesSpanDTO {
* @description HTTP or gRPC status code, for example 404.
*/
response_status_code: string;
/**
* @description Instrumentation scope. Omitted when empty, and in a list unless selected.
*/
scope?: SpantypesScopeDTO;
/**
* @type string
*/
@@ -14786,11 +14747,6 @@ export interface SpantypesSpanDTO {
* @type string
*/
trace_id: string;
/**
* @type string
* @description W3C trace state. Omitted when empty, and in a list unless selected.
*/
trace_state?: string;
}
export interface SpantypesSpanTextMatchDTO {
@@ -15821,7 +15777,7 @@ export type GetFieldsKeysParams = {
*/
signal?: TelemetrytypesSignalDTO;
/**
* @description The data source within the signal. Use audit for audit logs or meter for Cost Meter metrics; empty means the default source.
* @description The data source within the signal. Use meter for Cost Meter metrics; empty means the default source.
*/
source?: TelemetrytypesSourceDTO;
/**
@@ -15832,13 +15788,13 @@ export type GetFieldsKeysParams = {
/**
* @type integer
* @format int64
* @description Start of the lookup window in Unix milliseconds, rounded down to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30 day lookback) and meter lookups; trace and log values apply it at calendar-day granularity; metric attribute values and relatedValues apply it. Omit for no lower bound.
* @description Start of the lookup window in Unix milliseconds, rounded down to a 6 hour boundary. Ignored for key lookups and meter lookups; trace and log values apply it at calendar-day granularity; metric attribute values and relatedValues apply it. Omit for no lower bound.
*/
startUnixMilli?: number;
/**
* @type integer
* @format int64
* @description End of the lookup window in Unix milliseconds. Ignored for key lookups, trace and log value lookups, audit lookups (fixed 30 day lookback) and meter lookups; applied to metric attribute values and relatedValues. Omit for no upper bound.
* @description End of the lookup window in Unix milliseconds. Ignored for key lookups, trace and log value lookups and meter lookups; applied to metric attribute values and relatedValues. Omit for no upper bound.
*/
endUnixMilli?: number;
/**
@@ -15880,7 +15836,7 @@ export type GetFieldsValuesParams = {
*/
signal?: TelemetrytypesSignalDTO;
/**
* @description The data source within the signal. Use audit for audit logs or meter for Cost Meter metrics; empty means the default source.
* @description The data source within the signal. Use meter for Cost Meter metrics; empty means the default source.
*/
source?: TelemetrytypesSourceDTO;
/**
@@ -15891,13 +15847,13 @@ export type GetFieldsValuesParams = {
/**
* @type integer
* @format int64
* @description Start of the lookup window in Unix milliseconds, rounded down to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30 day lookback) and meter lookups; trace and log values apply it at calendar-day granularity; metric attribute values and relatedValues apply it. Omit for no lower bound.
* @description Start of the lookup window in Unix milliseconds, rounded down to a 6 hour boundary. Ignored for key lookups and meter lookups; trace and log values apply it at calendar-day granularity; metric attribute values and relatedValues apply it. Omit for no lower bound.
*/
startUnixMilli?: number;
/**
* @type integer
* @format int64
* @description End of the lookup window in Unix milliseconds. Ignored for key lookups, trace and log value lookups, audit lookups (fixed 30 day lookback) and meter lookups; applied to metric attribute values and relatedValues. Omit for no upper bound.
* @description End of the lookup window in Unix milliseconds. Ignored for key lookups, trace and log value lookups and meter lookups; applied to metric attribute values and relatedValues. Omit for no upper bound.
*/
endUnixMilli?: number;
/**
@@ -17626,7 +17582,7 @@ export type GetRuleHistoryFilterKeysParams = {
*/
signal?: TelemetrytypesSignalDTO;
/**
* @description The data source within the signal. Use audit for audit logs or meter for Cost Meter metrics; empty means the default source.
* @description The data source within the signal. Use meter for Cost Meter metrics; empty means the default source.
*/
source?: TelemetrytypesSourceDTO;
/**
@@ -17637,13 +17593,13 @@ export type GetRuleHistoryFilterKeysParams = {
/**
* @type integer
* @format int64
* @description Start of the lookup window in Unix milliseconds, rounded down to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30 day lookback) and meter lookups; trace and log values apply it at calendar-day granularity; metric attribute values and relatedValues apply it. Omit for no lower bound.
* @description Start of the lookup window in Unix milliseconds, rounded down to a 6 hour boundary. Ignored for key lookups and meter lookups; trace and log values apply it at calendar-day granularity; metric attribute values and relatedValues apply it. Omit for no lower bound.
*/
startUnixMilli?: number;
/**
* @type integer
* @format int64
* @description End of the lookup window in Unix milliseconds. Ignored for key lookups, trace and log value lookups, audit lookups (fixed 30 day lookback) and meter lookups; applied to metric attribute values and relatedValues. Omit for no upper bound.
* @description End of the lookup window in Unix milliseconds. Ignored for key lookups, trace and log value lookups and meter lookups; applied to metric attribute values and relatedValues. Omit for no upper bound.
*/
endUnixMilli?: number;
/**
@@ -17688,7 +17644,7 @@ export type GetRuleHistoryFilterValuesParams = {
*/
signal?: TelemetrytypesSignalDTO;
/**
* @description The data source within the signal. Use audit for audit logs or meter for Cost Meter metrics; empty means the default source.
* @description The data source within the signal. Use meter for Cost Meter metrics; empty means the default source.
*/
source?: TelemetrytypesSourceDTO;
/**
@@ -17699,13 +17655,13 @@ export type GetRuleHistoryFilterValuesParams = {
/**
* @type integer
* @format int64
* @description Start of the lookup window in Unix milliseconds, rounded down to a 6 hour boundary. Ignored for key lookups, audit lookups (fixed 30 day lookback) and meter lookups; trace and log values apply it at calendar-day granularity; metric attribute values and relatedValues apply it. Omit for no lower bound.
* @description Start of the lookup window in Unix milliseconds, rounded down to a 6 hour boundary. Ignored for key lookups and meter lookups; trace and log values apply it at calendar-day granularity; metric attribute values and relatedValues apply it. Omit for no lower bound.
*/
startUnixMilli?: number;
/**
* @type integer
* @format int64
* @description End of the lookup window in Unix milliseconds. Ignored for key lookups, trace and log value lookups, audit lookups (fixed 30 day lookback) and meter lookups; applied to metric attribute values and relatedValues. Omit for no upper bound.
* @description End of the lookup window in Unix milliseconds. Ignored for key lookups, trace and log value lookups and meter lookups; applied to metric attribute values and relatedValues. Omit for no upper bound.
*/
endUnixMilli?: number;
/**

View File

@@ -396,20 +396,16 @@ describe('convertV5ResponseToLegacy', () => {
meta: { rowsScanned: 0, bytesScanned: 0, durationMs: 0, stepIntervals: {} },
} as unknown as QueryRangeResponseV5;
const baseSpec = {
name: 'A',
stepInterval: 60,
disabled: false,
aggregations: [],
};
const params = makeBaseParams(type as RequestType, [
{
type: 'builder_query',
spec:
type === 'trace'
? { ...baseSpec, signal: 'traces' }
: { ...baseSpec, signal: 'logs' },
spec: {
name: 'A',
signal: type === 'trace' ? 'traces' : 'logs',
stepInterval: 60,
disabled: false,
aggregations: [],
},
},
]);
@@ -471,34 +467,5 @@ describe('convertV5ResponseToLegacy', () => {
const data = (result.payload.data.result[0].list?.[0] as any)?.data ?? {};
expect('body' in data).toBe(false);
});
const getRowData = (
result: ReturnType<typeof convertV5ResponseToLegacy>,
): Record<string, unknown> =>
(result.payload.data.result[0].list?.[0] as any)?.data ?? {};
it('lifts resource.attributes onto resource', () => {
const result = makeRawResult([
{
timestamp: '2026-07-21T00:00:00Z',
data: {
resource: { attributes: { 'signoz.resource.kind': 'dashboard' } },
},
},
]);
expect(getRowData(result).resource).toStrictEqual({
'signoz.resource.kind': 'dashboard',
});
});
it('leaves a flat resource unchanged', () => {
const resource = { 'service.name': 'signoz' };
const result = makeRawResult([
{ timestamp: '2026-07-21T00:00:00Z', data: { resource } },
]);
expect(getRowData(result).resource).toStrictEqual(resource);
});
});
});

View File

@@ -1,5 +1,5 @@
import { extractOnlyMessageBody } from 'lib/logs/logBody';
import { cloneDeep, get, isEmpty, isPlainObject } from 'lodash-es';
import { cloneDeep, isEmpty } from 'lodash-es';
import { SuccessResponse, Warning } from 'types/api';
import { MetricRangePayloadV3 } from 'types/api/metrics/getQueryRange';
import {
@@ -305,12 +305,6 @@ function convertRawData(
data.body = extractOnlyMessageBody(row.data.body);
}
// Audit rows nest resource keys under resource.attributes; lift them so resource is flat and FlatLogData flattens it.
const resourceAttributes = get(row.data, ['resource', 'attributes']);
if (isPlainObject(resourceAttributes)) {
data.resource = resourceAttributes;
}
return {
timestamp: row.timestamp,
data,

View File

@@ -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>);

View File

@@ -643,28 +643,6 @@ describe('prepareQueryRangePayloadV5', () => {
);
});
it('sends source audit on a logs query that targets audit', () => {
const [envelope] = convertBuilderQueriesToV5(
{
A: baseBuilderQuery({ dataSource: DataSource.LOGS, source: 'audit' }),
},
'raw',
);
expect(envelope.spec).toMatchObject({ signal: 'logs', source: 'audit' });
});
it('sends no source on a plain logs query', () => {
const [envelope] = convertBuilderQueriesToV5(
{
A: baseBuilderQuery({ dataSource: DataSource.LOGS, source: '' }),
},
'raw',
);
expect(envelope.spec).not.toHaveProperty('source');
});
it('builds payload for builder queries with filters array but no filter expression', () => {
const props: GetQueryResultsProps = {
query: {

View File

@@ -1,6 +1,5 @@
/* eslint-disable sonarjs/cognitive-complexity */
/* eslint-disable sonarjs/no-identical-functions */
import { TelemetrytypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
import { convertFiltersToExpression } from 'components/QueryBuilderV2/utils';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
@@ -342,9 +341,6 @@ export function convertBuilderQueriesToV5(
spec = {
name: queryName,
signal: 'logs' as const,
...(queryData.source === TelemetrytypesSourceDTO.audit && {
source: TelemetrytypesSourceDTO.audit,
}),
...baseSpec,
aggregations: aggregations as LogAggregation[],
};

View File

@@ -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}

View File

@@ -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}

View File

@@ -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')}

View File

@@ -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,
})),
);

View File

@@ -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;
}
}

View File

@@ -1,6 +0,0 @@
.actions {
display: flex;
align-items: center;
gap: var(--spacing-4);
flex-shrink: 0;
}

View File

@@ -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;

View File

@@ -1,6 +1,7 @@
import { useCallback, useMemo, useState } from 'react';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { Button } from '@signozhq/ui/button';
import { ToggleGroup } from '@signozhq/ui/toggle-group';
import { Typography } from '@signozhq/ui/typography';
import { Tooltip } from 'antd';
import { SavedviewtypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
import LogStateIndicator from 'components/Logs/LogStateIndicator/LogStateIndicator';
@@ -19,17 +20,22 @@ import useInitialQuery from 'container/LogsExplorerContext/useInitialQuery';
import { useOptionsMenu } from 'container/OptionsMenu';
import { FontSize } from 'container/OptionsMenu/types';
import { useArrowKeyNavigation } from 'container/TracesExplorer/SpanDrawer/useArrowKeyNavigation';
import { useCloseOnOutsideClick } from 'hooks/logs/useCloseOnOutsideClick';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { getBodyMessage } from 'lib/logs/logBody';
import { cloneDeep } from 'lodash-es';
import { Filter, Histogram, Table, TextSelect } from '@signozhq/icons';
import {
ArrowDown,
ArrowUp,
Filter,
Histogram,
Table,
TextSelect,
} from '@signozhq/icons';
import { Query, TagFilter } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource, StringOperators } from 'types/common/queryBuilder';
import { RESOURCE_KEYS, VIEW_TYPES, VIEWS } from './constants';
import { LogDetailBodyProps } from './LogDetail.interfaces';
import { LogNavigationHint } from './LogNavigationHint/LogNavigationHint';
import LogHighlights from './LogHighlights/LogHighlights';
/* eslint-disable-next-line sonarjs/cognitive-complexity */
@@ -55,7 +61,33 @@ function LogDetailBody({
const [isEdit, setIsEdit] = useState<boolean>(false);
const { stagedQuery } = useQueryBuilder();
useCloseOnOutsideClick(true, onClose);
// Handle clicks outside to close drawer, except on explicitly ignored regions
useEffect(() => {
const handleClickOutside = (e: MouseEvent): void => {
const target = e.target as HTMLElement;
// Don't close if clicking on drawer content, overlays, or portal elements
if (
target.closest('[data-log-detail-ignore="true"]') ||
target.closest('.cm-tooltip-autocomplete') ||
target.closest('.drawer-popover') ||
target.closest('.query-status-popover') ||
target.closest('[data-radix-popper-content-wrapper]') ||
target.closest('[data-base-ui-portal]')
) {
return;
}
// Close the drawer for any other outside click
onClose();
};
document.addEventListener('mousedown', handleClickOutside);
return (): void => {
document.removeEventListener('mousedown', handleClickOutside);
};
}, [onClose]);
// Only listen in the OVERVIEW tab so we don't hijack arrow keys from the
// JSON editor / context view.
@@ -297,7 +329,31 @@ function LogDetailBody({
{selectedView === VIEW_TYPES.OVERVIEW && (
<div className="log-detail-drawer__footer-hint">
<LogNavigationHint />
<div className="log-detail-drawer__footer-hint-content">
<Typography
variant="paragraph"
size="base"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>
Use
</Typography>
<ArrowUp size={14} className="log-detail-drawer__footer-hint-icon" />
<span>/</span>
<ArrowDown size={14} className="log-detail-drawer__footer-hint-icon" />
<Typography
variant="paragraph"
size="base"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>
to view previous/next log
</Typography>
</div>
</div>
)}
</div>

View File

@@ -110,5 +110,17 @@
color: var(--l3-foreground);
background: var(--drawer-background);
z-index: 10;
.log-detail-drawer__footer-hint-content {
display: flex;
align-items: center;
gap: 4px;
}
.log-detail-drawer__footer-hint-icon {
display: inline;
vertical-align: middle;
color: var(--l3-foreground);
}
}
}

View File

@@ -1,99 +0,0 @@
import { act, renderHook } from 'tests/test-utils';
import { useLogNavigation } from '../useLogNavigation';
interface TestLog {
id: string;
label: string;
}
const logs: TestLog[] = [
{ id: 'a', label: 'first' },
{ id: 'b', label: 'second' },
{ id: 'c', label: 'third' },
];
const onNavigateLog = jest.fn() as jest.MockedFunction<(log: TestLog) => void>;
const onScrollToLog = jest.fn() as jest.MockedFunction<(id: string) => void>;
function renderNavigation(
activeLogId: string,
list: TestLog[] | undefined = logs,
) {
return renderHook(() =>
useLogNavigation<TestLog>({
logs: list,
activeLogId,
onNavigateLog,
onScrollToLog,
}),
);
}
beforeEach(() => {
jest.clearAllMocks();
});
describe('useLogNavigation', () => {
it('disables previous on the first log', () => {
const { result } = renderNavigation('a');
expect(result.current.isPrevDisabled).toBe(true);
expect(result.current.isNextDisabled).toBe(false);
});
it('disables next on the last log', () => {
const { result } = renderNavigation('c');
expect(result.current.isPrevDisabled).toBe(false);
expect(result.current.isNextDisabled).toBe(true);
});
it('enables both in the middle', () => {
const { result } = renderNavigation('b');
expect(result.current.isPrevDisabled).toBe(false);
expect(result.current.isNextDisabled).toBe(false);
});
it('moves to the next log and scrolls to it', () => {
const { result } = renderNavigation('b');
act(() => result.current.goToNext());
expect(onNavigateLog).toHaveBeenCalledWith(logs[2]);
expect(onScrollToLog).toHaveBeenCalledWith('c');
});
it('moves to the previous log and scrolls to it', () => {
const { result } = renderNavigation('b');
act(() => result.current.goToPrev());
expect(onNavigateLog).toHaveBeenCalledWith(logs[0]);
expect(onScrollToLog).toHaveBeenCalledWith('a');
});
it('does nothing past the ends', () => {
const { result } = renderNavigation('a');
act(() => result.current.goToPrev());
expect(onNavigateLog).not.toHaveBeenCalled();
expect(onScrollToLog).not.toHaveBeenCalled();
});
it('disables both when the active log is not in the list', () => {
const { result } = renderNavigation('missing');
expect(result.current.isPrevDisabled).toBe(true);
expect(result.current.isNextDisabled).toBe(true);
});
it('disables both without logs', () => {
const { result } = renderNavigation('a', []);
expect(result.current.isPrevDisabled).toBe(true);
expect(result.current.isNextDisabled).toBe(true);
});
});

View File

@@ -1,10 +1,10 @@
import { useCallback, useMemo } from 'react';
import { LogWithId } from 'hooks/logs/types';
import { ILog } from 'types/api/logs/log';
interface UseLogNavigationParams<T extends LogWithId> {
logs?: T[];
interface UseLogNavigationParams {
logs?: ILog[];
activeLogId: string;
onNavigateLog?: (log: T) => void;
onNavigateLog?: (log: ILog) => void;
onScrollToLog?: (id: string) => void;
}
@@ -15,12 +15,12 @@ interface UseLogNavigationReturn {
isNextDisabled: boolean;
}
export function useLogNavigation<T extends LogWithId>({
export function useLogNavigation({
logs,
activeLogId,
onNavigateLog,
onScrollToLog,
}: UseLogNavigationParams<T>): UseLogNavigationReturn {
}: UseLogNavigationParams): UseLogNavigationReturn {
const currentIndex = useMemo(
() => logs?.findIndex((l) => l.id === activeLogId) ?? -1,
[logs, activeLogId],

View File

@@ -1,11 +0,0 @@
.content {
display: flex;
align-items: center;
gap: var(--spacing-2);
}
.icon {
display: inline;
vertical-align: middle;
color: var(--l3-foreground);
}

View File

@@ -1,34 +0,0 @@
import { ArrowDown, ArrowUp } from '@signozhq/icons';
import { Typography } from '@signozhq/ui/typography';
import styles from './LogNavigationHint.module.scss';
export function LogNavigationHint(): JSX.Element {
return (
<div className={styles.content}>
<Typography
variant="paragraph"
size="base"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>
Use
</Typography>
<ArrowUp size={14} className={styles.icon} />
<span>/</span>
<ArrowDown size={14} className={styles.icon} />
<Typography
variant="paragraph"
size="base"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>
to view previous/next log
</Typography>
</div>
);
}

View File

@@ -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 && (

View File

@@ -155,6 +155,14 @@
background: var(--l2-background);
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
.context-btn {
width: 50% !important;
}
.copy-link-btn {
width: 50% !important;
border-left: 1px solid var(--l1-border) !important;
}
.ant-btn-default {
border: none;
box-shadow: none;

View File

@@ -83,3 +83,9 @@ export const LogText = styled.div<LogTextProps>`
: 'white-space: nowrap;'};
};
`;
export const SelectedLog = styled.div`
display: flex;
width: 100%;
overflow: hidden;
`;

View File

@@ -27,3 +27,14 @@
border-color: var(--l1-border) !important;
}
}
// In table/column view, keep action buttons visible at the viewport's right edge
.log-line-action-buttons.table-view-log-actions {
position: absolute;
top: 50%;
right: 8px;
left: auto;
transform: translateY(-50%);
margin: 0;
z-index: 5;
}

View File

@@ -1,5 +0,0 @@
import Spinner from 'components/Spinner';
export function LogsLoadingFooter(): JSX.Element {
return <Spinner height={20} tip="Getting Logs" testId="logs-loading-footer" />;
}

View File

@@ -1,4 +1,7 @@
import { blue } from '@ant-design/colors';
import { Color } from '@signozhq/design-tokens';
import Space from 'periscope/components/Space/Space';
import Col from 'periscope/components/Col/Col';
import Row from 'periscope/components/Row/Row';
import { FontSize } from 'container/OptionsMenu/types';
import { Info } from '@signozhq/icons';
@@ -70,6 +73,12 @@ export const InfoIconWrapper = styled(Info)`
height: auto;
`;
export const ExpandIconWrapper = styled(Col)`
color: ${blue[6]};
padding: 0.25rem 0.375rem;
cursor: pointer;
`;
export const RawLogContent = styled.div<RawLogContentProps>`
margin-bottom: 0;
font-family: 'SF Mono', monospace;
@@ -103,3 +112,11 @@ export const RawLogContent = styled.div<RawLogContentProps>`
cursor: ${({ $isActiveLog, $isReadOnly }): string =>
$isActiveLog || $isReadOnly ? 'initial' : 'pointer'};
`;
export const ActionButtonsWrapper = styled(Space)`
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
right: 0;
cursor: pointer;
`;

View File

@@ -187,6 +187,177 @@
padding: 12px;
}
.add-new-column-container {
display: flex;
flex-direction: column;
.add-new-column-header {
display: flex;
flex-direction: column;
padding: 8px;
gap: 8px;
.back-icon {
cursor: pointer;
}
.title {
display: flex;
gap: 4px;
align-items: center;
color: var(--muted-foreground);
}
}
.add-new-column-content {
display: flex;
flex-direction: column;
padding-bottom: 16px;
min-height: 240px;
max-height: 400px;
.loading-container {
padding: 8px;
}
.column-format-new-options {
overflow-y: auto;
overflow-x: hidden;
.column-name {
padding: 4px 8px;
border-radius: 1px;
color: var(--l2-foreground);
&.selected {
background-color: var(--l3-background);
cursor: pointer;
}
}
&::-webkit-scrollbar {
height: 1rem;
width: 0.2rem;
}
}
}
}
.selected-item-content-container {
.add-new-column-header {
padding: 8px;
}
.title {
color: var(--l1-foreground);
margin-bottom: 12px;
display: flex;
justify-content: space-between;
align-items: center;
.lucide {
color: var(--l2-foreground);
cursor: pointer;
}
}
.horizontal-line {
height: 1px;
background: var(--l3-background);
}
.loading-container {
margin: 12px 0;
}
.item-content {
padding: 12px;
.column-format,
.column-format-new-options {
display: flex;
gap: 12px;
flex-direction: column;
margin-top: 12px;
.column-name {
color: var(--l2-foreground);
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
cursor: pointer;
&.default-column {
color: var(--l2-foreground);
cursor: not-allowed;
}
&.no-columns-selected {
color: var(--l3-foreground);
cursor: not-allowed;
}
&.add-new-column-btn {
color: var(--l2-foreground);
cursor: pointer;
}
.name {
flex: 1;
overflow: hidden;
white-space: nowrap;
overflow: hidden;
cursor: pointer;
}
.delete-btn {
display: none;
flex: 0 0 16px;
cursor: pointer;
}
&:hover {
.delete-btn {
display: block;
}
}
}
overflow-x: hidden;
&::-webkit-scrollbar {
height: 1rem;
width: 0.2rem;
}
}
.column-format {
max-height: 150px;
overflow: auto;
overflow-x: hidden;
}
.column-format-new-options {
max-height: 150px;
overflow-y: auto;
overflow-x: hidden;
}
.column-divider {
margin: 12px 0;
border-top: 2px solid var(--l1-border);
}
}
}
&.active {
.nested-menu-container {
backdrop-filter: blur(18px);
@@ -197,6 +368,26 @@
}
}
}
.selected-item-content-container {
width: 110%;
margin-left: -5%;
border-radius: 4px;
border: 1px solid var(--l1-border);
background: linear-gradient(
139deg,
color-mix(in srgb, var(--surface-2) 80%, transparent) 0%,
color-mix(in srgb, var(--surface-2) 90%, transparent) 98.68%
);
box-shadow: 4px 10px 16px 2px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(20px);
.column-format {
margin-top: 0px;
}
}
}
}
}

View File

@@ -191,7 +191,6 @@ function OptionsMenu({
type="button"
className="periscope-btn"
aria-label="Fewer lines per row"
data-testid="max-lines-fewer"
onClick={(): void => handleLinesPerRowChange(maxLinesPerRow - 1)}
>
<Minus size={12} />
@@ -212,7 +211,6 @@ function OptionsMenu({
type="button"
className="periscope-btn"
aria-label="More lines per row"
data-testid="max-lines-more"
onClick={(): void => handleLinesPerRowChange(maxLinesPerRow + 1)}
>
<Plus size={12} />

View File

@@ -26,3 +26,9 @@
width: max-content;
}
}
.select-label-with-coming-soon {
display: flex;
align-items: center;
justify-content: space-between;
}

View File

@@ -1,8 +1,39 @@
import { Color } from '@signozhq/design-tokens';
import { Tooltip } from 'antd';
import type { DefaultOptionType } from 'antd/es/select';
import { Info } from '@signozhq/icons';
import './MQCommon.styles.scss';
export function ComingSoon(): JSX.Element {
return (
<Tooltip
title={
<div>
Join our Slack community for more details:{' '}
<a
href="https://signoz.io/slack"
rel="noopener noreferrer"
target="_blank"
onClick={(e): void => e.stopPropagation()}
>
SigNoz Community
</a>
</div>
}
placement="top"
overlayClassName="tooltip-overlay"
>
<div className="coming-soon">
<div className="coming-soon__text">Coming Soon</div>
<div className="coming-soon__icon">
<Info size={10} color={Color.BG_SIENNA_400} />
</div>
</div>
</Tooltip>
);
}
export function SelectMaxTagPlaceholder(
omittedValues: Partial<DefaultOptionType>[],
): JSX.Element {
@@ -12,3 +43,15 @@ export function SelectMaxTagPlaceholder(
</Tooltip>
);
}
export function SelectLabelWithComingSoon({
label,
}: {
label: string;
}): JSX.Element {
return (
<div className="select-label-with-coming-soon">
{label} <ComingSoon />
</div>
);
}

View File

@@ -1,4 +1,3 @@
import { useCallback } from 'react';
import { Button } from '@signozhq/ui/button';
import { Typography } from '@signozhq/ui/typography';
import ROUTES from 'constants/routes';
@@ -23,10 +22,6 @@ function NotificationChannelsNotFound({
}: NotificationChannelsNotFoundProps): JSX.Element {
const { isGranted, isLoading, error } = useAuthZ(CREATE_CHECKS);
const canCreate = !!error || isGranted(NotificationChannelCreatePermission);
const openCreateChannel = useCallback(
(): void => openInNewTab(ROUTES.CHANNELS_NEW),
[],
);
return (
<div className={styles.container}>
@@ -48,7 +43,7 @@ function NotificationChannelsNotFound({
color="primary"
size="sm"
testId="channels-not-found-create"
onClick={openCreateChannel}
onClick={(): void => openInNewTab(ROUTES.CHANNELS_NEW)}
>
Create one here.
</Button>

View File

@@ -238,7 +238,7 @@ export const QueryBuilderV2 = memo(function QueryBuilderV2({
queryVariant={config?.queryVariant || 'dropdown'}
showOnlyWhereClause={showOnlyWhereClause}
isRawQuery={isRawQuery}
signalSource={activeBuilder.queryData[0].source}
signalSource={activeBuilder.queryData[0].source as 'meter' | ''}
onSignalSourceChange={onSignalSourceChange || ((): void => {})}
signalSourceChangeEnabled={signalSourceChangeEnabled}
queriesCount={1}
@@ -260,7 +260,7 @@ export const QueryBuilderV2 = memo(function QueryBuilderV2({
queryVariant={config?.queryVariant || 'dropdown'}
showOnlyWhereClause={showOnlyWhereClause}
isRawQuery={isRawQuery}
signalSource={query.source}
signalSource={query.source as 'meter' | ''}
onSignalSourceChange={onSignalSourceChange || ((): void => {})}
signalSourceChangeEnabled={signalSourceChangeEnabled}
queriesCount={activeBuilder.queryData.length}

View File

@@ -433,6 +433,7 @@ function QueryAddOns({
query={query}
onChange={handleChangeOrderByKeys}
isRawQuery={isRawQuery}
isNewQueryV2
panelType={panelType ?? undefined}
placeholder={placeholderOf(QueryBuilderField.OrderBy)}
/>

View File

@@ -16,7 +16,6 @@ import {
startCompletion,
} from '@codemirror/autocomplete';
import { javascript } from '@codemirror/lang-javascript';
import * as Sentry from '@sentry/react';
import { Color } from '@signozhq/design-tokens';
import { copilot } from '@uiw/codemirror-theme-copilot';
import { githubLight } from '@uiw/codemirror-theme-github';
@@ -362,12 +361,9 @@ function QuerySearch({
metricNamespace,
},
builderQueryType,
).catch((error: unknown) => {
Sentry.captureException(error);
return null;
});
);
if (response?.data.keys) {
if (response.data.keys) {
const { keys } = response.data;
const options = generateOptions(keys);
// Deduplicate by full variant identity (name + context + data type), NOT by

View File

@@ -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}

View File

@@ -1,9 +1,7 @@
import { useMemo } from 'react';
import { TelemetrytypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
import { FieldValuesConfig } from 'api/querySuggestions/types';
import {
QUICK_FILTER_SOURCE_TO_SIGNAL,
QUICK_FILTER_SOURCE_TO_SOURCE,
} from 'components/QuickFilters/constants';
import { QUICK_FILTER_SOURCE_TO_SIGNAL } from 'components/QuickFilters/constants';
import {
IQuickFiltersConfig,
QuickFiltersSource,
@@ -29,6 +27,12 @@ interface UseFieldValuesReturn {
isFetching: boolean;
}
const QUICK_FILTERS_SOURCE_TO_SOURCE: Partial<
Record<QuickFiltersSource, TelemetrytypesSourceDTO>
> = {
[QuickFiltersSource.METER_EXPLORER]: TelemetrytypesSourceDTO.meter,
};
export function useFieldValues({
filter,
searchText,
@@ -61,7 +65,7 @@ export function useFieldValues({
searchText,
existingQuery,
metricNamespace,
source: QUICK_FILTER_SOURCE_TO_SOURCE[quickFilterSource],
source: QUICK_FILTERS_SOURCE_TO_SOURCE[quickFilterSource],
startUnixMilli,
// This field does not affect the backend but I wanted to keep it here
// in case we add the support in the future

View File

@@ -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

View File

@@ -1,13 +1,12 @@
import { useMemo } from 'react';
import { Button, Skeleton } from 'antd';
import { Typography } from '@signozhq/ui/typography';
import { QuickfiltertypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
import {
QuickfiltertypesSourceDTO,
TelemetrytypesSourceDTO,
} from 'api/generated/services/sigNoz.schemas';
import { FieldKeysConfig } from 'api/querySuggestions/types';
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
import {
QUICK_FILTER_SOURCE_TO_SIGNAL,
QUICK_FILTER_SOURCE_TO_SOURCE,
} from 'components/QuickFilters/constants';
import { QUICK_FILTER_SOURCE_TO_SIGNAL } from 'components/QuickFilters/constants';
import { buildCompositeKey } from 'container/OptionsMenu/utils';
import { useFieldKeysSuggestion } from 'hooks/querySuggestions/useFieldKeysSuggestion';
import {
@@ -44,6 +43,8 @@ function OtherFilters({
addedFilters: TelemetryFieldKey[];
setAddedFilters: React.Dispatch<React.SetStateAction<TelemetryFieldKey[]>>;
}): JSX.Element {
const isMeterDataSource =
savedFiltersSource === QuickfiltertypesSourceDTO.meter;
const isAIObservability =
savedFiltersSource === QuickfiltertypesSourceDTO.ai_observability;
@@ -56,7 +57,7 @@ function OtherFilters({
: {
searchText: inputValue,
signal: QUICK_FILTER_SOURCE_TO_SIGNAL[savedFiltersSource],
source: QUICK_FILTER_SOURCE_TO_SOURCE[savedFiltersSource],
source: isMeterDataSource ? TelemetrytypesSourceDTO.meter : undefined,
};
const { data: fetchedKeys, isFetching } = useFieldKeysSuggestion(
@@ -97,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"

View File

@@ -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;

View File

@@ -1,7 +1,4 @@
import {
TelemetrytypesSignalDTO,
TelemetrytypesSourceDTO,
} from 'api/generated/services/sigNoz.schemas';
import { TelemetrytypesSignalDTO } from 'api/generated/services/sigNoz.schemas';
import { QuickFiltersSource } from './types';
@@ -18,17 +15,3 @@ export const QUICK_FILTER_SOURCE_TO_SIGNAL: Record<
[QuickFiltersSource.INFRA_MONITORING]: TelemetrytypesSignalDTO.metrics,
[QuickFiltersSource.AUDIT_LOGS]: TelemetrytypesSignalDTO.logs,
};
export const QUICK_FILTER_SOURCE_TO_SOURCE: Record<
QuickFiltersSource,
TelemetrytypesSourceDTO | undefined
> = {
[QuickFiltersSource.LOGS_EXPLORER]: undefined,
[QuickFiltersSource.TRACES_EXPLORER]: undefined,
[QuickFiltersSource.EXCEPTIONS]: undefined,
[QuickFiltersSource.API_MONITORING]: undefined,
[QuickFiltersSource.AI_OBSERVABILITY]: undefined,
[QuickFiltersSource.METER_EXPLORER]: TelemetrytypesSourceDTO.meter,
[QuickFiltersSource.INFRA_MONITORING]: undefined,
[QuickFiltersSource.AUDIT_LOGS]: TelemetrytypesSourceDTO.audit,
};

View File

@@ -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) =>

View File

@@ -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,

View File

@@ -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,

View File

@@ -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);
}
}

View File

@@ -48,5 +48,4 @@ export enum LOCALSTORAGE {
ALERT_RULES_LIST_VIEWS = 'ALERT_RULES_LIST_VIEWS',
DASHBOARD_V2_PANEL_COLUMN_WIDTHS = 'DASHBOARD_V2_PANEL_COLUMN_WIDTHS',
LLM_ATTRIBUTE_MAPPING_TEST_SPAN = 'LLM_ATTRIBUTE_MAPPING_TEST_SPAN',
AUDIT_LOGS_OPTIONS = 'AUDIT_LOGS_OPTIONS',
}

View File

@@ -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_AUDIT_LOGS: 'GET_AUDIT_LOGS',
GET_ALL_DASHBOARDS: 'GET_ALL_DASHBOARDS',
GET_TRIGGERED_ALERTS: 'GET_TRIGGERED_ALERTS',
DASHBOARD_BY_ID: 'DASHBOARD_BY_ID',

View File

@@ -41,7 +41,6 @@ const ROUTES = {
LOGS_PIPELINES: '/logs/pipelines',
PASSWORD_RESET: '/password-reset',
LIST_LICENSES: '/licenses',
AUDIT_LOGS: '/audit-logs',
LOGS_INDEX_FIELDS: '/logs-explorer/index-fields',
TRACE_EXPLORER: '/trace-explorer',
BILLING: '/settings/billing',

View File

@@ -1,3 +1,51 @@
export const MOCK_USE_QUERIES_DATA = [
{
isLoading: false,
isError: false,
error: null,
data: {
statusCode: 200,
payload: [
{
exceptionType: '*errors.errorString',
exceptionMessage: 'redis timeout',
exceptionCount: 2510,
lastSeen: '2025-04-14T18:27:57.797616374Z',
firstSeen: '2025-04-14T17:58:00.262775497Z',
serviceName: 'redis-manual',
groupID: '511b9c91a92b9c5166ecb77235f5743b',
},
],
},
},
{
status: 'success',
isLoading: false,
isSuccess: true,
isError: false,
isIdle: false,
data: {
statusCode: 200,
error: null,
payload: 525,
},
dataUpdatedAt: 1744661020341,
error: null,
errorUpdatedAt: 0,
failureCount: 0,
errorUpdateCount: 0,
isFetched: true,
isFetchedAfterMount: true,
isFetching: false,
isRefetching: false,
isLoadingError: false,
isPlaceholderData: false,
isPreviousData: false,
isRefetchError: false,
isStale: true,
},
];
export const INIT_URL_WITH_COMMON_QUERY =
'/exceptions?compositeQuery=%257B%2522queryType%2522%253A%2522builder%2522%252C%2522builder%2522%253A%257B%2522queryData%2522%253A%255B%257B%2522dataSource%2522%253A%2522traces%2522%252C%2522queryName%2522%253A%2522A%2522%252C%2522aggregateOperator%2522%253A%2522noop%2522%252C%2522aggregateAttribute%2522%253A%257B%2522id%2522%253A%2522----resource--false%2522%252C%2522dataType%2522%253A%2522%2522%252C%2522key%2522%253A%2522%2522%252C%2522isColumn%2522%253Afalse%252C%2522type%2522%253A%2522resource%2522%252C%2522isJSON%2522%253Afalse%257D%252C%2522timeAggregation%2522%253A%2522rate%2522%252C%2522spaceAggregation%2522%253A%2522sum%2522%252C%2522functions%2522%253A%255B%255D%252C%2522filters%2522%253A%257B%2522items%2522%253A%255B%257B%2522id%2522%253A%2522db118ac7-9313-4adb-963f-f31b5b32c496%2522%252C%2522op%2522%253A%2522in%2522%252C%2522key%2522%253A%257B%2522key%2522%253A%2522deployment.environment%2522%252C%2522dataType%2522%253A%2522string%2522%252C%2522type%2522%253A%2522resource%2522%252C%2522isColumn%2522%253Afalse%252C%2522isJSON%2522%253Afalse%257D%252C%2522value%2522%253A%2522mq-kafka%2522%257D%255D%252C%2522op%2522%253A%2522AND%2522%257D%252C%2522expression%2522%253A%2522A%2522%252C%2522disabled%2522%253Afalse%252C%2522stepInterval%2522%253A60%252C%2522having%2522%253A%255B%255D%252C%2522limit%2522%253Anull%252C%2522orderBy%2522%253A%255B%255D%252C%2522groupBy%2522%253A%255B%255D%252C%2522legend%2522%253A%2522%2522%252C%2522reduceTo%2522%253A%2522avg%2522%257D%255D%252C%2522queryFormulas%2522%253A%255B%255D%257D%252C%2522promql%2522%253A%255B%257B%2522name%2522%253A%2522A%2522%252C%2522query%2522%253A%2522%2522%252C%2522legend%2522%253A%2522%2522%252C%2522disabled%2522%253Afalse%257D%255D%252C%2522clickhouse_sql%2522%253A%255B%257B%2522name%2522%253A%2522A%2522%252C%2522legend%2522%253A%2522%2522%252C%2522disabled%2522%253Afalse%252C%2522query%2522%253A%2522%2522%257D%255D%252C%2522id%2522%253A%2522dd576d04-0822-476d-b0c2-807a7af2e5e7%2522%257D';

View File

@@ -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>

View File

@@ -50,6 +50,16 @@
font-family: var(--code-base-500-font-family);
}
.radio-button {
display: flex;
align-items: center;
justify-content: center;
padding-top: var(--padding-1);
border: 1px solid var(--l1-border);
background: var(--l3-background);
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
}
.round-metric-tag {
display: inline-flex;
padding: 2px 8px;
@@ -773,5 +783,80 @@
gap: 12px;
cursor: pointer;
}
.no-dependent-services-message-container {
height: 30vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.no-dependent-services-message-content {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
width: fit-content;
padding: 24px;
}
.no-dependent-services-message {
margin-top: 8px;
}
}
}
}
.end-point-details-zero-state-wrapper {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
height: 100%;
.end-point-details-zero-state-content {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
gap: 4px;
height: 100%;
}
.end-point-details-zero-state-content-wrapper {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
gap: 12px;
.end-point-details-zero-state-text-content {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
gap: 8px;
.title {
color: var(--l1-foreground);
}
.description {
color: var(--l2-foreground);
}
}
.ant-select {
width: 100%;
}
}
.ant-select-item,
.ant-select-item-option-content {
flex: auto;
white-space: normal;
overflow-wrap: break-word;
}
}

View File

@@ -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:

View File

@@ -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,

View File

@@ -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'));

View File

@@ -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
})),

View File

@@ -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,
});

View File

@@ -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>

View File

@@ -69,6 +69,13 @@ jest.mock('antd', () => {
))}
</div>
)),
Typography: {
Text: jest
.fn()
.mockImplementation(({ children }) => (
<div data-testid="typography-text">{children}</div>
)),
},
};
});

View File

@@ -130,6 +130,13 @@ jest.mock('antd', () => {
{children}
</div>
)),
Typography: {
Text: jest
.fn()
.mockImplementation(({ children }) => (
<div data-testid="typography-text">{children}</div>
)),
},
Button: {
...originalModule.Button,
Group: jest.fn().mockImplementation(({ children, className }) => (

View File

@@ -46,6 +46,13 @@ jest.mock('antd', () => {
)}
</div>
)),
Typography: {
Text: jest.fn().mockImplementation(({ children, className }) => (
<div data-testid="typography-text" className={className}>
{children}
</div>
)),
},
};
});

View File

@@ -1,3 +1,16 @@
import { domainNameKey } from './constants';
export interface APIMonitoringResponseRow {
data: {
endpoints: number | string;
error_rate: number | string;
lastseen: number | string;
[domainNameKey]: string;
p99: number | string;
rps: number | string;
};
}
export interface APIMonitoringResponseColumn {
name: string;
signal: string;
@@ -9,6 +22,12 @@ export interface APIMonitoringResponseColumn {
columnType: string;
}
export interface EndPointsResponseRow {
data: {
[key: string]: string | number | undefined;
};
}
export interface APIDomainsRowData {
key: string;
domainName: string;

View File

@@ -1,24 +1,32 @@
import { ReactNode } from 'react';
import { TableColumnType as ColumnType, Tooltip } from 'antd';
import { Progress } from '@signozhq/ui/progress';
import { Badge } from '@signozhq/ui/badge';
import { combineInitialAndUserExpression } from 'components/QueryBuilderV2/QueryV2/QuerySearch/utils';
import { formatValueForExpression } from 'components/QueryBuilderV2/utils';
import {
FiltersType,
IQuickFiltersConfig,
} from 'components/QuickFilters/types';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { GraphClickMetaData } from 'container/WidgetCard/hooks/useNavigateToExplorerPages';
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
import { convertNanoToMilliseconds } from 'container/MetricsExplorer/Summary/utils';
import dayjs from 'dayjs';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
import { cloneDeep } from 'lodash-es';
import { ArrowUpDown, Info } from '@signozhq/icons';
import { ArrowUpDown, ChevronDown, ChevronRight, Info } from '@signozhq/icons';
import { getWidgetQuery } from 'pages/MessagingQueues/MQDetails/MetricPage/MetricPageUtil';
import { Widgets } from 'types/api/widgets/widget';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
import {
BaseAutocompleteData,
DataTypes,
} from 'types/api/queryBuilder/queryAutocompleteResponse';
import {
IBuilderQuery,
OrderByPayload,
TagFilterItem,
} from 'types/api/queryBuilder/queryBuilderData';
import {
@@ -33,7 +41,11 @@ import { v4 } from 'uuid';
import { domainNameKey } from './constants';
import { SPAN_ATTRIBUTES } from './Explorer/Domains/DomainDetails/constants';
import { APIDomainsRowData, APIMonitoringResponseColumn } from './types';
import {
APIDomainsRowData,
APIMonitoringResponseColumn,
EndPointsResponseRow,
} from './types';
function metricProgressColor(
percent: number,
@@ -79,6 +91,40 @@ export const getDomainScopeExpression = (
.filter(Boolean)
.join(' AND ');
export const ApiMonitoringQuickFiltersConfig: IQuickFiltersConfig[] = [
{
type: FiltersType.CHECKBOX,
title: 'Environment',
attributeKey: {
key: 'deployment.environment',
dataType: DataTypes.String,
type: 'resource',
},
defaultOpen: true,
},
{
type: FiltersType.CHECKBOX,
title: 'Service Name',
attributeKey: {
key: 'service.name',
dataType: DataTypes.String,
type: 'resource',
},
defaultOpen: true,
},
{
type: FiltersType.CHECKBOX,
title: 'RPC Method',
attributeKey: {
key: 'rpc.method',
dataType: DataTypes.String,
type: 'tag',
},
defaultOpen: true,
},
];
export const getLastUsedRelativeTime = (lastRefresh: number): string => {
const currentTime = dayjs();
@@ -525,6 +571,258 @@ const defaultGroupBy = [
// },
];
export const getEndPointsQueryPayload = (
groupBy: BaseAutocompleteData[],
domainName: string,
start: number,
end: number,
): GetQueryResultsProps[] => {
const isGroupedByAttribute = groupBy.length > 0;
return [
{
selectedTime: 'GLOBAL_TIME',
graphType: PANEL_TYPES.TABLE,
query: {
builder: {
queryData: [
{
aggregateAttribute: {
dataType: DataTypes.String,
key: 'span_id',
type: '',
},
aggregateOperator: 'count',
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [
{
id: 'ec316e57',
key: {
dataType: DataTypes.String,
key: SPAN_ATTRIBUTES.SERVER_NAME,
type: '',
},
op: '=',
value: domainName,
},
{
id: '212678b9',
key: {
key: 'kind_string',
dataType: DataTypes.String,
type: '',
},
op: '=',
value: 'Client',
},
],
op: 'AND',
},
functions: [],
groupBy: isGroupedByAttribute ? groupBy : defaultGroupBy,
having: [],
legend: '',
limit: 1000,
orderBy: [],
queryName: 'A',
reduceTo: ReduceOperators.AVG,
spaceAggregation: 'sum',
stepInterval: 60,
timeAggregation: 'count',
},
{
aggregateAttribute: {
dataType: DataTypes.Float64,
key: 'duration_nano',
type: '',
},
aggregateOperator: 'p99',
dataSource: DataSource.TRACES,
disabled: false,
expression: 'B',
filters: {
items: [
{
id: '46d57857',
key: {
dataType: DataTypes.String,
key: SPAN_ATTRIBUTES.SERVER_NAME,
type: '',
},
op: '=',
value: domainName,
},
{
id: '212678b9',
key: {
key: 'kind_string',
dataType: DataTypes.String,
type: '',
},
op: '=',
value: 'Client',
},
],
op: 'AND',
},
functions: [],
groupBy: isGroupedByAttribute ? groupBy : defaultGroupBy,
having: [],
legend: '',
limit: 1000,
orderBy: [],
queryName: 'B',
reduceTo: ReduceOperators.AVG,
spaceAggregation: 'sum',
stepInterval: 60,
timeAggregation: 'p99',
},
{
aggregateAttribute: {
dataType: DataTypes.String,
id: 'timestamp------false',
key: 'timestamp',
type: '',
},
aggregateOperator: 'max',
dataSource: DataSource.TRACES,
disabled: false,
expression: 'C',
filters: {
items: [
{
id: '4a237616',
key: {
dataType: DataTypes.String,
key: SPAN_ATTRIBUTES.SERVER_NAME,
type: '',
},
op: '=',
value: domainName,
},
{
id: '212678b9',
key: {
key: 'kind_string',
dataType: DataTypes.String,
type: '',
},
op: '=',
value: 'Client',
},
],
op: 'AND',
},
functions: [],
groupBy: isGroupedByAttribute ? groupBy : defaultGroupBy,
having: [],
legend: '',
limit: 1000,
orderBy: [],
queryName: 'C',
reduceTo: ReduceOperators.AVG,
spaceAggregation: 'sum',
stepInterval: 60,
timeAggregation: 'max',
},
{
aggregateAttribute: {
dataType: DataTypes.String,
key: 'span_id',
type: '',
},
aggregateOperator: 'count',
dataSource: DataSource.TRACES,
disabled: true,
expression: 'D',
filters: {
items: [
{
id: 'f162de1e',
key: {
dataType: DataTypes.String,
key: SPAN_ATTRIBUTES.SERVER_NAME,
type: '',
},
op: '=',
value: domainName,
},
{
id: '3df0ac1d',
key: {
dataType: DataTypes.bool,
key: 'has_error',
type: '',
},
op: '=',
value: 'true',
},
{
id: '212678b9',
key: {
key: 'kind_string',
dataType: DataTypes.String,
type: '',
},
op: '=',
value: 'Client',
},
],
op: 'AND',
},
functions: [],
groupBy: isGroupedByAttribute ? groupBy : defaultGroupBy,
having: [],
legend: '',
limit: 1000,
orderBy: [],
queryName: 'D',
reduceTo: ReduceOperators.AVG,
spaceAggregation: 'sum',
stepInterval: 60,
timeAggregation: 'count',
},
],
queryFormulas: [
{
queryName: 'F1',
expression: '(D/A)*100',
disabled: false,
legend: 'error percentage',
},
],
queryTraceOperator: [],
},
clickhouse_sql: [
{
disabled: false,
legend: '',
name: 'A',
query: '',
},
],
id: '315b15fa-ff0c-442f-89f8-2bf4fb1af2f2',
promql: [
{
disabled: false,
legend: '',
name: 'A',
query: '',
},
],
queryType: EQueryType.QUERY_BUILDER,
},
variables: {},
formatForWeb: true,
start,
end,
step: 60,
},
];
};
function buildFilterExpression(
domainName: string,
filterExpression: string,
@@ -609,6 +907,16 @@ export const getTopErrorsQueryPayload = (
};
};
export interface EndPointsTableRowData {
key: string;
endpointName: string;
callCount: number | string;
latency: number | string;
errorRate: number | string;
lastUsed: string | number;
groupedByMeta?: Record<string, string | number>;
}
export const extractPortAndEndpoint = (
url: string,
): { port: string; endpoint: string } => {
@@ -629,6 +937,258 @@ export const extractPortAndEndpoint = (
}
};
export const getEndPointsColumnsConfig = (
isGroupedByAttribute: boolean,
expandedRowKeys: React.Key[],
// eslint-disable-next-line sonarjs/cognitive-complexity
): ColumnType<EndPointsTableRowData>[] => [
{
title: (
<div className="endpoint-name-header">
{isGroupedByAttribute ? 'Endpoint group' : 'Endpoint'}
</div>
),
dataIndex: 'endpointName',
key: 'endpointName',
width: 180,
ellipsis: true,
sorter: false,
className: 'column',
render: (text: string, record: EndPointsTableRowData): React.ReactNode => {
const endPointName = isGroupedByAttribute
? text
: extractPortAndEndpoint(record.endpointName).endpoint;
return (
<div className="endpoint-name-value">
{((): React.ReactNode => {
if (!isGroupedByAttribute) {
return null;
}
return expandedRowKeys.includes(record.key) ? (
<ChevronDown size={14} />
) : (
<ChevronRight size={14} />
);
})()}
{isGroupedByAttribute
? text.split(',').map((value) => (
<Badge
textTransform="none"
variant="solid"
key={value}
color="secondary"
>
{value === '' ? '<no-value>' : value}
</Badge>
))
: endPointName}
</div>
);
},
},
{
title: <div className="column-header">Port</div>,
dataIndex: 'port',
key: 'port',
width: 180,
ellipsis: true,
sorter: false,
align: 'right',
className: `column`,
},
{
title: (
<div className="column-header">
Num of calls <ArrowUpDown size={14} />
</div>
),
dataIndex: 'callCount',
key: 'callCount',
width: 180,
ellipsis: true,
align: 'right',
className: `column`,
},
{
title: (
<div>
Error <span className="round-metric-tag">%</span>
</div>
),
dataIndex: 'errorRate',
key: 'errorRate',
width: 120,
sorter: true,
align: 'right',
className: `column`,
render: (errorRate: number | string): React.ReactNode => (
<div className="progress-bar error-rate">
<Progress
percent={Number(
(
(errorRate === 'n/a' || errorRate === '-' ? 0 : errorRate) as number
).toFixed(1),
)}
showInfo
color={metricProgressColor(
Number(
(
(errorRate === 'n/a' || errorRate === '-' ? 0 : errorRate) as number
).toFixed(1),
),
)}
/>
</div>
),
},
{
title: (
<div>
Latency <span className="round-metric-tag">ms</span>
</div>
),
dataIndex: 'latency',
key: 'latency',
width: 120,
sorter: true,
align: 'right',
className: `column`,
},
{
title: <div>Last used</div>,
dataIndex: 'lastUsed',
key: 'lastUsed',
width: 120,
sorter: true,
align: 'right',
className: `column`,
// eslint-disable-next-line sonarjs/no-identical-functions
render: (lastUsed: string): string =>
lastUsed === 'n/a' || lastUsed === '-'
? '-'
: getLastUsedRelativeTime(new Date(lastUsed).getTime()),
},
];
export const formatEndPointsDataForTable = (
data: EndPointsResponseRow[] | undefined,
groupBy: BaseAutocompleteData[],
orderBy?: OrderByPayload | null,
// eslint-disable-next-line sonarjs/cognitive-complexity
): EndPointsTableRowData[] => {
if (!data) {
return [];
}
const isGroupedByAttribute = groupBy.length > 0;
let formattedData: EndPointsTableRowData[] = [];
if (!isGroupedByAttribute) {
formattedData = data?.map((endpoint) => {
const { port } = extractPortAndEndpoint(
(endpoint.data[SPAN_ATTRIBUTES.HTTP_URL] as string) || '',
);
return {
key: v4(),
endpointName: (endpoint.data[SPAN_ATTRIBUTES.HTTP_URL] as string) || '-',
port,
callCount:
endpoint.data.A === 'n/a' || endpoint.data.A === undefined
? '-'
: endpoint.data.A,
latency:
endpoint.data.B === 'n/a' || endpoint.data.B === undefined
? '-'
: Math.round(Number(endpoint.data.B) / 1000000), // Convert from nanoseconds to milliseconds
lastUsed:
endpoint.data.C === 'n/a' || endpoint.data.C === undefined
? '-'
: new Date(Math.floor(Number(endpoint.data.C) / 1000000)).toISOString(), // Convert from nanoseconds to milliseconds
errorRate:
endpoint.data.F1 === undefined || endpoint.data.F1 === 'n/a'
? 0
: Number(endpoint.data.F1),
};
});
} else {
const groupedByAttributeData = groupBy.map((attribute) => attribute.key);
formattedData = data?.map((endpoint) => {
const newEndpointName = groupedByAttributeData
.map((attribute) => endpoint.data[attribute])
.join(',');
return {
key: v4(),
endpointName: newEndpointName,
callCount:
endpoint.data.A === 'n/a' || endpoint.data.A === undefined
? '-'
: endpoint.data.A,
latency:
endpoint.data.B === 'n/a' || endpoint.data.B === undefined
? '-'
: Math.round(Number(endpoint.data.B) / 1000000), // Convert from nanoseconds to milliseconds
lastUsed:
endpoint.data.C === 'n/a' || endpoint.data.C === undefined
? '-'
: getLastUsedRelativeTime(Math.floor(Number(endpoint.data.C) / 1000000)), // Convert from nanoseconds to milliseconds
errorRate:
endpoint.data.D === 'n/a' || endpoint.data.D === undefined
? 0
: Number(endpoint.data.D),
groupedByMeta: groupedByAttributeData.reduce(
(acc, attribute) => {
acc[attribute] = endpoint.data[attribute] || '';
return acc;
},
{} as Record<string, string | number>,
),
};
});
}
// Apply sorting if orderBy is provided
if (orderBy) {
formattedData.sort((a, b) => {
let valueA: number | string = a[
orderBy.columnName as keyof EndPointsTableRowData
] as number | string;
let valueB: number | string = b[
orderBy.columnName as keyof EndPointsTableRowData
] as number | string;
// Handle special cases for each column type
if (
orderBy.columnName === 'callCount' ||
orderBy.columnName === 'latency' ||
orderBy.columnName === 'errorRate'
) {
valueA = valueA === '-' || valueA === 'n/a' ? 0 : Number(valueA);
valueB = valueB === '-' || valueB === 'n/a' ? 0 : Number(valueB);
} else if (orderBy.columnName === 'lastUsed') {
// confirm once the implication of this
valueA =
valueA === '-' || valueA === 'n/a'
? new Date(0).getTime()
: new Date(valueA as string).getTime();
valueB =
valueB === '-' || valueB === 'n/a'
? new Date(0).getTime()
: new Date(valueB as string).getTime();
}
// Apply sort direction
if (orderBy.order === 'asc') {
return valueA > valueB ? 1 : -1;
}
return valueA < valueB ? 1 : -1;
});
}
return formattedData;
};
export type TopErrorsResponseRow = ScalarData;
export interface TopErrorsTableRowData {
@@ -773,6 +1333,37 @@ export const getTopErrorsColumnsConfig =
},
];
export const createFiltersForSelectedRowData = (
selectedRowData: EndPointsTableRowData,
currentFilters?: IBuilderQuery['filters'],
): IBuilderQuery['filters'] => {
const baseFilters: IBuilderQuery['filters'] = {
items: [...(currentFilters?.items || [])],
op: 'and',
};
if (!selectedRowData) {
return baseFilters;
}
const { groupedByMeta = {} } = selectedRowData;
// Replace for...of with Object.keys().map()
baseFilters.items.push(
...Object.keys(groupedByMeta).map((key) => ({
key: {
key,
type: null,
},
op: '=',
value: groupedByMeta[key] || '',
id: key,
})),
);
return baseFilters;
};
// First query payload for endpoint metrics
// Second query payload for endpoint status code table
// Third query payload for endpoint dependant services
@@ -1874,6 +2465,21 @@ export const dependentServicesColumns: ColumnType<DependentServicesData>[] = [
},
];
export const getFormattedChartData = (
data: MetricRangePayloadProps,
newLegendArray: string[],
): MetricRangePayloadProps => {
const result = cloneDeep(data);
if (result?.data?.result) {
result.data.result = result?.data?.result?.map((series, index) => ({
...series,
legend: newLegendArray[index],
}));
}
return result;
};
const getStatusCodeClass = (statusCode: string): string => {
const code = parseInt(statusCode, 10);
@@ -2494,6 +3100,40 @@ const getStartAndEndStatusCode = (
}
};
/**
* Creates filter items for bar chart based on group by fields and request data
* Used specifically for filtering status code ranges in bar charts
* @param groupBy Array of group by fields to create filters for
* @param requestData Data from graph click containing values to filter on
* @returns Array of TagFilterItems with >= and < operators for status code ranges
*/
export const createGroupByFiltersForBarChart = (
groupBy: BaseAutocompleteData[],
requestData: GraphClickMetaData,
): TagFilterItem[] =>
groupBy
.map((gb) => {
const value = requestData[gb.key];
const [startStatusCode, endStatusCode] = getStartAndEndStatusCode(value);
return value
? [
{
id: v4(),
key: gb,
op: '>=',
value: startStatusCode,
},
{
id: v4(),
key: gb,
op: '<=',
value: endStatusCode,
},
]
: [];
})
.flat();
export const getCustomFiltersForBarChart = (
metric:
| {

View File

@@ -191,6 +191,7 @@ function ThresholdItem({
updateThreshold(threshold.id, 'channels', value)
}
data-testid="threshold-notification-channel-select"
popupMatchSelectWidth={false}
style={{ width: 350 }}
options={channelOptions}
onDropdownVisibleChange={onPickerVisibleChange}

View File

@@ -11,6 +11,7 @@ import {
NotificationChannelCreatePermission,
} from 'lib/authz/hooks/useAuthZ/permissions/notification-channel.permissions';
import { buildRuleDetachPermission } from 'lib/authz/hooks/useAuthZ/permissions/rule.permissions';
import type { UseAuthZResult } from 'lib/authz/hooks/useAuthZ/types';
import { useAuthZ } from 'lib/authz/hooks/useAuthZ/useAuthZ';
import { formatPermission } from 'lib/authz/hooks/useAuthZ/utils';
import {
@@ -531,7 +532,7 @@ describe('ThresholdItem', () => {
...mockUseAuthZDeny()([]),
isLoading: true,
permissions: null,
});
} as UseAuthZResult);
renderThresholdItem();
await openPicker();

View File

@@ -22,13 +22,13 @@ export function useAlertRuleSaveChecks(): UseAlertRuleSaveChecksReturn {
useCreateAlertState();
const { data: channels, isLoading } = useChannelOptions();
const selectedChannelNames = useMemo(
const selectedChannels = useMemo(
() => thresholdState.thresholds.flatMap((threshold) => threshold.channels),
[thresholdState.thresholds],
);
return useMemo(() => {
const selectedChannelIds = getChannelIds(channels, selectedChannelNames);
const selectedChannelIds = getChannelIds(channels, selectedChannels);
return {
saveChecks: getRuleSaveChecks({
@@ -38,12 +38,11 @@ export function useAlertRuleSaveChecks(): UseAlertRuleSaveChecksReturn {
}),
testChecks: getRuleCreateChecks(selectedChannelIds),
isResolvingChannels:
isLoading &&
(selectedChannelNames.length > 0 || savedChannelNames.length > 0),
isLoading && (selectedChannels.length > 0 || savedChannelNames.length > 0),
};
}, [
channels,
selectedChannelNames,
selectedChannels,
savedChannelNames,
isEditMode,
ruleId,

View File

@@ -13,6 +13,11 @@ export const DashedContainer = styled.div`
align-items: center;
`;
export const ButtonContainer = styled.div`
display: flex;
gap: 1rem;
`;
export const EventContainer = styled.div`
display: flex;
justify-content: space-between;

View File

@@ -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,

View File

@@ -14,8 +14,8 @@ import Card from 'periscope/components/Card/Card';
import { isModifierKeyPressed } from 'utils/app';
import AuthZButton from 'lib/authz/components/AuthZButton/AuthZButton';
import {
RuleCreateChecks,
RuleListChecks,
RuleCreatePermission,
RuleListPermission,
} from 'lib/authz/hooks/useAuthZ/permissions/rule.permissions';
import { withAuthZContent } from 'lib/authz/components/withAuthZ/withAuthZContent';
@@ -26,6 +26,9 @@ import AlertRulesDenied from './AlertRulesDenied';
import AlertRulesLoading from './AlertRulesLoading';
import { useHomeAlertRules } from './useHomeAlertRules';
const LIST_CHECKS = [RuleListPermission];
const CREATE_CHECKS = [RuleCreatePermission];
function AlertRules({
onUpdateChecklistDoneItem,
loadingUserPreferences,
@@ -70,7 +73,7 @@ function AlertRules({
<div className="empty-actions-container">
<AuthZButton
checks={RuleCreateChecks}
checks={CREATE_CHECKS}
size="md"
variant="solid"
color="secondary"
@@ -221,8 +224,8 @@ function AlertRules({
}
export default withAuthZContent(AlertRules, {
checks: RuleListChecks,
preloadChecks: RuleCreateChecks,
checks: LIST_CHECKS,
preloadChecks: CREATE_CHECKS,
fallback: ({ deniedPermissions }) => (
<AlertRulesDenied deniedPermissions={deniedPermissions} />
),

View File

@@ -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,

View File

@@ -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),

View File

@@ -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(),
});

View File

@@ -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;

View File

@@ -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,
})),

View File

@@ -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(),
});

View File

@@ -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:

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -6,7 +6,7 @@ import { Typography } from '@signozhq/ui/typography';
import logEvent from 'api/common/logEvent';
import ROUTES from 'constants/routes';
import AuthZButton from 'lib/authz/components/AuthZButton/AuthZButton';
import { RuleCreateChecks } from 'lib/authz/hooks/useAuthZ/permissions/rule.permissions';
import { RuleCreatePermission } from 'lib/authz/hooks/useAuthZ/permissions/rule.permissions';
import { useSafeNavigate } from 'hooks/useSafeNavigate';
import { DataSource } from 'types/common/queryBuilder';
import { isModifierKeyPressed } from 'utils/app';
@@ -32,6 +32,8 @@ const alertLogEvents = (
void logEvent(title, dataSource ? { ...attributes, dataSource } : attributes);
};
const CREATE_CHECKS = [RuleCreatePermission];
interface AlertsEmptyStateProps {
onRefresh?: () => void;
}
@@ -89,7 +91,7 @@ export function AlertsEmptyState({
<div className={styles.actionContainer}>
<div className={styles.buttonGroup}>
<AuthZButton
checks={RuleCreateChecks}
checks={CREATE_CHECKS}
size="md"
variant="solid"
color="primary"

View File

@@ -1,14 +0,0 @@
import { AllTheProviders, renderHook } from 'tests/test-utils';
import { useRuleViews } from '../useRuleViews';
describe('useRuleViews', () => {
it('reports loading while the views query is held', () => {
const { result } = renderHook(() => useRuleViews({ enabled: false }), {
wrapper: AllTheProviders,
});
expect(result.current.isLoading).toBe(true);
expect(result.current.views).toStrictEqual([]);
});
});

View File

@@ -4,12 +4,14 @@ import { ColumnSelector } from 'components/TanStackTableView';
import type { TableColumnDef } from 'components/TanStackTableView';
import TextToolTip from 'components/TextToolTip';
import AuthZButton from 'lib/authz/components/AuthZButton/AuthZButton';
import { RuleCreateChecks } from 'lib/authz/hooks/useAuthZ/permissions/rule.permissions';
import { RuleCreatePermission } from 'lib/authz/hooks/useAuthZ/permissions/rule.permissions';
import type { AlertRule } from '../types';
import styles from './AlertRulesHeaderActions.module.scss';
const CREATE_CHECKS = [RuleCreatePermission];
interface Props {
columns: TableColumnDef<AlertRule>[];
/** False on the empty list, whose own button creates the first rule. */
@@ -31,7 +33,7 @@ function AlertRulesHeaderActions({
/>
{showNewAlert && (
<AuthZButton
checks={RuleCreateChecks}
checks={CREATE_CHECKS}
variant="solid"
size="sm"
prefix={<Plus size={14} />}

View File

@@ -13,7 +13,7 @@ import { useTableParams } from 'components/TanStackTableView/useTableParams';
import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
import { AuthZGuardContent } from 'lib/authz/components/AuthZGuard/AuthZGuardContent';
import PermissionDeniedCallout from 'lib/authz/components/PermissionDeniedCallout/PermissionDeniedCallout';
import { RuleListChecks } from 'lib/authz/hooks/useAuthZ/permissions/rule.permissions';
import { RuleListPermission } from 'lib/authz/hooks/useAuthZ/permissions/rule.permissions';
import { useAuthZ } from 'lib/authz/hooks/useAuthZ/useAuthZ';
import { useAppContext } from 'providers/App/App';
import { useTimezone } from 'providers/Timezone';
@@ -51,6 +51,7 @@ const CLIENT_VIEW_LIMIT = 200;
const DEFAULT_PAGE = 1;
const DEFAULT_LIMIT = 10;
const RULE_LIST_CHECKS = [RuleListPermission];
function ListAlertRules(): JSX.Element {
const { user } = useAppContext();
@@ -75,7 +76,7 @@ function ListAlertRules(): JSX.Element {
const { filter, applyFilter, submitQuery, changeStates, changeSort } =
useAlertRulesListFilter({ orderBy, setOrderBy, setPage });
const listAccess = useAuthZ(RuleListChecks);
const listAccess = useAuthZ(RULE_LIST_CHECKS);
const ruleViews = useAlertRuleViews({
filter,
applyFilter,
@@ -90,7 +91,7 @@ function ListAlertRules(): JSX.Element {
}, [setRailCollapsed, railCollapsed]);
const guardViewsRail = useCallback(
(content: ReactElement): ReactElement => (
<ViewsRailGuard checks={RuleListChecks} shouldRenderUntilDenied>
<ViewsRailGuard checks={RULE_LIST_CHECKS} shouldRenderUntilDenied>
{content}
</ViewsRailGuard>
),
@@ -294,7 +295,7 @@ function ListAlertRules(): JSX.Element {
<div ref={containerRef} className={styles.tableContainer}>
<AuthZGuardContent
checks={RuleListChecks}
checks={RULE_LIST_CHECKS}
fallback={({ deniedPermissions }): JSX.Element => (
<PermissionDeniedCallout
deniedPermissions={deniedPermissions}

View File

@@ -21,7 +21,8 @@ export interface UseAlertRuleViewsResult extends UseListViewsResult<RuleListFilt
}
// A link carrying only `view=<custom id>` gets that view's filter applied once
// the views load; a link carrying its own filter params keeps them.
// the views load; a link carrying its own filter params keeps them. A held
// query reports no loading, so the link also waits for `enabled`.
export function useAlertRuleViews({
filter,
applyFilter,
@@ -50,7 +51,7 @@ export function useAlertRuleViews({
const hasResolvedLinkedView = useRef(false);
useEffect(() => {
if (hasResolvedLinkedView.current || api.isLoading) {
if (hasResolvedLinkedView.current || !enabled || api.isLoading) {
return;
}
hasResolvedLinkedView.current = true;
@@ -61,7 +62,7 @@ export function useAlertRuleViews({
) {
applyFilter(activeView.filter);
}
}, [api.isLoading, activeView, applyFilter, filter]);
}, [enabled, api.isLoading, activeView, applyFilter, filter]);
return { ...views, customViewsLoading: api.isLoading };
}

View File

@@ -70,7 +70,7 @@ export function useRuleViews({
enabled,
}: UseRuleViewsArgs): SavedListViewsApi<RuleListFilter> {
const queryClient = useQueryClient();
const { data, isLoading, isIdle } = useListRuleViews({ query: { enabled } });
const { data, isLoading } = useListRuleViews({ query: { enabled } });
const views = useMemo<RuleView[]>(
() => (data?.data?.views ?? []).map(toRuleView),
@@ -147,11 +147,5 @@ export function useRuleViews({
[deleteMutation],
);
return {
views,
isLoading: isLoading || isIdle,
createView,
updateView,
deleteView,
};
return { views, isLoading, createView, updateView, deleteView };
}

View File

@@ -42,6 +42,10 @@
align-items: flex-start;
flex-direction: column;
.ant-typography {
color: var(--l1-foreground);
}
.loading-gif {
height: 72px;
margin-left: -24px;

View File

@@ -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,

View File

@@ -3,6 +3,10 @@ import {
initialQueryBuilderFormValuesMap,
} from 'constants/queryBuilder';
import { ORDERBY_FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
import {
BaseAutocompleteData,
DataTypes,
} from 'types/api/queryBuilder/queryAutocompleteResponse';
import { IBuilderQuery, Query } from 'types/api/queryBuilder/queryBuilderData';
import { LogsAggregatorOperator } from 'types/common/queryBuilder';
@@ -40,3 +44,9 @@ export const liveLogsCompositeQuery = constructCompositeQuery({
initialQueryData: initialQueryBuilderFormValuesMap.logs,
customQueryData: defaultLiveQueryDataConfig,
});
export const idObject: BaseAutocompleteData = {
key: 'id',
type: '',
dataType: DataTypes.String,
};

Some files were not shown because too many files have changed in this diff Show More