Compare commits

..

11 Commits

Author SHA1 Message Date
Tushar Vats
ceb93490f2 feat(logs): read log patterns from the sharded mappings tables
Mappings are sharded like the logs by log ID, so pattern() matches each
shard's logs against that shard's mappings. Templates and evolutions are
full copies on every node.

Assisted-by: Claude Opus 5.5
2026-12-04 21:05:03 +05:30
Tushar Vats
fe4b9ff3fc fix(querybuilder): skip the cost guard for pattern()
Its estimate had to build the pattern's log ID set and timed out at 5s.

Assisted-by: Claude Opus 5.5
2026-12-04 21:05:02 +05:30
Tushar Vats
03c39fb333 chore(logs-explorer): merge the log patterns api, filter and frontend branches
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 03:20:06 +05:30
Tushar Vats
46d55f079e feat(logs-explorer): add a patterns view and a show logs action per pattern
A Patterns tab next to List, Time series and Table shows the patterns of the
current query from the pattern request type: template, count, share and a
trend sparkline, with a note when counts come from a sample. Show logs adds
pattern('<template>') to the filter and opens the List view. The filter
editor treats pattern( as a function token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 03:19:33 +05:30
Tushar Vats
8e6abc1ba2 feat(querier): add the pattern request type for ingest-time log patterns
A pattern request counts the logs of one logs builder query by the pattern
the template miner exporter mapped them to (log_pattern_map), with each
pattern's template, share and trend. IDs of patterns that widened since are
counted under their current ID through pattern_changes. Log IDs sort by log
time, so the time range and the trend steps are log ID ranges. Above about
500k matching logs, logs and map rows keep the same hash sample.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 03:17:19 +05:30
Tushar Vats
5321023284 feat(querybuilder): add the pattern() filter for ingest-time log patterns
pattern('<template>'[, ...]) keeps the logs the template miner exporter
mapped to the given templates' patterns, or to older patterns that have
since widened into them. A template's ID is the FNV-1a hash of its text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 03:17:19 +05:30
Manika Malhotra
f927b80f64 chore(frontend): remove dead code from storybook, roles and service accounts (#13800)
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
cacheci / tests (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
#### Description

- Removes dead code owned by @H4ad: storybook, roles, authz and service
accounts. Part of #13738, split by code owner into #13797–#13802 so each
needs one reviewer; this one merges on its own. No change in behavior or
visuals is intended.
- 24 files, +14 / −500.
- The `MessageTip` state in the feedback foundation, and the v3
autocomplete storybook handlers; nothing calls those endpoints.
  - Radix leftovers in the storybook README and comments.
- Exported code nothing imports, and CSS rules for classes nothing
renders.

#### Additional Information

**Verification**

| Check | Result |
|---|---|
| `tsgo`, `oxlint`, `stylelint` | Run on every commit by the pre-commit
hooks; 0 errors on the head |
| `vite build` | Passes |
| jest, every test that imports a changed file | 848 test files, 7,337
tests, 0 failed |
| **All six PRs merged on `main`:** | |
| full jest, 10 shards | 1,171 test files, 10,950 tests, 0 failed, 15
skipped |
| Storybook interaction runner | 137 story files, 1,428 tests pass |
| Playwright e2e, Chromium, CI settings, one backend built from `main` |
768 passed, 1 failed (it fails on `main` too), 6 passed on retry. The 8
spec files behind every failure in either run, rerun back to back on an
idle machine: 44 of 44 pass on this build, and on `main` (3 there on
retry) |
| CSS a direct visit loads, per lazily loaded page (384) | Same global
rules as `main` wherever one can apply |

**Found while auditing, not changed here**

- `PermissionDeniedCallout` reads `styles.permissionCode`, which its
module never defined.
2026-12-02 15:52:17 +00:00
Aditya Singh
7a480086c7 fix(frontend): fix span details, quick filter and drawer header issues from the release sanity check (#13815)
#### Description

- Opening the Events tab in span details made the panel jump. The search
box used `autoFocus`, and the browser scrolled the panel to it. The box
now takes focus without a scroll.
- In log details and the span drawer, the "…" menu and "View full trace"
touched the ↑/↓ buttons. A shared `HeaderActions` wrapper adds a 4px
gap.
- The span percentile time range list was see-through over the
percentile table. The panel's `backdrop-filter` and shadow caused it, so
this PR removes them.
- In Edit quick filters, a long filter name scrolled the list sideways
and pushed Remove out of view. The name now ends in "…" and shows the
full name on hover.
- A long span event value opened its preview and a tooltip together. The
preview is now a `@signozhq/ui` popover, so one card opens. Expand
closes the card and opens the full value.

#### Issues closed by this PR

Part of https://github.com/SigNoz/events-pod/issues/306

#### Screenshots / Screen Recordings

**Event jump**

Before


https://github.com/user-attachments/assets/a618e7ad-5199-4146-b247-65f1d3d0430e


After



https://github.com/user-attachments/assets/9730adfc-1e3d-498c-b21c-d1c5de819a18



**Quick filter overflow**

Before



https://github.com/user-attachments/assets/238eafa9-0dd3-4cf2-b636-553f162f6b1f



After



https://github.com/user-attachments/assets/ef83e7e9-6091-4d64-879b-f2c05a7cfc90



Before and after screenshots, `main` on the left and this branch on the
right, in dark and light themes:
https://claude.ai/artifact/WXKCu7MuQsTVR24aYSZdUP

| Screen | On `main` | On this branch |
| --- | --- | --- |
| Span percentile time range list | The list is see-through. The
percentile table shows through the options. | The list is solid. |
| Edit quick filters, long filter name | The name runs past the row with
no "…". | The name ends in "…". The grip keeps its size, and Remove
stays in view. |
| Log details header | The "…" menu touches ↑/↓. | A 4px gap separates
them. |
| Span drawer header | "View full trace" touches ↑/↓. | A 4px gap
separates them. |
| Span event value, hover | The antd preview card opens. | The
`@signozhq/ui` preview card opens. |
| Span event value, Expand | The preview card stays on top of the
full-value dialog until the mouse moves. | The preview card closes. |

#### Additional Information

- New stories cover the time range list, long filter names and Expand.
With the fixes reverted, the long name and the span event plays fail.
- The existing log details and span drawer stories already show the
header gap.
- The Events jump does not show in a screenshot, because the screenshot
tool grows every scroller. A unit test covers it.
- Filter names in Edit quick filters are a little smaller now. They use
the same text size as the checkbox list next to them.
2026-12-02 15:36:54 +00:00
Shivam Gupta
a343edecdf chore(alertmanager): mark the v1 notification channel routes deprecated (#13847)
#### Description

- Marks the six `/api/v1/channels*` routes (list, get, create, update,
delete, test) `Deprecated: true` and names the
`/api/v2/notification_channels` replacement in each description.
- These routes are already documented as deprecated ([migration
guide](https://signoz.io/docs/alerts-management/migrate-notification-channel-api-v1-to-v2/)),
and the UI calls only the v2 routes. The spec still said `deprecated:
false`, so the API reference didn't flag them, and people (and Noz) kept
using v1.
- Regenerated `docs/api/openapi.yml` and the frontend client. The client
changes are doc comments and `@deprecated` tags only, and no app code
calls the v1 hooks.
- No behavior change: the routes keep working.

#### Issues closed by this PR

Refs SigNoz/echo-pod#995. The matching docs change is
SigNoz/signoz.io#4601.



🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 15:15:58 +00:00
Vinicius Lourenço
8d728170ce perf(frontend): split vendor chunks per package behind a chunk import map (#13809)
#### Description

After an upgrade, the browser now keeps most of the frontend it already
downloaded. Today almost any code change renames nearly every chunk, so
users fetch the whole app again after each release.

##### Why every chunk changed

Third-party code shared one big chunk with the app code it loads with,
so any app change re-hashed it. And a chunk's file name depends on the
names of the chunks it imports, so one change ripples through every
importer.

##### What changes

Packages over 100 KB in the first load now get their own chunk, and
Vite's chunk import map lets chunks import each other through stable
keys while `index.html` maps each key to the current hashed file. A
small boot guard, inlined into the production build from
`vite-plugins/boot-guard/`, shows "SigNoz failed to load" with a Reload
button if any file of the entry fails to download. The Sentry plugin no
longer bakes the release name into every chunk, since `Sentry.init`
already sets it.

##### Results

I simulated a release by changing one line in `src/index.tsx` and
building again. On main, 4% of the first-load bytes keep their file
name; with this PR, 84%. Across all assets it goes from 42% to 98%. The
first load is the same size (852 KB vs 854 KB gzip) in 19 files instead
of 3. The browser only skips the download once #13724 serves these files
as immutable.

##### Browser support

Import maps need Chrome 89, Firefox 108 and Safari 16.4. Vite 8 already
builds for Chrome 111, Firefox 114 and Safari 16.4 by default, so this
does not raise the minimum browser.

In PostHog, no user is on a browser without import maps. Under 0.01% are
on Chrome 109, below what Vite 8 already requires, or on Safari 16,
which may be older than 16.4: the export only has the major version.

On a browser without import map support, the boot guard shows a message
asking to update the browser instead of a blank page.

Part of #10192

#### Screenshots / Screen Recordings

JS requests on `/home`, main:

![JS requests on /home,
main](https://github.com/user-attachments/assets/5570f072-2c96-434b-a57a-232685e3462c)

JS requests on `/home`, this PR, one entry chunk plus one chunk per
large package:

![JS requests on /home, this
PR](https://github.com/user-attachments/assets/ca9e2f0c-6f3c-4270-9c0d-c3e1375e5004)

What a browser without import map support shows instead of a blank page:

![Your browser is not
supported](https://github.com/user-attachments/assets/e0782d1b-c5e9-4484-8e19-52096a3700a2)

#### Additional Information

#12079 is similar: it also splits vendors per package, without the
import map, so a changed chunk still renames every chunk that imports
it.

`build.chunkImportMap` is still experimental in Vite. Rolldown's own
option of the same name drops the CSS of lazy routes, which is why this
uses Vite's.

`index.html` grows from 2 KB to 25 KB gzip, since it carries the map.
2026-12-02 13:19:51 +00:00
Aditya Singh
bec18c6abf refactor(query-builder): drop the version argument from query range calls (#13777)
#### Description

- After #13757, the query range hooks and `getQueryRangeV5` still take a
`version` argument. Every caller passes v5, so the argument has no
effect.
- This PR removes the argument from the API function, the hooks and the
WidgetCard components, and from every caller.
- It removes WidgetCard's error-text checks. They matched error strings
that only the removed legacy path produced, so they never ran on v5.
- It removes the `isNewQueryV2` prop and the old option list from the
order by filter. Every caller already got the v5 options.

#### Issues closed by this PR

Part of https://github.com/SigNoz/events-pod/issues/161

#### Additional Information

- Part of https://github.com/SigNoz/events-pod/issues/156.
- This PR builds on #13757.
- No screen renders differently, so no story changes.
- It types the `DomainMetrics` test's query range mock, so the test no
longer casts with `as jest.Mock`.
- The Celery task graphs had a hint for missing Flower metrics. It has
not shown since #13644 moved Celery to v5, because it depended on one of
the removed error-text checks.
- I did not test a dashboard panel whose query fails, because staging
has no broken panel. The panel still gets its error message from
`errorDetails`, as before.
2026-12-02 13:19:47 +00:00
196 changed files with 4241 additions and 1983 deletions

View File

@@ -113,10 +113,11 @@ 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.
- 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.
- 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.

View File

@@ -165,7 +165,6 @@ apiserver:
- /api/v1/health
- /api/v1/version
- /
- /assets/
##################### Querier #####################
querier:

View File

@@ -10445,6 +10445,80 @@ components:
- asc
- desc
type: string
Querybuildertypesv5Pattern:
properties:
count:
description: The number of logs of the pattern in the time range, scaled
up by sampleRate.
minimum: 0
type: integer
id:
description: 'The pattern''s ID: the decimal 64-bit FNV-1a hash of its template.'
type: string
pattern:
description: 'The pattern''s template: the log message with the values that
change replaced by <*>. Empty when the template is not known yet.'
type: string
percent:
description: The pattern's count as a percentage of total.
format: double
type: number
trend:
description: The number of logs of the pattern in each step of the time
range, oldest first. Steps without a log are left out.
items:
$ref: '#/components/schemas/Querybuildertypesv5PatternTrendPoint'
nullable: true
type: array
required:
- id
- pattern
- count
- percent
- trend
type: object
Querybuildertypesv5PatternTrendPoint:
properties:
count:
description: The number of logs of the pattern in the step, scaled up by
sampleRate.
minimum: 0
type: integer
timestamp:
description: The Unix time in milliseconds the step starts at.
format: int64
type: integer
required:
- timestamp
- count
type: object
Querybuildertypesv5PatternsData:
properties:
patterns:
description: The patterns, most logs first.
items:
$ref: '#/components/schemas/Querybuildertypesv5Pattern'
nullable: true
type: array
queryName:
description: The name of the query that produced this result.
type: string
sampleRate:
description: One in sampleRate of the matching logs was read and every count
is scaled up by it. 1 means every log was read and the counts are exact.
minimum: 0
type: integer
total:
description: The number of matching logs that have a pattern, over every
pattern.
minimum: 0
type: integer
required:
- queryName
- sampleRate
- total
- patterns
type: object
Querybuildertypesv5PreviewStatement:
properties:
db.statement.args:
@@ -11006,11 +11080,12 @@ components:
- $ref: '#/components/schemas/Querybuildertypesv5ScalarData'
- $ref: '#/components/schemas/Querybuildertypesv5RawData'
- $ref: '#/components/schemas/Querybuildertypesv5DistributionData'
- $ref: '#/components/schemas/Querybuildertypesv5PatternsData'
properties:
results:
description: 'One result per enabled query, typed by the request type: TimeSeriesData
for time_series and heatmap, ScalarData for scalar, RawData for raw and
DistributionData for distribution requests.'
for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData
for distribution and PatternsData for pattern requests.'
items: {}
nullable: true
type: array
@@ -11201,8 +11276,8 @@ components:
Querybuildertypesv5QueryRangeResponse:
description: 'Response from the v5 query range endpoint. The data.results array
contains typed results depending on the requestType: TimeSeriesData for time_series
and heatmap, ScalarData for scalar, RawData for raw, or DistributionData for
distribution requests.'
and heatmap, ScalarData for scalar, RawData for raw, DistributionData for
distribution, or PatternsData for pattern requests.'
properties:
data:
allOf:
@@ -11299,6 +11374,7 @@ components:
- raw_stream
- trace
- heatmap
- pattern
- distribution
type: string
Querybuildertypesv5ScalarData:
@@ -14496,8 +14572,9 @@ paths:
x-signoz-stability: alpha
/api/v1/channels:
get:
deprecated: false
description: This endpoint lists all notification channels for the organization
deprecated: true
description: 'Deprecated: use GET /api/v2/notification_channels instead. This
endpoint lists all notification channels for the organization'
operationId: ListChannels
responses:
"200":
@@ -14544,8 +14621,9 @@ paths:
- channels
x-signoz-stability: alpha
post:
deprecated: false
description: This endpoint creates a notification channel
deprecated: true
description: 'Deprecated: use POST /api/v2/notification_channels instead. This
endpoint creates a notification channel'
operationId: CreateChannel
requestBody:
content:
@@ -14602,8 +14680,9 @@ paths:
x-signoz-stability: alpha
/api/v1/channels/{id}:
delete:
deprecated: false
description: This endpoint deletes a notification channel by ID
deprecated: true
description: 'Deprecated: use DELETE /api/v2/notification_channels/{id} instead.
This endpoint deletes a notification channel by ID'
operationId: DeleteChannelByID
parameters:
- in: path
@@ -14648,8 +14727,9 @@ paths:
- channels
x-signoz-stability: alpha
get:
deprecated: false
description: This endpoint returns a notification channel by ID
deprecated: true
description: 'Deprecated: use GET /api/v2/notification_channels/{id} instead.
This endpoint returns a notification channel by ID'
operationId: GetChannelByID
parameters:
- in: path
@@ -14706,8 +14786,9 @@ paths:
- channels
x-signoz-stability: alpha
put:
deprecated: false
description: This endpoint updates a notification channel by ID
deprecated: true
description: 'Deprecated: use PUT /api/v2/notification_channels/{id} instead.
This endpoint updates a notification channel by ID'
operationId: UpdateChannelByID
parameters:
- in: path
@@ -14764,8 +14845,9 @@ paths:
x-signoz-stability: alpha
/api/v1/channels/test:
post:
deprecated: false
description: This endpoint tests a notification channel by sending a test notification
deprecated: true
description: 'Deprecated: use POST /api/v2/notification_channels/test instead.
This endpoint tests a notification channel by sending a test notification'
operationId: TestChannel
requestBody:
content:

3
frontend/.gitignore vendored
View File

@@ -1,7 +1,4 @@
# 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,6 +53,7 @@ const EXCLUDED_PLUGINS = [
'vite-plugin-checker',
'dev-base-path',
'dev-boot-data',
'signoz:inline-boot-guard',
'vite-plugin-compression',
];

View File

@@ -42,7 +42,10 @@ const config: Config.InitialOptions = {
'<rootDir>/node_modules/@signozhq/$1/dist/$1.js',
},
extensionsToTreatAsEsm: ['.ts'],
testMatch: ['<rootDir>/src/**/*?(*.)(test).(ts|js)?(x)'],
testMatch: [
'<rootDir>/src/**/*?(*.)(test).(ts|js)?(x)',
'<rootDir>/vite-plugins/**/*.test.ts',
],
preset: 'ts-jest/presets/js-with-ts-esm',
transform: {
'^.+\\.(ts|tsx)?$': [

View File

@@ -68,7 +68,8 @@ const withQueryKey = <T extends object, K>(
};
/**
* This endpoint lists all notification channels for the organization
* Deprecated: use GET /api/v2/notification_channels instead. This endpoint lists all notification channels for the organization
* @deprecated
* @summary List notification channels
*/
export const listChannels = (signal?: AbortSignal) => {
@@ -114,6 +115,7 @@ export type ListChannelsQueryResult = NonNullable<
export type ListChannelsQueryError = ErrorType<RenderErrorResponseDTO>;
/**
* @deprecated
* @summary List notification channels
*/
@@ -137,6 +139,7 @@ export function useListChannels<
}
/**
* @deprecated
* @summary List notification channels
*/
export const invalidateListChannels = async (
@@ -152,7 +155,8 @@ export const invalidateListChannels = async (
};
/**
* This endpoint creates a notification channel
* Deprecated: use POST /api/v2/notification_channels instead. This endpoint creates a notification channel
* @deprecated
* @summary Create notification channel
*/
export const createChannel = (
@@ -214,6 +218,7 @@ export type CreateChannelMutationBody =
export type CreateChannelMutationError = ErrorType<RenderErrorResponseDTO>;
/**
* @deprecated
* @summary Create notification channel
*/
export const useCreateChannel = <
@@ -235,7 +240,8 @@ export const useCreateChannel = <
return useMutation(getCreateChannelMutationOptions(options));
};
/**
* This endpoint deletes a notification channel by ID
* Deprecated: use DELETE /api/v2/notification_channels/{id} instead. This endpoint deletes a notification channel by ID
* @deprecated
* @summary Delete notification channel
*/
export const deleteChannelByID = (
@@ -293,6 +299,7 @@ export type DeleteChannelByIDMutationResult = NonNullable<
export type DeleteChannelByIDMutationError = ErrorType<RenderErrorResponseDTO>;
/**
* @deprecated
* @summary Delete notification channel
*/
export const useDeleteChannelByID = <
@@ -314,7 +321,8 @@ export const useDeleteChannelByID = <
return useMutation(getDeleteChannelByIDMutationOptions(options));
};
/**
* This endpoint returns a notification channel by ID
* Deprecated: use GET /api/v2/notification_channels/{id} instead. This endpoint returns a notification channel by ID
* @deprecated
* @summary Get notification channel by ID
*/
export const getChannelByID = (
@@ -373,6 +381,7 @@ export type GetChannelByIDQueryResult = NonNullable<
export type GetChannelByIDQueryError = ErrorType<RenderErrorResponseDTO>;
/**
* @deprecated
* @summary Get notification channel by ID
*/
@@ -399,6 +408,7 @@ export function useGetChannelByID<
}
/**
* @deprecated
* @summary Get notification channel by ID
*/
export const invalidateGetChannelByID = async (
@@ -415,7 +425,8 @@ export const invalidateGetChannelByID = async (
};
/**
* This endpoint updates a notification channel by ID
* Deprecated: use PUT /api/v2/notification_channels/{id} instead. This endpoint updates a notification channel by ID
* @deprecated
* @summary Update notification channel
*/
export const updateChannelByID = (
@@ -487,6 +498,7 @@ export type UpdateChannelByIDMutationBody =
export type UpdateChannelByIDMutationError = ErrorType<RenderErrorResponseDTO>;
/**
* @deprecated
* @summary Update notification channel
*/
export const useUpdateChannelByID = <
@@ -514,7 +526,8 @@ export const useUpdateChannelByID = <
return useMutation(getUpdateChannelByIDMutationOptions(options));
};
/**
* This endpoint tests a notification channel by sending a test notification
* Deprecated: use POST /api/v2/notification_channels/test instead. This endpoint tests a notification channel by sending a test notification
* @deprecated
* @summary Test notification channel
*/
export const testChannel = (
@@ -576,6 +589,7 @@ export type TestChannelMutationBody =
export type TestChannelMutationError = ErrorType<RenderErrorResponseDTO>;
/**
* @deprecated
* @summary Test notification channel
*/
export const useTestChannel = <

View File

@@ -7270,6 +7270,7 @@ export enum Querybuildertypesv5RequestTypeDTO {
raw_stream = 'raw_stream',
trace = 'trace',
heatmap = 'heatmap',
pattern = 'pattern',
distribution = 'distribution',
}
/**
@@ -12190,6 +12191,76 @@ export interface Querybuildertypesv5FormatOptionsDTO {
formatTableResultForUI?: boolean;
}
export interface Querybuildertypesv5PatternTrendPointDTO {
/**
* @type integer
* @minimum 0
* @description The number of logs of the pattern in the step, scaled up by sampleRate.
*/
count: number;
/**
* @type integer
* @format int64
* @description The Unix time in milliseconds the step starts at.
*/
timestamp: number;
}
export interface Querybuildertypesv5PatternDTO {
/**
* @type integer
* @minimum 0
* @description The number of logs of the pattern in the time range, scaled up by sampleRate.
*/
count: number;
/**
* @type string
* @description The pattern's ID: the decimal 64-bit FNV-1a hash of its template.
*/
id: string;
/**
* @type string
* @description The pattern's template: the log message with the values that change replaced by <*>. Empty when the template is not known yet.
*/
pattern: string;
/**
* @type number
* @format double
* @description The pattern's count as a percentage of total.
*/
percent: number;
/**
* @type array,null
* @description The number of logs of the pattern in each step of the time range, oldest first. Steps without a log are left out.
*/
trend: Querybuildertypesv5PatternTrendPointDTO[] | null;
}
export interface Querybuildertypesv5PatternsDataDTO {
/**
* @type array,null
* @description The patterns, most logs first.
*/
patterns: Querybuildertypesv5PatternDTO[] | null;
/**
* @type string
* @description The name of the query that produced this result.
*/
queryName: string;
/**
* @type integer
* @minimum 0
* @description One in sampleRate of the matching logs was read and every count is scaled up by it. 1 means every log was read and the counts are exact.
*/
sampleRate: number;
/**
* @type integer
* @minimum 0
* @description The number of matching logs that have a pattern, over every pattern.
*/
total: number;
}
export interface TelemetrystoretypesIndexStepDTO {
/**
* @type string
@@ -12396,28 +12467,35 @@ export type Querybuildertypesv5QueryDataDTO =
| (Querybuildertypesv5TimeSeriesDataDTO & {
/**
* @type array,null
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw and DistributionData for distribution requests.
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
*/
results?: unknown[] | null;
})
| (Querybuildertypesv5ScalarDataDTO & {
/**
* @type array,null
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw and DistributionData for distribution requests.
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
*/
results?: unknown[] | null;
})
| (Querybuildertypesv5RawDataDTO & {
/**
* @type array,null
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw and DistributionData for distribution requests.
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
*/
results?: unknown[] | null;
})
| (Querybuildertypesv5DistributionDataDTO & {
/**
* @type array,null
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw and DistributionData for distribution requests.
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
*/
results?: unknown[] | null;
})
| (Querybuildertypesv5PatternsDataDTO & {
/**
* @type array,null
* @description One result per enabled query, typed by the request type: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution and PatternsData for pattern requests.
*/
results?: unknown[] | null;
});
@@ -12551,7 +12629,7 @@ export interface Querybuildertypesv5QueryRangeRequestDTO {
}
/**
* Response from the v5 query range endpoint. The data.results array contains typed results depending on the requestType: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, or DistributionData for distribution requests.
* Response from the v5 query range endpoint. The data.results array contains typed results depending on the requestType: TimeSeriesData for time_series and heatmap, ScalarData for scalar, RawData for raw, DistributionData for distribution, or PatternsData for pattern requests.
*/
export interface Querybuildertypesv5QueryRangeResponseDTO {
/**

View File

@@ -1,7 +1,6 @@
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,
@@ -17,24 +16,10 @@ 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,
@@ -42,7 +27,7 @@ export const getQueryRangeV5 = async (
return {
httpStatusCode: response.status,
data: response.data.data,
data: response.data,
};
} catch (error) {
ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);

View File

@@ -124,7 +124,7 @@ function isDeprecatedField(fieldName: string): boolean {
);
}
function getFilter(queryData: IBuilderQuery): Filter {
export function getFilter(queryData: IBuilderQuery): Filter {
const { filter } = queryData;
if (filter?.expression) {
return {

View File

@@ -7,7 +7,6 @@ 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';
@@ -179,7 +178,6 @@ function CeleryTaskBar({
{barState === CeleryTaskState.All && (
<GridCard
widget={celeryAllStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
@@ -201,7 +199,6 @@ function CeleryTaskBar({
{barState === CeleryTaskState.Failed && (
<GridCard
widget={celeryFailedStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
@@ -222,7 +219,6 @@ function CeleryTaskBar({
{barState === CeleryTaskState.Retry && (
<GridCard
widget={celeryRetryStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
@@ -243,7 +239,6 @@ function CeleryTaskBar({
{barState === CeleryTaskState.Successful && (
<GridCard
widget={celerySuccessStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}

View File

@@ -1,7 +1,6 @@
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';
@@ -137,7 +136,6 @@ function CeleryTaskGraph({
isQueryEnabled={queryEnabled}
openTracesButton={openTracesButton}
onOpenTraceBtnClick={onOpenTraceBtnClick}
version={ENTITY_VERSION_V5}
customErrorMessage={customErrorMessage}
start={start}
end={end}

View File

@@ -9,7 +9,6 @@ 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';
@@ -202,7 +201,6 @@ function CeleryTaskLatencyGraph({
</Button>
<GridCard
widget={updatedWidgetData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={onGraphClick('Celery_p99_latency')}
@@ -224,7 +222,6 @@ function CeleryTaskLatencyGraph({
</Button>
<GridCard
widget={updatedWidgetData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={onGraphClick('Celery_p95_latency')}
@@ -245,7 +242,6 @@ function CeleryTaskLatencyGraph({
</Button>
<GridCard
widget={updatedWidgetData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={onGraphClick('Celery_p90_latency')}

View File

@@ -2,7 +2,6 @@ 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 {
@@ -42,9 +41,9 @@ export const useGetValueFromWidget = (
const queries = useQueries(
queryPayloads().map((payload) => ({
queryKey: [...queryKey, payload, ENTITY_VERSION_V5],
queryKey: [...queryKey, payload],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
GetMetricQueryRange(payload),
enabled: !!payload,
})),
);

View File

@@ -21,9 +21,4 @@
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

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

View File

@@ -0,0 +1,21 @@
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,4 +1,6 @@
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';
@@ -34,6 +36,34 @@ 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"
@@ -43,23 +73,7 @@ function LogDetail({
title={title}
width="extra-wide"
closePosition="start"
headerSuffix={
<>
{shownLog && (
<LogActions
log={shownLog}
showOpenInExplorer={!!handleOpenInExplorer}
onOpenInExplorer={handleOpenInExplorer}
/>
)}
<LogNavigation
onNavigatePrev={goToPrev}
onNavigateNext={goToNext}
isPrevDisabled={isPrevDisabled}
isNextDisabled={isNextDisabled}
/>
</>
}
headerSuffix={<HeaderActions actions={headerActions} />}
testId="log-detail-drawer"
>
{shownLog && (

View File

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

View File

@@ -192,8 +192,7 @@ export const QueryV2 = forwardRef(function QueryV2(
!functions.hidden &&
(query.dataSource === DataSource.LOGS ||
query.dataSource === DataSource.METRICS ||
hasQueryFunctions ||
false)
hasQueryFunctions)
}
areFunctionsDisabled={functions.disabled}
functionsDisabledReason={functions.reason}

View File

@@ -73,6 +73,14 @@ const formatSingleValue = (v: string | number | boolean): string => {
return String(v);
};
/**
* Quotes text as a filter expression string literal, escaping backslashes and
* single quotes so the text round-trips exactly. Unlike formatValueForExpression,
* it never treats the text as already quoted or as a variable.
*/
export const formatStringLiteralForExpression = (value: string): string =>
`'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
/**
* Format a value for the expression string
* @param value - The value to format

View File

@@ -15,6 +15,7 @@ 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';
@@ -46,7 +47,17 @@ function SortableFilter({
>
<div {...attributes} {...listeners} className="drag-handle">
{allowDrag && <GripVertical size={16} />}
{filter.name}
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
display="block"
textOverflow="ellipsis"
>
{filter.name}
</Typography>
</div>
{allowRemove && (
<Button

View File

@@ -1,5 +1,6 @@
import { useMemo } from 'react';
import { Button, Skeleton } from 'antd';
import { Typography } from '@signozhq/ui/typography';
import {
QuickfiltertypesSourceDTO,
TelemetrytypesSourceDTO,
@@ -98,7 +99,17 @@ function OtherFilters({
return otherFilters.map((filter) => (
<div key={filter.key} className="qf-filter-item other-filters-item">
<div className="qf-filter-key">{filter.name}</div>
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
display="block"
textOverflow="ellipsis"
>
{filter.name}
</Typography>
<Button
className="add-filter-btn periscope-btn"
size="small"

View File

@@ -132,6 +132,11 @@
align-items: center;
gap: 8px;
flex-grow: 1;
min-width: 0;
> svg {
flex-shrink: 0;
}
}
.qf-filter-content {
@@ -158,6 +163,7 @@
.remove-filter-btn,
.add-filter-btn {
flex-shrink: 0;
padding: 6px 12px;
opacity: 0;
transition: opacity 0.2s ease-in-out;

View File

@@ -90,6 +90,35 @@ 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,6 +11,7 @@ import {
hoverTruncatedTitle,
openQueryPicker,
openSettings,
showsLongFilterNames,
} from './__story_mockdata__/quickFilters.play';
import {
checkboxConfig,
@@ -19,6 +20,7 @@ import {
handlers,
LONG_FILTER_VALUES,
loadingFiltersHandlers,
longFilterNameHandlers,
longTitleConfig,
MANY_FILTER_VALUES,
queryBuilder,
@@ -65,6 +67,12 @@ 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,6 +64,32 @@ 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,18 +18,6 @@
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;
@@ -100,11 +88,4 @@
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

@@ -50,6 +50,7 @@ export enum QueryParams {
tab = 'tab',
thresholds = 'thresholds',
selectedExplorerView = 'selectedExplorerView',
logsExplorerView = 'logsExplorerView',
variables = 'variables',
version = 'version',
source = 'source',

View File

@@ -12,6 +12,7 @@ export const REACT_QUERY_KEY = {
GET_PUBLIC_DASHBOARD_WIDGET_DATA: 'GET_PUBLIC_DASHBOARD_WIDGET_DATA',
GET_ALL_LICENCES: 'GET_ALL_LICENCES',
GET_QUERY_RANGE: 'GET_QUERY_RANGE',
GET_LOG_PATTERNS: 'GET_LOG_PATTERNS',
GET_ALL_DASHBOARDS: 'GET_ALL_DASHBOARDS',
GET_TRIGGERED_ALERTS: 'GET_TRIGGERED_ALERTS',
DASHBOARD_BY_ID: 'DASHBOARD_BY_ID',

View File

@@ -1,7 +1,6 @@
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,
@@ -156,7 +155,6 @@ function AllEndPoints({
customOnDragSelect={(): void => {}}
customTimeRange={timeRange}
customOnRowClick={onRowClick}
version={ENTITY_VERSION_V5}
/>
</div>
</div>

View File

@@ -2,7 +2,6 @@ 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,
@@ -93,13 +92,9 @@ function EndPointDetails({
const endPointDetailsDataQueries = useQueries(
endPointDetailsQueryPayload.map((payload, index) => ({
queryKey: [
END_POINT_DETAILS_QUERY_KEYS_ARRAY[index],
payload,
ENTITY_VERSION_V5,
],
queryKey: [END_POINT_DETAILS_QUERY_KEYS_ARRAY[index], payload],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
GetMetricQueryRange(payload),
enabled: !!payload,
// Keeps the table's rows, and so its height, while a new filter loads
keepPreviousData:

View File

@@ -9,7 +9,6 @@ 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,
@@ -76,13 +75,12 @@ function TopErrors({
queryKey: [
REACT_QUERY_KEY.GET_TOP_ERRORS_BY_DOMAIN,
queryPayload,
ENTITY_VERSION_V5,
showStatusCodeErrors,
],
queryFn: ({
signal,
}: QueryFunctionContext): Promise<SuccessResponseV2<MetricRangePayloadV5>> =>
getQueryRangeV5(queryPayload, ENTITY_VERSION_V5, signal),
getQueryRangeV5(queryPayload, signal),
enabled: !!queryPayload,
staleTime: 0,
cacheTime: 0,

View File

@@ -1,8 +1,9 @@
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';
@@ -12,6 +13,33 @@ 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,
@@ -36,30 +64,16 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
domainListFilterExpression: '',
};
const mockSuccessResponse = {
statusCode: 200,
error: null,
payload: {
const mockSuccessResponse = buildResponse([
{
data: {
result: [
{
table: {
rows: [
{
data: {
A: '150',
B: '125000000',
D: '2021-01-01T23:00:00Z',
F1: '5.5',
},
},
],
},
},
],
A: '150',
B: '125000000',
D: '2021-01-01T23:00:00Z',
F1: '5.5',
},
},
};
]);
beforeEach(() => {
queryClient = new QueryClient({
@@ -86,7 +100,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 () => {
(GetMetricQueryRange as jest.Mock).mockResolvedValue(mockSuccessResponse);
mockGetMetricQueryRange.mockResolvedValue(mockSuccessResponse);
renderComponent();
@@ -94,10 +108,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
expect(GetMetricQueryRange).toHaveBeenCalledTimes(1);
});
const [payload, version] = (GetMetricQueryRange as jest.Mock).mock.calls[0];
// Verify it's using V5
expect(version).toBe(ENTITY_VERSION_V5);
const [payload] = mockGetMetricQueryRange.mock.calls[0];
// Verify time range
expect(payload.start).toBe(1758259531000);
@@ -111,64 +122,60 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
const queryData = payload.query.builder.queryData;
// Verify Query A - count with URL filter
const queryA = queryData.find((q: any) => q.queryName === 'A');
expect(queryA).toBeDefined();
const queryA = findQuery(queryData, 'A');
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 = queryData.find((q: any) => q.queryName === 'B');
expect(queryB).toBeDefined();
const queryB = findQuery(queryData, 'B');
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 = queryData.find((q: any) => q.queryName === 'C');
expect(queryC).toBeDefined();
const queryC = findQuery(queryData, 'C');
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 = queryData.find((q: any) => q.queryName === 'D');
expect(queryD).toBeDefined();
const queryD = findQuery(queryData, 'D');
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: any) => f.queryName === 'F1');
const formulaF1 = formulas.find((f) => 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 () => {
(GetMetricQueryRange as jest.Mock).mockResolvedValue(mockSuccessResponse);
mockGetMetricQueryRange.mockResolvedValue(mockSuccessResponse);
const customFilterExpression =
"service.name = 'my-service' AND deployment.environment = 'production'";
@@ -182,24 +189,21 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
expect(GetMetricQueryRange).toHaveBeenCalled();
});
const [payload] = (GetMetricQueryRange as jest.Mock).mock.calls[0];
const [payload] = mockGetMetricQueryRange.mock.calls[0];
const queryData = payload.query.builder.queryData;
// Verify all queries include the custom filters
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');
}
const expressions = queryData.map((query) => query.filter?.expression);
expect(expressions).toHaveLength(4);
expressions.forEach((expression) => {
expect(expression).toContain(customFilterExpression);
});
});
});
describe('2. Data Display State', () => {
it('displays metrics when data is successfully loaded', async () => {
(GetMetricQueryRange as jest.Mock).mockResolvedValue(mockSuccessResponse);
mockGetMetricQueryRange.mockResolvedValue(mockSuccessResponse);
renderComponent();
@@ -220,23 +224,9 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
describe('3. Empty/Missing Data State', () => {
it('displays "-" for missing data values', async () => {
const emptyResponse = {
statusCode: 200,
error: null,
payload: {
data: {
result: [
{
table: {
rows: [],
},
},
],
},
},
};
const emptyResponse = buildResponse([]);
(GetMetricQueryRange as jest.Mock).mockResolvedValue(emptyResponse);
mockGetMetricQueryRange.mockResolvedValue(emptyResponse);
renderComponent();
@@ -248,7 +238,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
describe('4. Error State', () => {
it('displays error state when API call fails', async () => {
(GetMetricQueryRange as jest.Mock).mockRejectedValue(new Error('API Error'));
mockGetMetricQueryRange.mockRejectedValue(new Error('API Error'));
renderComponent();
@@ -261,7 +251,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
it('retries API call when retry button is clicked', async () => {
let callCount = 0;
(GetMetricQueryRange as jest.Mock).mockImplementation(() => {
mockGetMetricQueryRange.mockImplementation(() => {
callCount += 1;
if (callCount === 1) {
return Promise.reject(new Error('API Error'));

View File

@@ -3,7 +3,6 @@ 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,
@@ -41,13 +40,9 @@ function DomainMetrics({
// Since only one query here
const domainMetricsDataQueries = useQueries(
queryPayloads.map((payload) => ({
queryKey: [
REACT_QUERY_KEY.GET_DOMAIN_METRICS_DATA,
payload,
ENTITY_VERSION_V5,
],
queryKey: [REACT_QUERY_KEY.GET_DOMAIN_METRICS_DATA, payload],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
GetMetricQueryRange(payload),
enabled: !!payload,
staleTime: 60 * 1000, // 1 minute stale time : optimize this part
})),

View File

@@ -1,7 +1,6 @@
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,
@@ -44,12 +43,8 @@ function EndPointPicker({
);
const { data, isLoading, isFetching } = useQuery({
queryKey: [
REACT_QUERY_KEY.GET_ENDPOINT_DROPDOWN_DATA,
payload,
ENTITY_VERSION_V5,
],
queryFn: () => GetMetricQueryRange(payload, ENTITY_VERSION_V5),
queryKey: [REACT_QUERY_KEY.GET_ENDPOINT_DROPDOWN_DATA, payload],
queryFn: () => GetMetricQueryRange(payload),
staleTime: 60 * 1000,
});

View File

@@ -1,5 +1,4 @@
import { Card } from 'antd';
import { ENTITY_VERSION_V5 } from 'constants/app';
import GridCard from 'container/WidgetCard/Card';
import { Widgets } from 'types/api/widgets/widget';
@@ -23,7 +22,6 @@ function MetricOverTimeGraph({
customOnDragSelect={(): void => {}}
customTimeRange={timeRange}
customTimeRangeWindowForCoRelation="5m"
version={ENTITY_VERSION_V5}
/>
</div>
</Card>

View File

@@ -8,7 +8,6 @@ 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';
@@ -177,7 +176,6 @@ function ChartPreview({
},
originalGraphType: graphType,
},
ENTITY_VERSION_V5,
{
queryKey: [
REACT_QUERY_KEY.ALERT_RULES_CHART_PREVIEW,

View File

@@ -20,7 +20,6 @@ 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';
@@ -102,7 +101,6 @@ export default function Home(): JSX.Element {
},
formatForWeb: false,
},
ENTITY_VERSION_V5,
{
queryKey: [
REACT_QUERY_KEY.GET_QUERY_RANGE,
@@ -127,7 +125,6 @@ export default function Home(): JSX.Element {
},
formatForWeb: false,
},
ENTITY_VERSION_V5,
{
queryKey: [
REACT_QUERY_KEY.GET_QUERY_RANGE,

View File

@@ -4,7 +4,6 @@ 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,
@@ -226,27 +225,23 @@ function ServiceMetrics({
[globalSelectedInterval, topLevelOperations],
);
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 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 isLoading = useMemo(
() => dataQueries.some((query) => query.isLoading),

View File

@@ -1,6 +1,5 @@
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';
@@ -77,7 +76,7 @@ export function useEntityEvents({
offset,
pageSize,
});
return GetMetricQueryRange(query, ENTITY_VERSION_V5, undefined, signal);
return GetMetricQueryRange(query, undefined, signal);
},
enabled: !!expression?.trim(),
});

View File

@@ -1,6 +1,5 @@
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';
@@ -63,7 +62,7 @@ export function useInfiniteEntityLogs({
offset: pageParam as number,
pageSize: DEFAULT_PER_PAGE_VALUE,
});
return GetMetricQueryRange(query, ENTITY_VERSION_V5, undefined, signal);
return GetMetricQueryRange(query, undefined, signal);
},
getNextPageParam: (lastPage, allPages) => {
const list = lastPage?.payload?.data?.newResult?.data?.result?.[0]?.list;

View File

@@ -1,6 +1,5 @@
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';
@@ -51,18 +50,12 @@ 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,
ENTITY_VERSION_V5,
category,
],
queryKey: [REACT_QUERY_KEY.AUTO_REFRESH_QUERY, queryKey, payload, category],
queryFn: ({
signal,
}: QueryFunctionContext): Promise<
SuccessResponse<MetricRangePayloadProps>
> => GetMetricQueryRange(payload, ENTITY_VERSION_V5, undefined, signal),
> => GetMetricQueryRange(payload, undefined, signal),
enabled: !!payload && visibilities[index],
keepPreviousData: true,
})),

View File

@@ -1,6 +1,5 @@
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';
@@ -68,7 +67,7 @@ export function useEntityTraces({
offset,
pageSize,
});
return GetMetricQueryRange(query, ENTITY_VERSION_V5, undefined, signal);
return GetMetricQueryRange(query, undefined, signal);
},
enabled: !!expression?.trim(),
});

View File

@@ -14,7 +14,6 @@ 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';
@@ -145,7 +144,6 @@ function ListView({
selectColumns,
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled:

View File

@@ -12,7 +12,6 @@ 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';
@@ -71,7 +70,6 @@ function TableView({
dataSource: 'traces',
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled: !!stagedQuery && panelType === PANEL_TYPES.TABLE,

View File

@@ -8,7 +8,6 @@ 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';
@@ -89,7 +88,6 @@ function TimeSeriesViewContainer({
dataSource,
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled: !!stagedQuery && panelType === PANEL_TYPES.TIME_SERIES,

View File

@@ -14,7 +14,6 @@ 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';
@@ -140,7 +139,6 @@ function TracesView({
pagination: paginationQueryData,
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled: !!stagedQuery && panelType === PANEL_TYPES.TRACE,

View File

@@ -1,5 +1,4 @@
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';
@@ -57,7 +56,6 @@ function LiveLogsListChart({
const { data, isFetching } = useGetExplorerQueryRange(
listChartQuery,
PANEL_TYPES.TIME_SERIES,
ENTITY_VERSION_V5,
{
enabled: isConnectionOpen,
refetchInterval: LIVE_TAIL_GRAPH_INTERVAL,

View File

@@ -7,7 +7,6 @@ import {
useMemo,
useState,
} from 'react';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { PANEL_TYPES } from 'constants/queryBuilder';
import {
getOrderByTimestamp,
@@ -131,7 +130,6 @@ export const useContextLogData = ({
const { isError, isFetching } = useGetExplorerQueryRange(
requestData,
PANEL_TYPES.LIST,
ENTITY_VERSION_V5,
{
keepPreviousData: true,
enabled: !!requestData,

View File

@@ -4,7 +4,6 @@ import { Card, Skeleton } from 'antd';
import { Typography } from '@signozhq/ui/typography';
import cx from 'classnames';
import Uplot from 'components/Uplot';
import { ENTITY_VERSION_V5 } from 'constants/app';
import dayjs from 'dayjs';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { useResizeObserver } from 'hooks/useDimensions';
@@ -60,9 +59,9 @@ function NodeMetrics({
const widgetInfo = nodeName ? nodeWidgetInfo : hostWidgetInfo;
const queries = useQueries(
queryPayloads.map((payload) => ({
queryKey: ['metrics', payload, ENTITY_VERSION_V5, 'NODE'],
queryKey: ['metrics', payload, 'NODE'],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
GetMetricQueryRange(payload),
enabled: !!payload,
})),
);

View File

@@ -4,7 +4,6 @@ import { Card, Skeleton } from 'antd';
import { Typography } from '@signozhq/ui/typography';
import cx from 'classnames';
import Uplot from 'components/Uplot';
import { ENTITY_VERSION_V5 } from 'constants/app';
import dayjs from 'dayjs';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { useResizeObserver } from 'hooks/useDimensions';
@@ -57,9 +56,9 @@ function PodMetrics({
);
const queries = useQueries(
queryPayloads.map((payload) => ({
queryKey: ['metrics', payload, ENTITY_VERSION_V5, 'POD'],
queryKey: ['metrics', payload, 'POD'],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
GetMetricQueryRange(payload),
enabled: !!payload,
})),
);

View File

@@ -34,7 +34,10 @@ function LogExplorerQuerySection({
isRawQuery={panelTypes === PANEL_TYPES.LIST}
config={{ initialDataSource: DataSource.LOGS, queryVariant: 'static' }}
panelType={panelTypes}
showOnlyWhereClause={selectedView === ExplorerViews.LIST}
showOnlyWhereClause={
selectedView === ExplorerViews.LIST ||
selectedView === ExplorerViews.PATTERNS
}
/>
);
}

View File

@@ -14,7 +14,6 @@ import { useSelector } from 'react-redux';
import getFromLocalstorage from 'api/browser/localstorage/get';
import setToLocalstorage from 'api/browser/localstorage/set';
import logEvent from 'api/common/logEvent';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { LOCALSTORAGE } from 'constants/localStorage';
import { QueryParams } from 'constants/query';
import {
@@ -152,7 +151,6 @@ function LogsExplorerViewsContainer({
} = useGetExplorerQueryRange(
listChartQuery,
PANEL_TYPES.TIME_SERIES,
ENTITY_VERSION_V5,
{
enabled:
showFrequencyChart &&
@@ -170,7 +168,6 @@ function LogsExplorerViewsContainer({
useGetExplorerQueryRange(
requestData,
selectedPanelType,
ENTITY_VERSION_V5,
{
keepPreviousData: true,
enabled: !isLimit && !!requestData,

View File

@@ -0,0 +1,51 @@
.patternsView {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
gap: var(--spacing-4);
padding: var(--spacing-4) 0;
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 var(--spacing-8);
}
.table {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
}
.patternCell {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: var(--spacing-4);
}
.template {
/* stylelint-disable property-disallowed-list -- Typography's code variant has line height 1, too tight for templates that wrap */
font-family: var(--code-base-400-font-family);
font-size: var(--code-base-400-font-size);
line-height: var(--paragraph-base-400-line-height);
/* stylelint-enable property-disallowed-list */
color: var(--l1-foreground);
white-space: pre-wrap;
word-break: break-word;
}
.share {
display: flex;
flex-direction: column;
gap: var(--spacing-2);
}
.sparkline {
display: flex;
align-items: center;
}

View File

@@ -0,0 +1,102 @@
import { Dispatch, MutableRefObject, SetStateAction, useEffect } from 'react';
import { Typography } from '@signozhq/ui/typography';
import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import TanStackTable from 'components/TanStackTableView';
import EmptyLogsSearch from 'container/EmptyLogsSearch/EmptyLogsSearch';
import { LogsLoading } from 'container/LogsLoading/LogsLoading';
import NoLogs from 'container/NoLogs/NoLogs';
import { ChangeViewFunctionType } from 'hooks/useHandleExplorerTabChange';
import { DataSource } from 'types/common/queryBuilder';
import { useLogsPatterns } from './useLogsPatterns';
import { usePatternColumns } from './usePatternColumns';
import { useShowPatternLogs } from './useShowPatternLogs';
import { getPatternRowKey } from './utils';
import styles from './LogsPatternsView.module.scss';
interface LogsPatternsViewProps {
queryKeyRef: MutableRefObject<unknown>;
handleChangeSelectedView: ChangeViewFunctionType;
setIsLoadingQueries: Dispatch<SetStateAction<boolean>>;
}
function LogsPatternsView({
queryKeyRef,
handleChangeSelectedView,
setIsLoadingQueries,
}: LogsPatternsViewProps): JSX.Element {
const {
rows,
sampleRate,
isFilterApplied,
isLoading,
isFetching,
error,
queryKey,
} = useLogsPatterns();
const showPatternLogs = useShowPatternLogs(handleChangeSelectedView);
const columns = usePatternColumns(showPatternLogs);
useEffect(() => {
queryKeyRef.current = queryKey;
}, [queryKey, queryKeyRef]);
useEffect(() => {
setIsLoadingQueries(isLoading || isFetching);
}, [isLoading, isFetching, setIsLoadingQueries]);
useEffect(() => (): void => setIsLoadingQueries(false), [setIsLoadingQueries]);
if (isLoading || (isFetching && rows.length === 0)) {
return <LogsLoading />;
}
if (error) {
return <ErrorInPlace error={error} data-testid="logs-patterns-error" />;
}
if (rows.length === 0) {
return (
<div className={styles.patternsView} data-testid="logs-patterns-empty">
{isFilterApplied ? (
<EmptyLogsSearch dataSource={DataSource.LOGS} panelType="LIST" />
) : (
<NoLogs dataSource={DataSource.LOGS} />
)}
</div>
);
}
return (
<div className={styles.patternsView} data-testid="logs-patterns-view">
{sampleRate > 1 && (
<div className={styles.header}>
<Typography
variant="paragraph"
size="small"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
testId="logs-patterns-sample-note"
>
Counts are estimated from a 1-in-{sampleRate.toLocaleString('en-US')}{' '}
sample of the matching logs.
</Typography>
</div>
)}
<div className={styles.table}>
<TanStackTable
data={rows}
columns={columns}
getRowKey={getPatternRowKey}
disableVirtualScroll
testId="logs-patterns-table"
/>
</div>
</div>
);
}
export default LogsPatternsView;

View File

@@ -0,0 +1,49 @@
import { Color } from '@signozhq/design-tokens';
import Uplot from 'components/Uplot';
import { PatternRow } from './types';
import styles from './LogsPatternsView.module.scss';
const WIDTH = 120;
const HEIGHT = 24;
const OPTIONS: uPlot.Options = {
width: WIDTH,
height: HEIGHT,
legend: { show: false },
cursor: { show: false },
padding: [2, 0, 2, 0],
scales: {
x: { time: false },
y: { range: (_u, _min, max): uPlot.Range.MinMax => [0, Math.max(max, 1)] },
},
series: [
{},
{
stroke: Color.BG_ROBIN_500,
fill: 'rgba(78, 116, 248, 0.20)',
width: 1.2,
points: { show: false },
},
],
axes: [{ show: false }, { show: false }],
};
interface PatternSparklineProps {
trend: PatternRow['trend'];
testId: string;
}
function PatternSparkline({
trend,
testId,
}: PatternSparklineProps): JSX.Element {
return (
<div className={styles.sparkline} data-testid={testId}>
<Uplot data={trend} options={OPTIONS} />
</div>
);
}
export default PatternSparkline;

View File

@@ -0,0 +1,235 @@
import type {
Querybuildertypesv5PatternsDataDTO,
Querybuildertypesv5QueryRangeRequestDTO,
} from 'api/generated/services/sigNoz.schemas';
import { ENVIRONMENT } from 'constants/env';
import { initialQueriesMap } from 'constants/queryBuilder';
import { ChangeViewFunctionType } from 'hooks/useHandleExplorerTabChange';
import { server } from 'mocks-server/server';
import { ExplorerViews } from 'pages/LogsExplorer/utils';
import { rest } from 'msw';
import {
NO_DELAY_USER_EVENT,
render,
screen,
userEvent,
} from 'tests/test-utils';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
import { QueryBuilderContextType } from 'types/common/queryBuilder';
import LogsPatternsView from '../LogsPatternsView';
const QUERY_RANGE_URL = `${ENVIRONMENT.baseURL}/api/v5/query_range`;
const FILTER = "service.name = 'api'";
const stagedQuery: Query = {
...initialQueriesMap.logs,
id: 'staged-1',
builder: {
...initialQueriesMap.logs.builder,
queryData: [
{
...initialQueriesMap.logs.builder.queryData[0],
filter: { expression: FILTER },
},
],
},
};
const patternsData = (
overrides: Partial<Querybuildertypesv5PatternsDataDTO> = {},
): Querybuildertypesv5PatternsDataDTO => ({
queryName: 'A',
sampleRate: 1,
total: 1500,
patterns: [
{
id: '11',
pattern: 'GET <*> 200',
count: 1234,
percent: 82.27,
trend: [],
},
{ id: '22', pattern: '', count: 266, percent: 17.73, trend: null },
],
...overrides,
});
function mockPatterns(
data: Querybuildertypesv5PatternsDataDTO,
requests: Querybuildertypesv5QueryRangeRequestDTO[] = [],
): void {
server.use(
rest.post(QUERY_RANGE_URL, async (req, res, ctx) => {
requests.push(await req.json());
return res(
ctx.status(200),
ctx.json({
status: 'success',
data: { type: 'pattern', data: { results: [data] } },
}),
);
}),
);
}
const updateQueriesData: QueryBuilderContextType['updateQueriesData'] = (
query,
type,
updateCallback,
) => ({
...query,
builder: { ...query.builder, [type]: query.builder[type].map(updateCallback) },
});
const handleChangeSelectedView =
jest.fn() as jest.MockedFunction<ChangeViewFunctionType>;
const renderView = (): void => {
render(
<LogsPatternsView
queryKeyRef={{ current: null }}
handleChangeSelectedView={handleChangeSelectedView}
setIsLoadingQueries={jest.fn()}
/>,
undefined,
{
queryBuilderOverrides: {
stagedQuery,
updateQueriesData,
} as Partial<QueryBuilderContextType>,
},
);
};
describe('LogsPatternsView', () => {
it('requests the patterns of the staged filter', async () => {
const requests: Querybuildertypesv5QueryRangeRequestDTO[] = [];
mockPatterns(patternsData(), requests);
renderView();
await screen.findByTestId('logs-patterns-table');
expect(requests).toHaveLength(1);
const [request] = requests;
expect(request.requestType).toBe('pattern');
expect(request.compositeQuery?.queries).toStrictEqual([
{
type: 'builder_query',
spec: {
name: 'A',
signal: 'logs',
limit: 100,
stepInterval: Math.ceil(
((request.end ?? 0) - (request.start ?? 0)) / 1000 / 60,
),
filter: { expression: FILTER },
},
},
]);
});
it('shows each pattern with its count and share', async () => {
mockPatterns(patternsData());
renderView();
await expect(
screen.findByTestId('pattern-template-11'),
).resolves.toHaveTextContent('GET <*> 200');
expect(screen.getByTestId('pattern-count-11')).toHaveTextContent('1,234');
expect(screen.getByTestId('pattern-share-11')).toHaveTextContent('82.3%');
expect(screen.getByTestId('pattern-trend-11')).toBeInTheDocument();
});
it('labels a pattern without a template as unknown', async () => {
mockPatterns(patternsData());
renderView();
await expect(
screen.findByTestId('pattern-template-22'),
).resolves.toHaveTextContent('Unknown pattern');
});
it('shows the logs of a pattern in the list view, filtered on its template', async () => {
const user = userEvent.setup(NO_DELAY_USER_EVENT);
mockPatterns(patternsData());
renderView();
await user.click(await screen.findByTestId('pattern-show-logs-11'));
expect(handleChangeSelectedView).toHaveBeenCalledTimes(1);
const [view, queryData] = handleChangeSelectedView.mock.calls[0];
expect(view).toBe(ExplorerViews.LIST);
expect(queryData?.query.builder.queryData[0].filter).toStrictEqual({
expression: "service.name = 'api' AND pattern('GET <*> 200')",
});
});
it('offers no logs for a pattern without a template', async () => {
mockPatterns(patternsData());
renderView();
await screen.findByTestId('pattern-template-22');
expect(screen.queryByTestId('pattern-show-logs-22')).not.toBeInTheDocument();
});
it('notes that counts are estimated when the logs were sampled', async () => {
mockPatterns(patternsData({ sampleRate: 1200 }));
renderView();
await expect(
screen.findByTestId('logs-patterns-sample-note'),
).resolves.toHaveTextContent(
'Counts are estimated from a 1-in-1,200 sample of the matching logs.',
);
});
it('has no sample note when every log was read', async () => {
mockPatterns(patternsData());
renderView();
await screen.findByTestId('logs-patterns-table');
expect(
screen.queryByTestId('logs-patterns-sample-note'),
).not.toBeInTheDocument();
});
it('shows the empty search state when no pattern matches the filter', async () => {
mockPatterns(patternsData({ patterns: [], total: 0 }));
renderView();
await expect(
screen.findByTestId('logs-patterns-empty'),
).resolves.toHaveTextContent('This query had no results.');
});
it('shows the error from the server', async () => {
server.use(
rest.post(QUERY_RANGE_URL, (_req, res, ctx) =>
res(
ctx.status(400),
ctx.json({
status: 'error',
error: {
code: 'invalid_input',
message: 'pattern requests take one logs builder query',
},
}),
),
),
);
renderView();
await expect(
screen.findByTestId('logs-patterns-error'),
).resolves.toHaveTextContent('pattern requests take one logs builder query');
});
});

View File

@@ -0,0 +1,72 @@
import {
addPatternToExpression,
formatPatternShare,
getPatternsTimeRange,
getTrendSeries,
} from '../utils';
const MS_TO_NS = 1_000_000;
describe('getPatternsTimeRange', () => {
it('picks the smallest step that keeps the trend within 60 steps', () => {
expect(getPatternsTimeRange(0, 3_600_000 * MS_TO_NS)).toStrictEqual({
startMs: 0,
endMs: 3_600_000,
stepSeconds: 60,
});
expect(getPatternsTimeRange(0, 3_601_000 * MS_TO_NS).stepSeconds).toBe(61);
});
});
describe('getTrendSeries', () => {
it('fills the steps the server left out with zero', () => {
const range = { startMs: 1000, endMs: 1000 + 4 * 60_000, stepSeconds: 60 };
expect(
getTrendSeries(
[
{ timestamp: 1000 + 60_000, count: 5 },
{ timestamp: 1000 + 3 * 60_000, count: 2 },
],
range,
),
).toStrictEqual([
[1000, 61_000, 121_000, 181_000],
[0, 5, 0, 2],
]);
});
it('returns a flat line for a pattern without a trend', () => {
const range = { startMs: 0, endMs: 120_000, stepSeconds: 60 };
expect(getTrendSeries(null, range)).toStrictEqual([
[0, 60_000],
[0, 0],
]);
});
});
describe('formatPatternShare', () => {
it('keeps a tiny share from reading as zero', () => {
expect(formatPatternShare(0.02)).toBe('<0.1%');
expect(formatPatternShare(12.345)).toBe('12.3%');
});
});
describe('addPatternToExpression', () => {
it('sets the pattern filter when there is no expression', () => {
expect(addPatternToExpression(' ', 'auth <*>')).toBe("pattern('auth <*>')");
});
it('escapes backslashes and single quotes in the template', () => {
expect(addPatternToExpression('', "it's C:\\tmp")).toBe(
"pattern('it\\'s C:\\\\tmp')",
);
});
it('keeps an OR expression grouped under the added AND', () => {
expect(addPatternToExpression("a = '1' OR b = '2'", 'x')).toBe(
"(a = '1' OR b = '2') AND pattern('x')",
);
});
});

View File

@@ -0,0 +1,13 @@
export interface PatternRow {
id: string;
pattern: string;
count: number;
percent: number;
trend: [number[], number[]];
}
export interface PatternsTimeRange {
startMs: number;
endMs: number;
stepSeconds: number;
}

View File

@@ -0,0 +1,93 @@
import { useMemo } from 'react';
import { useQuery } from 'react-query';
// eslint-disable-next-line no-restricted-imports
import { useSelector } from 'react-redux';
import { queryRangeV5 } from 'api/generated/services/querier';
import {
QueryRangeV5200,
RenderErrorResponseDTO,
} from 'api/generated/services/sigNoz.schemas';
import { ErrorType } from 'api/generatedAPIInstance';
import { getFilter } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { getListQuery } from 'container/LogsExplorerViews/explorerUtils';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { AppState } from 'store/reducers';
import APIError from 'types/api/error';
import { GlobalReducer } from 'types/reducer/globalTime';
import { toAPIError } from 'utils/errorUtils';
import { PatternRow } from './types';
import {
buildPatternsRequest,
getPatternsData,
getPatternsTimeRange,
toPatternRows,
} from './utils';
interface UseLogsPatterns {
rows: PatternRow[];
sampleRate: number;
isFilterApplied: boolean;
isLoading: boolean;
isFetching: boolean;
error: APIError | null;
queryKey: unknown[];
}
export function useLogsPatterns(): UseLogsPatterns {
const { stagedQuery } = useQueryBuilder();
const { minTime, maxTime } = useSelector<AppState, GlobalReducer>(
(state) => state.globalTime,
);
const listQuery = useMemo(() => getListQuery(stagedQuery), [stagedQuery]);
const filterExpression = listQuery ? getFilter(listQuery).expression : '';
const timeRange = useMemo(
() => getPatternsTimeRange(minTime, maxTime),
[minTime, maxTime],
);
const request = useMemo(
() =>
buildPatternsRequest(
listQuery?.queryName || 'A',
filterExpression,
timeRange,
),
[listQuery?.queryName, filterExpression, timeRange],
);
// The staged query id changes on every Run Query, so an unchanged filter refetches too.
const queryKey = useMemo(
() => [REACT_QUERY_KEY.GET_LOG_PATTERNS, request, stagedQuery?.id],
[request, stagedQuery?.id],
);
const { data, isLoading, isIdle, isFetching, error } = useQuery<
QueryRangeV5200,
ErrorType<RenderErrorResponseDTO>
>({
queryKey,
queryFn: ({ signal }) => queryRangeV5(request, signal),
enabled: !!listQuery,
});
const patternsData = useMemo(() => getPatternsData(data), [data]);
const rows = useMemo(
() => toPatternRows(patternsData, timeRange),
[patternsData, timeRange],
);
const apiError = useMemo(() => (error ? toAPIError(error) : null), [error]);
return {
rows,
sampleRate: patternsData?.sampleRate ?? 1,
isFilterApplied: filterExpression.trim() !== '',
isLoading: isLoading || isIdle,
isFetching,
error: apiError,
queryKey,
};
}

View File

@@ -0,0 +1,98 @@
import { useMemo } from 'react';
import { Button } from '@signozhq/ui/button';
import { Progress } from '@signozhq/ui/progress';
import { Typography } from '@signozhq/ui/typography';
import TanStackTable from 'components/TanStackTableView';
import type { TableColumnDef } from 'components/TanStackTableView/types';
import PatternSparkline from './PatternSparkline';
import { PatternRow } from './types';
import { formatPatternCount, formatPatternShare } from './utils';
import styles from './LogsPatternsView.module.scss';
export function usePatternColumns(
onShowLogs: (template: string) => void,
): TableColumnDef<PatternRow>[] {
return useMemo(
(): TableColumnDef<PatternRow>[] => [
{
id: 'count',
header: 'Count',
accessorKey: 'count',
width: { fixed: 120 },
cell: ({ row }): JSX.Element => (
<TanStackTable.Text data-testid={`pattern-count-${row.id}`}>
{formatPatternCount(row.count)}
</TanStackTable.Text>
),
},
{
id: 'share',
header: 'Share',
accessorKey: 'percent',
width: { fixed: 140 },
cell: ({ row }): JSX.Element => (
<div className={styles.share}>
<TanStackTable.Text data-testid={`pattern-share-${row.id}`}>
{formatPatternShare(row.percent)}
</TanStackTable.Text>
<Progress
percent={row.percent}
color="primary"
aria-label="Share of logs"
/>
</div>
),
},
{
id: 'trend',
header: 'Trend',
width: { fixed: 150 },
cell: ({ row }): JSX.Element => (
<PatternSparkline trend={row.trend} testId={`pattern-trend-${row.id}`} />
),
},
{
id: 'pattern',
header: 'Pattern',
accessorKey: 'pattern',
width: { min: 320 },
cell: ({ row }): JSX.Element =>
row.pattern ? (
<div className={styles.patternCell}>
<span
className={styles.template}
data-testid={`pattern-template-${row.id}`}
>
{row.pattern}
</span>
<Button
variant="link"
color="primary"
size="sm"
onClick={(): void => onShowLogs(row.pattern)}
testId={`pattern-show-logs-${row.id}`}
aria-label={`Show logs of pattern ${row.pattern}`}
>
Show logs
</Button>
</div>
) : (
<Typography
variant="paragraph"
size="base"
weight="regular"
color="tertiary"
as="span"
textOverflow="wrap"
data-testid={`pattern-template-${row.id}`}
>
Unknown pattern
</Typography>
),
},
],
[onShowLogs],
);
}

View File

@@ -0,0 +1,38 @@
import { useCallback } from 'react';
import { getFilter } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { ChangeViewFunctionType } from 'hooks/useHandleExplorerTabChange';
import { ExplorerViews } from 'pages/LogsExplorer/utils';
import { addPatternToExpression } from './utils';
export function useShowPatternLogs(
handleChangeSelectedView: ChangeViewFunctionType,
): (template: string) => void {
const { stagedQuery, updateQueriesData } = useQueryBuilder();
return useCallback(
(template: string): void => {
if (!stagedQuery || !template) {
return;
}
const query = updateQueriesData(stagedQuery, 'queryData', (item, index) =>
index === 0
? {
...item,
filter: {
expression: addPatternToExpression(
getFilter(item).expression,
template,
),
},
}
: item,
);
handleChangeSelectedView(ExplorerViews.LIST, { query });
},
[stagedQuery, updateQueriesData, handleChangeSelectedView],
);
}

View File

@@ -0,0 +1,128 @@
import {
Querybuildertypesv5PatternDTO,
Querybuildertypesv5PatternsDataDTO,
Querybuildertypesv5QueryBuilderQueryGithubComSigNozSignozPkgTypesQuerybuildertypesQuerybuildertypesv5LogAggregationDTOSignal as LogSignal,
Querybuildertypesv5QueryEnvelopeBuilderDTOType,
Querybuildertypesv5QueryRangeRequestDTO,
Querybuildertypesv5RequestTypeDTO,
QueryRangeV5200,
} from 'api/generated/services/sigNoz.schemas';
import { formatStringLiteralForExpression } from 'components/QueryBuilderV2/utils';
import { NANO_SECOND_MULTIPLIER } from 'store/globalTime';
import { PatternRow, PatternsTimeRange } from './types';
export const PATTERNS_LIMIT = 100;
// The backend caps a pattern's trend at 60 steps.
const MAX_TREND_STEPS = 60;
export function getPatternsTimeRange(
minTimeNs: number,
maxTimeNs: number,
): PatternsTimeRange {
const startMs = Math.floor(minTimeNs / NANO_SECOND_MULTIPLIER);
const endMs = Math.floor(maxTimeNs / NANO_SECOND_MULTIPLIER);
const stepSeconds = Math.max(
1,
Math.ceil((endMs - startMs) / 1000 / MAX_TREND_STEPS),
);
return { startMs, endMs, stepSeconds };
}
export function buildPatternsRequest(
queryName: string,
filterExpression: string,
{ startMs, endMs, stepSeconds }: PatternsTimeRange,
): Querybuildertypesv5QueryRangeRequestDTO {
return {
schemaVersion: 'v1',
start: startMs,
end: endMs,
requestType: Querybuildertypesv5RequestTypeDTO.pattern,
compositeQuery: {
queries: [
{
type: Querybuildertypesv5QueryEnvelopeBuilderDTOType.builder_query,
spec: {
name: queryName,
signal: LogSignal.logs,
limit: PATTERNS_LIMIT,
stepInterval: stepSeconds,
filter: { expression: filterExpression },
},
},
],
},
};
}
export function getPatternsData(
response: QueryRangeV5200 | undefined,
): Querybuildertypesv5PatternsDataDTO | null {
const result = response?.data?.data?.results?.[0];
if (!result || typeof result !== 'object' || !('sampleRate' in result)) {
return null;
}
return result as Querybuildertypesv5PatternsDataDTO;
}
// The backend leaves out steps without logs; fill them with zero on the request's step grid.
export function getTrendSeries(
trend: Querybuildertypesv5PatternDTO['trend'],
{ startMs, endMs, stepSeconds }: PatternsTimeRange,
): [number[], number[]] {
const stepMs = stepSeconds * 1000;
const steps = Math.max(1, Math.ceil((endMs - startMs) / stepMs));
const xs = Array.from({ length: steps }, (_, i) => startMs + i * stepMs);
const ys = new Array<number>(steps).fill(0);
(trend ?? []).forEach(({ timestamp, count }) => {
const index = Math.round((timestamp - startMs) / stepMs);
if (index >= 0 && index < steps) {
ys[index] += count;
}
});
return [xs, ys];
}
export function toPatternRows(
data: Querybuildertypesv5PatternsDataDTO | null,
timeRange: PatternsTimeRange,
): PatternRow[] {
return (data?.patterns ?? []).map((item) => ({
id: item.id,
pattern: item.pattern,
count: item.count,
percent: item.percent,
trend: getTrendSeries(item.trend, timeRange),
}));
}
export function getPatternRowKey(row: PatternRow): string {
return row.id;
}
export function formatPatternCount(count: number): string {
return count.toLocaleString('en-US');
}
export function formatPatternShare(percent: number): string {
if (percent > 0 && percent < 0.1) {
return '<0.1%';
}
return `${percent.toFixed(1)}%`;
}
// Parenthesised when it has an OR, which binds looser than the added AND.
export function addPatternToExpression(
expression: string,
template: string,
): string {
const patternFilter = `pattern(${formatStringLiteralForExpression(template)})`;
const base = expression.trim();
if (!base) {
return patternFilter;
}
const scoped = /\bor\b/i.test(base) ? `(${base})` : base;
return `${scoped} AND ${patternFilter}`;
}

View File

@@ -118,7 +118,7 @@ function Section(section: MetricSection): JSX.Element {
$panelType={PANEL_TYPES.BAR}
className="meter-graph"
>
<GridCard widget={widget} onDragSelect={onDragSelect} version="v5" />
<GridCard widget={widget} onDragSelect={onDragSelect} />
</Card>
))}
</div>

View File

@@ -1,7 +1,6 @@
import { useEffect, useMemo } from 'react';
import { useQueries } from 'react-query';
import { isAxiosError } from 'axios';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { initialQueryMeterWithType, PANEL_TYPES } from 'constants/queryBuilder';
import { MAX_QUERY_RETRIES } from 'constants/reactQuery';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
@@ -72,7 +71,6 @@ export function useTimeSeriesQueries({
queryKey: [
REACT_QUERY_KEY.GET_QUERY_RANGE,
payload,
ENTITY_VERSION_V5,
globalSelectedTime,
maxTime,
minTime,
@@ -93,7 +91,6 @@ export function useTimeSeriesQueries({
dataSource: DataSource.METRICS,
},
},
ENTITY_VERSION_V5,
undefined,
signal,
),

View File

@@ -5,7 +5,6 @@ import { useAppLocation } from 'lib/router/useAppLocation';
import { useAppParams } from 'lib/router/useAppParams';
import Col from 'periscope/components/Col/Col';
import logEvent from 'api/common/logEvent';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import Graph from 'container/WidgetCard/Card';
@@ -201,7 +200,6 @@ function DBCall(): JSX.Element {
);
}}
onDragSelect={onDragSelect}
version={ENTITY_VERSION_V5}
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
/>
</GraphContainer>
@@ -240,7 +238,6 @@ function DBCall(): JSX.Element {
);
}}
onDragSelect={onDragSelect}
version={ENTITY_VERSION_V5}
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
/>
</GraphContainer>

View File

@@ -5,7 +5,6 @@ import { useAppLocation } from 'lib/router/useAppLocation';
import { useAppParams } from 'lib/router/useAppParams';
import Col from 'periscope/components/Col/Col';
import logEvent from 'api/common/logEvent';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import Graph from 'container/WidgetCard/Card';
@@ -273,7 +272,6 @@ function External(): JSX.Element {
);
}}
onDragSelect={onDragSelect}
version={ENTITY_VERSION_V5}
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
/>
</GraphContainer>
@@ -317,7 +315,6 @@ function External(): JSX.Element {
);
}}
onDragSelect={onDragSelect}
version={ENTITY_VERSION_V5}
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
/>
</GraphContainer>
@@ -362,7 +359,6 @@ function External(): JSX.Element {
)
}
onDragSelect={onDragSelect}
version={ENTITY_VERSION_V5}
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
/>
</GraphContainer>
@@ -406,7 +402,6 @@ function External(): JSX.Element {
);
}}
onDragSelect={onDragSelect}
version={ENTITY_VERSION_V5}
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
/>
</GraphContainer>

View File

@@ -8,7 +8,6 @@ import {
apDexToolTipUrl,
apDexToolTipUrlText,
} from 'constants/apDex';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { PANEL_TYPES } from 'constants/queryBuilder';
import Graph from 'container/WidgetCard/Card';
import DisplayThreshold from 'container/WidgetCard/Header/DisplayThreshold';
@@ -98,7 +97,6 @@ function ApDexMetrics({
onClickHandler={handleGraphClick('ApDex')}
threshold={threshold}
isQueryEnabled={isQueryEnabled}
version={ENTITY_VERSION_V5}
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
/>
);

View File

@@ -1,6 +1,5 @@
import { useMemo } from 'react';
import { useAppParams } from 'lib/router/useAppParams';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { FeatureKeys } from 'constants/features';
import { PANEL_TYPES } from 'constants/queryBuilder';
import Graph from 'container/WidgetCard/Card';
@@ -119,7 +118,6 @@ function ServiceOverview({
widget={latencyWidget}
onClickHandler={handleGraphClick('Service')}
isQueryEnabled={isQueryEnabled}
version={ENTITY_VERSION_V5}
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
/>
</GraphContainer>

View File

@@ -1,7 +1,6 @@
import { Typography } from '@signozhq/ui/typography';
import axios from 'axios';
import { SOMETHING_WENT_WRONG } from 'constants/api';
import { ENTITY_VERSION_V5 } from 'constants/app';
import Graph from 'container/WidgetCard/Card';
import { SERVICE_DETAIL_DRILLDOWN_ENABLED } from 'container/MetricsApplication/constant';
import { Card, GraphContainer } from 'container/MetricsApplication/styles';
@@ -40,7 +39,6 @@ function TopLevelOperation({
onClickHandler={handleGraphClick(opName)}
onDragSelect={onDragSelect}
isQueryEnabled={!topLevelOperationsIsLoading}
version={ENTITY_VERSION_V5}
enableDrillDown={SERVICE_DETAIL_DRILLDOWN_ENABLED}
/>
</GraphContainer>

View File

@@ -2,7 +2,6 @@ import { ReactNode, useMemo } from 'react';
// eslint-disable-next-line no-restricted-imports
import { useSelector } from 'react-redux';
import { useAppParams } from 'lib/router/useAppParams';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { topOperationMetricsDownloadOptions } from 'container/MetricsApplication/constant';
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
@@ -71,7 +70,6 @@ function TopOperationMetrics(): JSX.Element {
globalSelectedInterval,
variables: {},
},
ENTITY_VERSION_V5,
{
queryKey: [
`GetMetricsQueryRange-${keyOperationWidget?.timePreferance}-${globalSelectedInterval}-${keyOperationWidget?.id}`,

View File

@@ -16,7 +16,6 @@ import classNames from 'classnames';
import QueryCancelledPlaceholder from 'components/QueryCancelledPlaceholder';
import YAxisUnitSelector from 'components/YAxisUnitSelector';
import { YAxisSource } from 'components/YAxisUnitSelector/types';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { MAX_QUERY_RETRIES } from 'constants/reactQuery';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
@@ -102,7 +101,6 @@ function TimeSeries({
queryKey: [
REACT_QUERY_KEY.GET_QUERY_RANGE,
payload,
ENTITY_VERSION_V5,
globalSelectedTime,
maxTime,
minTime,
@@ -123,7 +121,6 @@ function TimeSeries({
dataSource: DataSource.METRICS,
},
},
ENTITY_VERSION_V5,
undefined,
signal,
),

View File

@@ -1,5 +1,4 @@
import { useMemo } from 'react';
import { ENTITY_VERSION_V5 } from 'constants/app';
import {
initialFilters,
initialQueriesMap,
@@ -27,15 +26,12 @@ function LogsCountInInterval({
return q;
}, [filter]);
const result = useGetQueryRange(
{
graphType: PANEL_TYPES.TABLE,
query,
selectedTime: 'GLOBAL_TIME',
globalSelectedInterval: timeInterval,
},
ENTITY_VERSION_V5,
);
const result = useGetQueryRange({
graphType: PANEL_TYPES.TABLE,
query,
selectedTime: 'GLOBAL_TIME',
globalSelectedInterval: timeInterval,
});
const count = useMemo(() => {
const table = result.data?.payload?.data?.result?.[0]?.table;

View File

@@ -1,5 +1,4 @@
import { useMemo } from 'react';
import { ENTITY_VERSION_V5 } from 'constants/app';
import {
initialFilters,
initialQueriesMap,
@@ -43,15 +42,12 @@ const useSampleLogs = ({
return q;
}, [count, filter]);
const response = useGetQueryRange(
{
graphType: PANEL_TYPES.LIST,
query,
selectedTime: 'GLOBAL_TIME',
globalSelectedInterval: timeInterval,
},
ENTITY_VERSION_V5,
);
const response = useGetQueryRange({
graphType: PANEL_TYPES.LIST,
query,
selectedTime: 'GLOBAL_TIME',
globalSelectedInterval: timeInterval,
});
const { isFetching: isLoading, data } = response;

View File

@@ -5,6 +5,7 @@ import {
SquareMousePointer,
Terminal,
Binoculars,
Layers,
} from '@signozhq/icons';
import { Button, Tooltip } from 'antd';
import cx from 'classnames';
@@ -29,7 +30,7 @@ export default function LeftToolbarActions({
showFilter,
handleFilterVisibilityChange,
}: LeftToolbarActionsProps): JSX.Element {
const { clickhouse, list, timeseries, table, trace } = items;
const { clickhouse, list, timeseries, table, trace, patterns } = items;
return (
<div className="left-toolbar">
@@ -134,6 +135,25 @@ export default function LeftToolbarActions({
</Button>
</Tooltip>
)}
{patterns?.show && (
<Tooltip title="Patterns">
<Button
disabled={patterns.disabled}
className={cx(
'patterns-view-tab',
'explorer-view-option',
selectedView === patterns.key ? activeTab : '',
)}
onClick={(): void => onChangeSelectedView(patterns.key)}
data-testid="explorer-view-patterns"
aria-pressed={selectedView === patterns.key}
>
<Layers size={14} />
Patterns
</Button>
</Tooltip>
)}
</div>
</div>
);

View File

@@ -8,7 +8,6 @@ export type OrderByFilterProps = {
query: IBuilderQuery;
onChange: (values: OrderByPayload[]) => void;
isRawQuery?: boolean;
isNewQueryV2?: boolean;
placeholder?: string;
/** A logs or traces heatmap aggregates a field, which Order by then offers. */
panelType?: PANEL_TYPES;

View File

@@ -20,7 +20,6 @@ export function OrderByFilter({
query,
onChange,
isRawQuery = false,
isNewQueryV2 = false,
placeholder,
panelType,
}: OrderByFilterProps): JSX.Element {
@@ -28,7 +27,6 @@ export function OrderByFilter({
const {
debouncedSearchText,
selectedValue,
aggregationOptions,
generateOptions,
createOptions,
handleChange,
@@ -50,11 +48,10 @@ export function OrderByFilter({
},
);
// Get parsed aggregation options using createAggregation only for QueryV2
// Get parsed aggregation options using createAggregation
const parsedAggregationOptions = useMemo(
() =>
isNewQueryV2 ? getParsedAggregationOptionsForOrderBy(query, panelType) : [],
[query, isNewQueryV2, panelType],
() => getParsedAggregationOptionsForOrderBy(query, panelType),
[query, panelType],
);
const optionsData = useMemo(() => {
@@ -67,10 +64,7 @@ export function OrderByFilter({
const options =
query.aggregateOperator === MetricAggregateOperator.NOOP
? keyOptions
: [
...groupByOptions,
...(isNewQueryV2 ? aggregationOptionsFromParsed : aggregationOptions),
];
: [...groupByOptions, ...aggregationOptionsFromParsed];
return generateOptions(options);
}, [
@@ -79,9 +73,7 @@ export function OrderByFilter({
query.groupBy,
query.aggregateOperator,
parsedAggregationOptions,
aggregationOptions,
generateOptions,
isNewQueryV2,
]);
const isDisabledSelect =

View File

@@ -39,7 +39,6 @@ function setup(query: Partial<IBuilderQuery>): { onChange: jest.Mock } {
}
onChange={onChange}
isRawQuery
isNewQueryV2
/>,
);
return { onChange };

View File

@@ -22,7 +22,6 @@ export type UseOrderByFilterResult = {
searchText: string;
debouncedSearchText: string;
selectedValue: IOption[];
aggregationOptions: IOption[];
generateOptions: (options: IOption[]) => IOption[];
createOptions: (keys: string[]) => IOption[];
handleChange: (values: IOption[]) => void;
@@ -123,29 +122,10 @@ export const useOrderByFilter = ({
[],
);
const aggregationOptions = useMemo(
() => [
{
label: `${query.aggregateOperator}(${query.aggregateAttribute?.key}) ${
ORDERBY_FILTERS.ASC
}`,
value: `${SIGNOZ_VALUE}${orderByValueDelimiter}${ORDERBY_FILTERS.ASC}`,
},
{
label: `${query.aggregateOperator}(${query.aggregateAttribute?.key}) ${
ORDERBY_FILTERS.DESC
}`,
value: `${SIGNOZ_VALUE}${orderByValueDelimiter}${ORDERBY_FILTERS.DESC}`,
},
],
[query],
);
return {
searchText,
debouncedSearchText,
selectedValue,
aggregationOptions,
createOptions,
handleChange,
handleSearchKeys,

View File

@@ -36,7 +36,3 @@
border: 1px solid var(--danger-background);
border-radius: 4px;
}
.jsonEditorErrorMessage {
word-break: break-word;
}

View File

@@ -39,45 +39,6 @@
padding-bottom: var(--spacing-8);
}
.permissionEditorCollapsedSection {
display: flex;
flex-direction: column;
}
.permissionEditorCollapsedHeader {
display: flex;
align-items: center;
gap: var(--spacing-4);
width: 100%;
padding: var(--spacing-4) var(--spacing-6);
background: var(--l3-background);
border: 1px dashed var(--l2-border);
border-radius: 4px;
cursor: pointer;
transition: background 0.15s ease;
&:hover {
background: var(--l2-background);
}
&:focus {
outline: 2px solid var(--primary);
outline-offset: -2px;
}
}
.permissionEditorCollapsedLabel {
color: var(--l2-foreground);
flex: 1;
white-space: nowrap;
overflow: hidden;
}
.permissionEditorCollapsedCount {
color: var(--primary);
flex-shrink: 0;
}
.permissionEditorCollapseAction {
display: flex;
justify-content: flex-start;

View File

@@ -139,19 +139,6 @@
:global(.ant-pagination-total-text) {
margin-right: auto;
.numbers {
font-family: Inter;
font-size: 12px;
color: var(--foreground);
}
.total {
font-family: Inter;
font-size: 12px;
color: var(--foreground);
opacity: 0.5;
}
}
}

View File

@@ -47,141 +47,3 @@
flex: 1;
min-width: 0;
}
.rolesDescriptionTooltip {
max-height: none;
overflow-y: visible;
}
.rolesListingTable {
margin-top: 12px;
border-radius: 4px;
overflow: hidden;
}
.rolesTableScrollContainer {
overflow-x: auto;
}
.rolesTableInner {
min-width: 850px;
}
.rolesTableHeader {
display: flex;
align-items: center;
padding: 8px 16px;
gap: 24px;
}
.rolesTableHeaderCell {
color: var(--foreground);
}
.rolesTableHeaderCellName {
flex: 0 0 180px;
}
.rolesTableHeaderCellDescription {
flex: 1;
min-width: 0;
}
.rolesTableHeaderCellCreatedAt {
flex: 0 0 180px;
}
.rolesTableHeaderCellUpdatedAt {
flex: 0 0 180px;
}
.rolesTableSectionHeader {
display: flex;
align-items: center;
gap: 8px;
height: 32px;
padding: 0 16px;
background: color-mix(in srgb, var(--bg-robin-200) 4%, transparent);
border-top: 1px solid var(--secondary);
border-bottom: 1px solid var(--secondary);
color: var(--foreground);
margin: 0;
}
.rolesTableSectionHeaderCount {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 20px;
height: 18px;
padding: 0 6px;
border-radius: 9px;
background: var(--l3-background);
color: var(--foreground);
}
.rolesTableRow {
display: flex;
align-items: center;
padding: 8px 16px;
background: color-mix(in srgb, var(--bg-robin-200) 2%, transparent);
border-bottom: 1px solid var(--secondary);
gap: 24px;
}
.rolesTableRowClickable {
cursor: pointer;
&:hover {
background: color-mix(in srgb, var(--bg-robin-200) 5%, transparent);
}
}
.rolesTableCell {
color: var(--foreground);
}
.rolesTableCellName {
flex: 0 0 180px;
}
.rolesTableCellDescription {
flex: 1;
min-width: 0;
overflow: hidden;
}
.rolesTableCellCreatedAt {
flex: 0 0 180px;
white-space: nowrap;
}
.rolesTableCellUpdatedAt {
flex: 0 0 180px;
white-space: nowrap;
}
.rolesTableEmpty {
padding: 24px 16px;
color: var(--foreground);
}
.rolesTablePagination {
display: flex;
align-items: center;
justify-content: flex-end;
padding: 8px 16px;
:global(.ant-pagination-total-text) {
margin-right: auto;
}
:global(.ant-pagination-total-text .numbers) {
color: var(--foreground);
}
:global(.ant-pagination-total-text .total) {
color: var(--foreground);
opacity: 0.5;
}
}

View File

@@ -29,10 +29,6 @@
gap: var(--spacing-6);
}
.unsavedText {
color: var(--primary);
}
.viewRolePageContent {
display: flex;
flex-direction: column;
@@ -68,12 +64,6 @@
color: var(--l2-foreground);
}
.viewRolePageDivider {
width: 100%;
height: 1px;
background: var(--l1-border);
}
// The one grid row stretches the Tabs root to the height left on the page.
.roleTabs {
display: grid;

View File

@@ -15,7 +15,3 @@
flex-direction: column;
gap: var(--spacing-10);
}
.errorText {
padding: var(--spacing-4);
}

View File

@@ -29,13 +29,3 @@ export interface RolePermissionsData {
roleDescription: string;
resources: ResourcePermissions[];
}
export interface SelectableItem {
id: string;
label: string;
}
export interface ResourceItemsResult {
items: SelectableItem[];
isLoading: boolean;
}

View File

@@ -7,7 +7,6 @@ import { SolidAlertTriangle } from '@signozhq/icons';
import Flex from 'periscope/components/Flex/Flex';
import { Typography } from '@signozhq/ui/typography';
import { ResizeTable } from 'components/ResizeTable';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { MAX_RPS_LIMIT } from 'constants/global';
import ResourceAttributesFilter from 'container/ResourceAttributesFilter';
import { useGetQueriesRange } from 'hooks/queryBuilder/useGetQueriesRange';
@@ -40,7 +39,7 @@ function ServiceMetricTable({
const { isFetchingActiveLicense, trialInfo } = useAppContext();
const { isCloudUser: isCloudUserVal } = useGetTenantLicense();
const queries = useGetQueriesRange(queryRangeRequestData, ENTITY_VERSION_V5, {
const queries = useGetQueriesRange(queryRangeRequestData, {
queryKey: [
`GetMetricsQueryRange-${queryRangeRequestData[0]?.selectedTime}-${globalSelectedInterval}`,
maxTime,

View File

@@ -1,6 +1,5 @@
import { useCallback, useMemo } from 'react';
import { QueryKey, useInfiniteQuery } from 'react-query';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { DEFAULT_PER_PAGE_VALUE } from 'container/Controls/config';
import { TracesTableRow } from 'container/TracesExplorer/TracesTable/getFieldColumn';
@@ -64,7 +63,6 @@ export function useListViewInfiniteQuery({
},
},
},
ENTITY_VERSION_V5,
undefined,
signal,
),

View File

@@ -12,7 +12,6 @@ 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';
@@ -71,7 +70,6 @@ function TableView({
dataSource: 'traces',
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled: !!stagedQuery && panelType === PANEL_TYPES.TABLE,

View File

@@ -12,7 +12,6 @@ import { useSelector } from 'react-redux';
import { Typography } from '@signozhq/ui/typography';
import logEvent from 'api/common/logEvent';
import DownloadOptionsMenu from 'components/DownloadOptionsMenu/DownloadOptionsMenu';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { LOCALSTORAGE } from 'constants/localStorage';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
@@ -102,7 +101,6 @@ function TracesView({
pagination: pagination.request,
},
},
ENTITY_VERSION_V5,
{
queryKey,
keepPreviousData: true,

View File

@@ -19,7 +19,6 @@ import QueryCancelledPlaceholder from 'components/QueryCancelledPlaceholder';
import Spinner from 'components/Spinner';
import TimePreference from 'components/TimePreferenceDropDown';
import WarningPopover from 'components/WarningPopover/WarningPopover';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { PanelMode } from 'lib/visualization/panels/types';
@@ -55,7 +54,6 @@ import 'container/WidgetCard/Card/FullView/WidgetFullView.styles.scss';
function FullView({
widget,
fullViewOptions = true,
version,
originalName,
tableProcessedDataRef,
isDependedDataLoaded = false,
@@ -170,18 +168,11 @@ function FullView({
}, [selectedPanelType]);
const queryRangeKey = useMemo(
() => [
widget?.query,
selectedPanelType,
requestData,
version,
minTime,
maxTime,
],
[widget?.query, selectedPanelType, requestData, version, minTime, maxTime],
() => [widget?.query, selectedPanelType, requestData, minTime, maxTime],
[widget?.query, selectedPanelType, requestData, minTime, maxTime],
);
const response = useGetQueryRange(requestData, ENTITY_VERSION_V5, {
const response = useGetQueryRange(requestData, {
queryKey: queryRangeKey,
enabled: !isDependedDataLoaded,
keepPreviousData: true,

View File

@@ -24,7 +24,6 @@ export interface FullViewProps {
customOnDragSelect?: (start: number, end: number) => void;
name: string;
tableProcessedDataRef: MutableRefObject<RowData[]>;
version?: string;
originalName: string;
yAxisUnit?: string;
isDependedDataLoaded?: boolean;

View File

@@ -141,7 +141,6 @@ const mockProps: WidgetGraphComponentProps = {
remove: jest.fn(),
},
errorMessage: '',
version: 'v4',
headerMenuList: [
MenuItemKeys.View,
MenuItemKeys.Clone,
@@ -170,7 +169,6 @@ describe('WidgetGraphComponent', () => {
widget={mockProps.widget}
queryResponse={mockProps.queryResponse}
errorMessage={mockProps.errorMessage}
version={mockProps.version}
headerMenuList={mockProps.headerMenuList}
isWarning={mockProps.isWarning}
isFetchingResponse={mockProps.isFetchingResponse}

View File

@@ -1,7 +1,6 @@
import { RefObject, useEffect, useRef, useState } from 'react';
import { useAppLocation } from 'lib/router/useAppLocation';
import { Skeleton, Tooltip } from 'antd';
import { Typography } from '@signozhq/ui/typography';
import cx from 'classnames';
import { useNavigateToExplorer } from 'components/CeleryTask/useNavigateToExplorer';
import { ToggleGraphProps } from 'components/Graph/types';
@@ -38,7 +37,6 @@ import 'container/WidgetCard/WidgetCard.styles.scss';
function WidgetGraphComponent({
widget,
queryResponse,
version,
threshold,
headerMenuList,
isWarning,
@@ -51,7 +49,6 @@ function WidgetGraphComponent({
openTracesButton,
onOpenTraceBtnClick,
customSeries,
customErrorMessage,
customOnRowClick,
customTimeRangeWindowForCoRelation,
enableDrillDown,
@@ -209,7 +206,6 @@ function WidgetGraphComponent({
>
<FullView
name={`${widget.id}expanded`}
version={version}
originalName={widget.id}
widget={widget}
yAxisUnit={widget.yAxisUnit}
@@ -239,21 +235,6 @@ function WidgetGraphComponent({
/>
</div>
{queryResponse.error && customErrorMessage && (
<div className="error-message-container">
<Typography
variant="paragraph"
size="base"
weight="regular"
color="warning"
as="span"
textOverflow="wrap"
>
{customErrorMessage}
</Typography>
</div>
)}
{queryResponse.isLoading && widget.panelTypes !== PANEL_TYPES.LIST && (
<div data-testid="widget-graph-loading">
<Skeleton />

View File

@@ -1,5 +1,4 @@
import { prepareQueryRangePayloadV5 } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
@@ -87,7 +86,6 @@ describe('GridCardGraph', () => {
<GridCardGraph
widget={widgetFiltering('name in []')}
isQueryEnabled={enabledBefore}
version={ENTITY_VERSION_V5}
/>,
);
@@ -95,7 +93,6 @@ describe('GridCardGraph', () => {
<GridCardGraph
widget={widgetFiltering("name in ['GET /']")}
isQueryEnabled
version={ENTITY_VERSION_V5}
/>,
);
@@ -113,10 +110,7 @@ describe('GridCardGraph', () => {
widgetFiltering(expression, DataSource.LOGS, PANEL_TYPES.LIST);
const { rerender } = render(
<GridCardGraph
widget={logsList("severity_text = 'ERROR'")}
version={ENTITY_VERSION_V5}
/>,
<GridCardGraph widget={logsList("severity_text = 'ERROR'")} />,
);
await user.click(
@@ -127,12 +121,7 @@ describe('GridCardGraph', () => {
await user.click(await screen.findByText('50 / page'));
await waitFor(() => expect(lastRequestedLimit()).toBe(50));
rerender(
<GridCardGraph
widget={logsList("severity_text = 'WARN'")}
version={ENTITY_VERSION_V5}
/>,
);
rerender(<GridCardGraph widget={logsList("severity_text = 'WARN'")} />);
await waitFor(() =>
expect(requestedFilters()).toContain("severity_text = 'WARN'"),

View File

@@ -2,7 +2,6 @@ import { memo, useEffect, useMemo, useRef, useState } from 'react';
// eslint-disable-next-line no-restricted-imports
import { useDispatch, useSelector } from 'react-redux';
import logEvent from 'api/common/logEvent';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { useScrollWidgetIntoView } from 'lib/visualization/hooks/useScrollWidgetIntoView';
@@ -15,7 +14,6 @@ import getTimeString from 'lib/getTimeString';
import isEmpty from 'lodash-es/isEmpty';
import { UpdateTimeInterval } from 'store/actions';
import { AppState } from 'store/reducers';
import APIError from 'types/api/error';
import { DataSource } from 'types/common/queryBuilder';
import { GlobalReducer } from 'types/reducer/globalTime';
import { getGraphType } from 'utils/getGraphType';
@@ -41,7 +39,6 @@ function GridCardGraph({
headerMenuList = [MenuItemKeys.View],
isQueryEnabled,
threshold,
version,
onClickHandler,
onDragSelect,
customOnDragSelect,
@@ -62,8 +59,6 @@ function GridCardGraph({
}: GridCardGraphProps): JSX.Element {
const dispatch = useDispatch();
const [errorMessage, setErrorMessage] = useState<string>();
const [isInternalServerError, setIsInternalServerError] =
useState<boolean>(false);
const {
minTime,
maxTime,
@@ -171,7 +166,6 @@ function GridCardGraph({
end: customTimeRange?.endTime || end,
originalGraphType: widget?.panelTypes,
},
version || ENTITY_VERSION_V5,
{
queryKey: [
REACT_QUERY_KEY.DASHBOARD_GRID_CARD_QUERY_RANGE,
@@ -188,16 +182,7 @@ function GridCardGraph({
? [customTimeRange.startTime, customTimeRange.endTime]
: []),
],
retry(failureCount, error): boolean {
if (
String(error).includes('status: error') &&
String(error).includes('i/o timeout')
) {
return false;
}
return failureCount < 2;
},
retry: 2,
keepPreviousData: true,
cacheTime: isAutoRefreshDisabled
? DASHBOARD_CACHE_TIME
@@ -205,21 +190,11 @@ function GridCardGraph({
enabled: queryEnabledCondition,
refetchOnMount: false,
onError: (error) => {
const errorMessage =
version === ENTITY_VERSION_V5
? errorDetails(error as APIError)
: error.message;
setErrorMessage(errorMessage);
if (customErrorMessage) {
setIsInternalServerError(
String(error.message).includes('API responded with 500'),
);
if (analyticsEvent) {
void logEvent(analyticsEvent, {
error: error.message,
});
}
setErrorMessage(errorDetails(error));
if (customErrorMessage && analyticsEvent) {
void logEvent(analyticsEvent, {
error: error.message,
});
}
},
onSettled: (data) => {
@@ -262,7 +237,6 @@ function GridCardGraph({
queryResponse={queryResponse}
errorMessage={errorMessage}
isWarning={!isEmpty(queryResponse.data?.warning)}
version={version}
threshold={threshold}
headerMenuList={menuList}
isFetchingResponse={queryResponse.isFetching}
@@ -274,7 +248,6 @@ function GridCardGraph({
openTracesButton={openTracesButton}
onOpenTraceBtnClick={onOpenTraceBtnClick}
customSeries={customSeries}
customErrorMessage={isInternalServerError ? customErrorMessage : undefined}
customOnRowClick={customOnRowClick}
customTimeRangeWindowForCoRelation={customTimeRangeWindowForCoRelation}
enableDrillDown={enableDrillDown}
@@ -290,7 +263,6 @@ GridCardGraph.defaultProps = {
isQueryEnabled: true,
threshold: undefined,
headerMenuList: [MenuItemKeys.View],
version: ENTITY_VERSION_V5,
analyticsEvent: undefined,
customTimeRangeWindowForCoRelation: undefined,
enableDrillDown: false,

View File

@@ -23,7 +23,6 @@ export interface WidgetGraphComponentProps {
widget: Widgets;
queryResponse: UseQueryResult<MetricQueryRangeSuccessResponse, Error>;
errorMessage: string | undefined;
version?: string;
threshold?: ReactNode;
headerMenuList: MenuItemKeys[];
isWarning: boolean;
@@ -36,7 +35,6 @@ export interface WidgetGraphComponentProps {
openTracesButton?: boolean;
onOpenTraceBtnClick?: (record: RowData) => void;
customSeries?: (data: QueryData[]) => uPlot.Series[];
customErrorMessage?: string;
customOnRowClick?: (record: RowData) => void;
customTimeRangeWindowForCoRelation?: string | undefined;
enableDrillDown?: boolean;
@@ -50,7 +48,6 @@ export interface GridCardGraphProps {
headerMenuList?: WidgetGraphComponentProps['headerMenuList'];
onClickHandler?: OnClickPluginOpts['onClick'];
isQueryEnabled: boolean;
version?: string;
onDragSelect: (start: number, end: number) => void;
customOnDragSelect?: (start: number, end: number) => void;
customTooltipElement?: HTMLDivElement;

View File

@@ -15,7 +15,7 @@ function ValuePanelWrapper({
?.rows?.[0]?.data || {},
);
// this is for handling both query_range v3 and v5 responses
// a value panel gets a scalar response, which has no series, only a table row
const gridValueData = data?.[0].length > 0 ? data : [[0], dataNew];
return (

View File

@@ -24,16 +24,6 @@
}
}
.error-message-container {
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
padding-top: 0;
padding-bottom: 32px;
}
.row-settings {
.ant-popover-inner {
width: 191px;

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