Compare commits

...

24 Commits

Author SHA1 Message Date
ashu8912
bef1303ace fix(authz): address open review comments on the rule FGA stack (#13813)
Some checks are pending
build-staging / prepare (push) Waiting to run
build-staging / js-build (push) Blocked by required conditions
build-staging / go-build (push) Blocked by required conditions
build-staging / staging (push) Blocked by required conditions
Release Drafter / update_release_draft (push) Waiting to run
cacheci / tests (push) Waiting to run
#### Description

Fixes from the open review threads on #13513, #13516, #13728 and #13756.

- Channel pickers keep virtual scroll: `popupMatchSelectWidth={false}`
turned it off. The empty state already wraps at the select's width.
- `LinkAccess` is an `allowed` / `pending` / `denied` union;
`AuthZSelectOption` extends it.
- `useLinkPickerAccess` merges the check results once, not per option.
- `usePlannedDowntimeFormPermissions` returns the rule options, lock
reason and `rule:list` denial.
- `useChannelPickerAccess` maps names to ids with `getChannelIds`.
- The rule views rail shows loading while its query is held, so
`useAlertRuleViews` no longer waits on `enabled`.
- Nits: `updatePermission`, `selectedChannelNames`, `useCallback` for
the create link, one Save click in the routing policy test, no cast in
the threshold test.

#### Issues closed by this PR

Closes https://github.com/SigNoz/pulse-pod/issues/799

#### Additional Information

- No change for `EDIT_ALERTS`: `/alerts/edit` is in
`oldNewRoutesMapping` and redirects to `/alerts/overview` before the
role check, and `ALERT_OVERVIEW` is already in
`routeWithInitialAuthZSupport`.
- Existing stories already render both pickers and the views rail; no
story change.
2026-12-03 12:34:04 +00:00
Manika Malhotra
51828488b8 chore(frontend): remove dead code and styles from logs, traces and messaging queues (#13799)
#### Description

- Removes dead code and styles owned by @SigNoz/events-frontend: logs,
traces, API monitoring, messaging queues and pipelines. 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.
- 67 files, +2 / −2,313; 10 files deleted.
- Components only their own test used: the pipeline `Tags` cell and
`SpanLineActionButtons`.
- The v3 autocomplete mocks in the logs, live logs, traces and API
monitoring stories; nothing calls those endpoints.
- The `[data-radix-popper-content-wrapper]` check in `LogDetailBody`; no
Radix popover can render any more.
- Jest mocks of modules those tests never load, exported code nothing
imports, and CSS rules for classes nothing renders.
- Each commit is one kind of change. The last ones keep `export` on code
that stays and apply review fixes.

#### 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 | 839 test files, 7,257
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 |

**Kept on purpose**

- `KEY_ATTRIBUTE_KEYS`, for the key attributes section
`SpanDetailsPanel` has parked.
- `MQDetailPage/index.tsx` and `traceAttributeValuesResponse`, until
#13797 removes their last users. A follow-up removes them.
2026-12-03 12:26:25 +00:00
Pandey
0346b0c04c chore(codeowners): hand H4ad's paths to frontend-maintainers (#13853)
#### Description

- Replace `@H4ad` with `@SigNoz/frontend-maintainers` as owner of the
frontend authz, members, service accounts and Storybook paths.
2026-12-03 12:19:44 +00:00
Abhi kumar
86d9862462 fix(dashboard): drilldown and variable seeding fixes found while embedding (#13764)
#### Description

- A panel whose builder queries are all disabled draws only formulas, so
it offers no drilldown.
- Drilldown offers "Create variable" only when the viewer can edit the
dashboard.
- A custom variable keeps link-seeded values its list doesn't offer, as
typed values, and an auto-fill computed before the seed landed no longer
overwrites it a frame later.

#### Additional Information

Split out of #13568, which now stacks on this.
2026-12-03 05:23:11 +00:00
Gaurav Tewari
c2c0f0a766 fix(query-builder): catch a failed key suggestions request (#13846)
#### Description

- The query search loads key suggestions 300 ms after it mounts, with no
`catch`, so a failed keys request became an unhandled rejection. The
value suggestions already catch theirs.
- A failed key lookup now goes to Sentry and leaves the current
suggestions in place.
- This made `Pages/AI Observability/Explorer › QuickFiltersSettings`
flaky in Storybook CI. The `Failed` story answers every request with a
500. On a fast runner the rejection lands while `Failed` is still
showing, and it has no play to fail. On a slow one it lands during the
next story's play. Same failure on #13824, a backend-only PR: [storybook
(1)](https://github.com/SigNoz/signoz/actions/runs/46659077018/job/142683375286?pr=13824).

#### Issues closed by this PR

Closes SigNoz/nerve-pod#709

#### Screenshots / Screen Recordings

#### Additional Information

Co-authored-by: Gaurav Tewari <tewarig@users.noreply.github.com>
2026-12-03 05:15:56 +00:00
Nityananda Gohain
455e667378 feat(trace-details): implement the span list routes (#13667)
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
- Implements the four list routes: `/spans`, `/spans/{spanID}/children`,
`/descendants` and `/ancestors`.
- They share one path: the route decides which spans are listed, `view`
keeps the ones of its kind in its own order, then `offset` and `limit`
cut the page. It is the picker highlights use, so a highlights list
equals the first page of the same view.
- Two queries, the trace bounds and the tree. `selectFields` adds a read
by ID of the page's spans, at most 1,000; a name without a context is
looked up in both attributes and resource attributes, and a field no
returned span has is reported in `warnings`.
- `ai_usage` ranks by cost, or by tokens when none of the listed spans
has a cost.
  - `query` returns "not implemented" until the next PR.

  #### Additional Information

- Measured locally: 20 ms on a small trace, 45 ms on 30,000 spans, 0.43
s on 1 million spans.
- Measured locally: 20 ms on a small trace, 45 ms on 30,000 spans, 0.43
s on 1 million spans.
  Refs SigNoz/nerve-pod#651
2026-12-03 05:10:08 +00:00
Nityananda Gohain
e1346d7e9c feat(trace-details): open a span in the trace inspect endpoint (#13664)
#### Description

- Implements `GET /api/v1/traces/{traceID}/spans/{spanID}`. The four
list routes still return "not implemented".
- The response is the span itself: the stored fields, every attribute,
every resource attribute and every event. Values are returned whole.
- It makes two queries: the trace bounds, and the span's full row
through the existing `GetTraceSpansByIDs`. It does not load the trace's
tree, so its cost does not grow with the size of the trace.
- It returns no `treeStats` and no other span. A caller gets the tree
stats with the span in any span list, and the spans around it from the
children, descendants and ancestors routes.
- A span ID that is not in the trace returns 404 with code
`trace_span_not_found`. A span whose parent was never received keeps the
parent ID it was sent with.

  #### Additional Information

- There is no unit test for this route.
`tests/integration/tests/tracedetail/06_span.py` covers it: every field
of a span in both attribute layouts, a long value returned whole, a span
with no attributes or events, a root, a span with a missing parent, and
both 404s.

  Refs SigNoz/nerve-pod#651
2026-12-03 04:27:25 +00:00
Nityananda Gohain
fe0f68589a feat(trace-details): implement the trace highlights route (#13657)
- Implements `GET /api/v1/traces/{traceID}/highlights`.
- One query reads a small row for every span into an in-memory tree
(`TraceSkeleton`). The lists, the per-service totals and `treeStats` all
come from it; there is no second read.
- A new tree and not the waterfall's: on 1 million spans it holds about
125 MB against 1,073 MB.
- A span's references are read only when they hold more than the one to
its parent; the rest are rebuilt from the two ids.
  - gen_ai usage is read from the JSON attributes column only.
- `links` is about 97 bytes on every span and almost always holds only
the reference to the parent. The query compares it with that expected
text and sends it only when it differs (a span link, or a root); the
rest are rebuilt from the trace id and the parent id.

  #### Additional Information

- Measured locally: 25 ms on a small trace, 45 ms on 30,000 spans, 0.5 s
on 1 million spans. The tree is not cached.

  Refs SigNoz/nerve-pod#651
2026-12-03 03:56:54 +00:00
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
Ashwin Bhatkal
f8a5e11dfb fix(sentry): ignore Safari's stale chunk MIME type error (#13843)
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

- Sentry now ignores Safari's `'text/html' is not a valid JavaScript
MIME type` error, like the other stale-chunk errors.
- A tab that outlived a deploy asks for an old hashed chunk (here
`AIAssistantModal`), the server answers with `index.html`, and Safari
rejects it with this message. `lazyRetry` already recovers by reloading
once, so the event is noise.
- Chromium and Firefox already report this case with wordings the list
ignores. So does Safari's network-failure wording.
- PagerDuty: https://signoz-1.pagerduty.com/incidents/Q095A4QSMLC0T8
- Sentry: https://signoz-io.sentry.io/issues/7878025086/ (v0.152.0,
Mobile Safari on iOS, dashboard page)

#### Issues closed by this PR

Closes https://github.com/SigNoz/pulse-pod/issues/804
2026-12-02 11:18:45 +00:00
ashu8912
1f6b0e6acc test(e2e): fix alerts flakes after rule FGA (#13823)
#### Description

Fixes two alerts e2e flakes introduced by the rule FGA merges.

- `alerts/views` TC-03 (failing most merge-queue runs): since #13756 a
view link applies its filter after the permission check, later than the
first rows. The spec now waits for the view's query before editing it.
- `alerts/planned-downtime` TC-01: since #13516 picker options are
disabled while their `attach` check runs, and Playwright clicks the
role-less option div anyway. `pickRule` and `antd.pickByName` now click
only enabled options.

Evidence for both is in `docs/flake-notes.md`.
2026-12-02 10:22:08 +00:00
Gaurav Tewari
52c2961368 fix(noz): space in Noz messages (#13816)
#### Description

- Every message sits 32px from the next, above and below a sent message,
per the design; it was 48px in the panel and 44px on the full page. Each
message ends in its 28px hover row, so messages keep 4px under that row
and no top padding.
- Error replies have no hover row, so one without a Retry button pads
the 32px itself; the Retry button sits 4px under its reply so that case
also comes to 32px.
- The space under the last message drops from 64px to 4px, so the thread
ends close to the disclaimer and input. The thread's top padding grows
from 16px to 24px so the first message stays put.
- Context chips under a sent message line up with its hover actions.

#### Issues closed by this PR

Closes SigNoz/nerve-pod#708

#### Screenshots / Screen Recordings

#### Additional Information

- No Storybook story shows an error reply, so that state is not in the
visual diff.

---------

Co-authored-by: Gaurav Tewari <tewarig@users.noreply.github.com>
2026-12-02 08:40:27 +00:00
Tushar Vats
e65bbd281f fix(querier): skip unread disabled queries and reject logs and traces formulas in heatmaps (#13796)
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

- A heatmap or distribution request with a disabled logs/traces query
naming a bare field (e.g. `attribute.quantity`) failed with a generic
500: the disabled query ran as a time series and sent the raw field to
ClickHouse.
- A disabled query that no enabled formula reads is no longer run in
heatmap and distribution requests, since a heatmap draws only its
enabled query.
- Logs and traces heatmaps don't support formulas: a formula reading a
logs or traces query is a 400. Their heatmaps count events per bucket,
which gives a formula no value per step to compute with. Metrics
formulas are unchanged.

#### Issues closed by this PR

Closes SigNoz/events-pod#331

#### Additional Information

- Behaviour change: SigNoz/signoz#13318 let a disabled logs/traces query
with an aggregate like `avg(duration_nano)` feed a heatmap formula. That
is now rejected.
- Not fixed here: a bare field as the aggregation of a time-series
request still fails with a generic 500;
`querierlogs/12_aggregation_timeseries.py::test_time_series_bare_field_aggregation`
pins that.
- Tested: Go unit tests (`TestValidateBucketCountingFormulaInputs`,
`TestFormulaInputNames`, `TestEnabledFormulaInputNames`). Integration
tests in `querierlogs/17_heatmap.py` and `queriertraces/16_heatmap.py`
cover an unread disabled query (bare field and aggregate), the formula
400 (heatmap and distribution), and logs and metrics queries in one
request; all pass locally, along with `12_aggregation_timeseries.py`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-12-01 16:01:10 +00:00
Tushar Vats
19a737ee41 fix(logparsingpipeline): reject empty to for copy and move operators (#13808)
#### Description

- Building collector config from stored log pipelines now rejects an
enabled copy or move operator whose `to` is empty or not a valid field
path, using the same check as `from`.
- Saving a pipeline already rejects an empty `to` in
`PostablePipeline.IsValid`; this also covers stored pipelines and
invalid paths.

#### Issues closed by this PR

Closes SigNoz/events-pod#334

#### Additional Information

- Related: SigNoz/events-pod#330 (collector-side check).
- Tested with `TestGetOperatorsRejectsEmptyTo`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-12-01 15:13:38 +00:00
Nityananda Gohain
c6e9f8d7fa feat(trace-details): add the API contract for the trace overview and span routes (#13653)
#### Description

- Adds the contract for six routes under `/api/v1/traces/{traceID}`. The
handlers return "not implemented" until the next PRs in the stack.
- `/highlights`: per-service totals, and the first page of each view of
the span list.
- `/spans`: a page of the spans of the trace, in tree order from the
top.
    - `/spans/{spanID}`: one span with every attribute and event.
    - `/spans/{spanID}/children`: its direct children, one level below.
    - `/spans/{spanID}/descendants`: every span below it, in tree order.
- `/spans/{spanID}/ancestors`: the path from its parent up to the root,
the parent first.
- `/summary` stays the cheap and gains `ai.modelCallCount` and
`ai.toolCallCount`
- The four list routes share one set of parameters: `view`, `query`,
`selectFields`, `offset` and `limit`. The route decides which spans it
covers, and `view` is a quick filter on them: `error_origins`,
`unmarked_failures`, `time_spent`, `ai_usage` or `links`. Without it
every span the route covers is returned.
- `/highlights` takes `views` to name the lists to return. Without it
all five are returned.
- The keys of a span are the stored field names (`span_id`,
`kind_string`, `has_error`, `timestamp`), so a key read from a response
is a valid key in `query`. Computed keys such as `treeStats` stay
camelCase.
- Every list returns the same `SpanItem`: the span, its `treeStats`, and
why it counts as failed when it is not marked as an error.
`/spans/{spanID}` returns the span alone, so it does not need to load
the trace.
- `Span` is its own struct and not `ThreadSpan`. It has the same stored
fields, but its start time is `timestamp` in nanoseconds where the
thread span has `time_unix` in milliseconds, it adds
`response_status_code`, and it has no formatted input and output. It
reuses `Event` and `OtelSpanRef`.
- The API returns whole values; the MCP server cuts them to its
character budget.
- `/summary` gains `ai.modelCallCount` and `ai.toolCallCount`, which
`/highlights` shows through the embedded summary.

  #### Additional Information
- Three frontend test fixtures gain the two new counts because the
generated type requires them; the UI does not read them.
- `timestamp` is in nanoseconds, the unit a trace filter compares it in.
A browser client cannot hold a nanosecond value exactly; events in the
same responses already carry `timeUnixNano` the same way.
- The entries of `events` and `references` keep their existing keys
(`timeUnixNano`, `spanId`, `refType`). Those types are shared with the
waterfall and thread routes, and they are not filter keys.

  Refs SigNoz/nerve-pod#651
2026-12-01 15:02:25 +00:00
Ashwin Bhatkal
2fe90d84c4 feat(flagger): add use_notification_template flag (#13822)
<!--A few plain bullets saying what changed and why, for a reviewer
skimming it - not a wall of text, not a restatement of the diff, not
generated boilerplate.-->
#### Description

- Adds the `use_notification_template` feature flag, off by default, so
the custom alert notification template UI can be built behind it.
- The features API lists it in both editions, so the frontend reads it
from `featureFlags` as `FeatureKeys.USE_NOTIFICATION_TEMPLATE`.

<!--Reference issues using `Closes #issue-number` to enable automatic
closure on merge. -->
#### Issues closed by this PR

Closes https://github.com/SigNoz/pulse-pod/issues/801
2026-12-01 13:25:04 +00:00
Vinicius Lourenço
659d3fc204 perf(web): load only the Monaco languages SigNoz uses (#13751)
#### Description

SigNoz editors only use JSON, SQL and YAML, but importing
`monaco-editor` pulls in every language Monaco ships along with the CSS,
HTML and TypeScript workers. Monaco now registers just those three
languages, and the build drops the editor features we never give a
provider to, such as code lens, inlay hints and rename.

First load is unchanged, since #13686 already loads Monaco on the first
editor mount.

| | Before | After |
|---|---|---|
| Monaco on the first editor mount (gzip) | 1.10 MB | 860 KB |
| Worker files (gzip) | 2.1 MB | 207 KB |
| Build output (`frontend/build`) | 138.1 MB | 101.0 MB |
| Docker image, unpacked | | 37.3 MB smaller |
| Docker image, pulled (compressed) | 83.2 MB | about 74.4 MB |

Most of the 37 MB is the TypeScript, CSS and HTML workers (33.5 MB, 23
MB of it sourcemaps). The rest is the 77 language tokenizers we never
load (1.5 MB), the stripped editor features (1.5 MB) and the CSS, HTML
and TypeScript language chunks (0.5 MB). The image copies
`frontend/build` as is, sourcemaps included, so it shrinks by the same
amount. The pulled size is the published v0.151.0 amd64 image minus the
gzip difference of the web folder (8.8 MB), not a measured build.

Dropping those features only happens in the production build, because
the Monaco code we keep still imports from their folders. Dev and
Storybook keep them, so code that uses one would work locally and do
nothing in production. A new lint rule,
`signoz/no-monaco-stripped-features`, reports their providers and
options, along with imports of `monaco-editor` outside `src/lib/monaco`
that would bring every language back. The rule and `vite.config.ts` read
the same list.

Follow-up to #13686.

#### Screenshots

Recorded on a production build of this branch.

Importing dashboard JSON: the JSON worker flags a missing value.


https://github.com/user-attachments/assets/4b48088b-c9a6-4aaf-9bc4-822eba980047

Dashboard JSON drawer: find, folding, typing and undo.


https://github.com/user-attachments/assets/9b009e06-2619-4e1d-b31a-737c4e12e0f8

ClickHouse query in the panel editor: SQL highlighting and suggestions.


https://github.com/user-attachments/assets/676d4060-fa4e-45e9-bc55-def7f75e6387

Role editor: schema errors on hover and in the banner, and the allowed
values as suggestions. This one also has #13670 applied, see below.


https://github.com/user-attachments/assets/3f1a3021-2a6a-4967-9a53-2c01f68743bb

#### Additional Information

To check it, open the role editor, the dashboard JSON drawer, a
ClickHouse query and the exceptions YAML view: highlighting, folding,
find and suggestions behave as on main, and only `json.worker` and
`editor.worker` load.

In a production build the role editor's schema validation fails on
`main` as well: the JSON worker throws on every non-empty array. #13670
fixes that, and with it applied the role editor behaves as in dev.
2026-12-01 12:49:57 +00:00
Aditya Singh
30f6175903 refactor(service-details): remove unsafe casts and dead code from the v5 queries (#13780)
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

- #13617 moved the service details page to v5. It merged with review
comments still open, and this PR addresses them.
- The query builders take the v5 aggregation types instead of
`MetricAggregateOperator`, so the unsafe `as` casts are gone. The values
are the same strings, so every payload stays the same.
- It removes dead code: the `stepInterval` prop, the unused widget keys,
and the `delta` argument to the ApDex query. The three ApDex formulas
were the same string, so one `FORMULA.APDEX` replaces them.
- The ApDex bucket lookup moves to `MetricsPageQueries/utils.ts`. It
returns the bucket number instead of a string. It also sorts a copy now,
because it sorted the cached bucket array in place.

#### Issues closed by this PR

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

#### Additional Information

- No screen renders differently, so no story changes.
2026-12-01 11:43:05 +00:00
Manika Malhotra
98dee29f1f chore(frontend): remove dead code from saved views and the bottom strip (#13801)
#### Description

- Removes the unused `.label` and `.titleText` classes from the saved
views CSS modules. 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.

#### 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 | 5 test files, 17 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 |
2026-12-01 11:27:52 +00:00
ashu8912
bcb6e708ab fix(alerts): return to the list when a details page's active tab is clicked (#13769)
#### Description

- On a rule details page, Alert Rules is already the active top tab, so
clicking it did nothing: antd `Tabs.onChange` only fires for a new key.
The same happened with Configuration on the new/edit channel pages.
- The top tabs now use `onTabClick`: on a details page, clicking its own
tab goes back to that list. On a list page, clicking the active tab
still does nothing, so the list keeps its filters.
- No visual change, so no story update.
2026-12-01 07:41:15 +00:00
304 changed files with 7719 additions and 3654 deletions

26
.claude/rules/ai-terms.md Normal file
View File

@@ -0,0 +1,26 @@
---
paths:
- "pkg/types/aiobservabilitytypes/**"
- "pkg/telemetryschema/aitelemetryschema/**"
- "pkg/statementbuilder/aistatementbuilder/**"
- "pkg/types/llmpricingruletypes/**"
- "pkg/modules/llmpricingrule/**"
- "pkg/modules/spanmapper/**"
- "pkg/modules/tracedetail/**"
- "pkg/types/spantypes/**"
- "frontend/src/container/LLMObservability/**"
- "frontend/src/pages/LLMObservability/**"
- "frontend/src/pages/TraceDetailsV3/**"
- "tests/integration/tests/querierai/**"
- "tests/integration/tests/tracedetail/**"
- "tests/e2e/tests/llm-o11y/**"
---
# AI observability glossary
The names for AI observability concepts, so code and instructions use them without redefining them: in field names, descriptions, column aliases, UI text and tests. They match the AI explorer's per-trace fields, `TraceAggregateFields` in `pkg/telemetryschema/aitelemetryschema/const.go`.
- **LLM call**: a span with `gen_ai.request.model`. Its count is `llm_call_count`, or `llmCallCount` in a camelCase response.
- **Tool call**: a span with `gen_ai.tool.name`. Its count is `tool_call_count`, or `toolCallCount`.
- **gen_ai span**: a span with any of `GenAISpanGateKeys`: an LLM call, a tool call or an agent span.
- **Review check.** "model call", `modelCall` or `model_call` in a name, a description or UI text is a finding: it is an LLM call.

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.

36
.github/CODEOWNERS vendored
View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -89,6 +89,15 @@ func (ah *APIHandler) getFeatureFlags(w http.ResponseWriter, r *http.Request) {
Route: "",
})
useNotificationTemplate := ah.Signoz.Flagger.BooleanOrEmpty(ctx, flagger.FeatureUseNotificationTemplate, evalCtx)
featureSet = append(featureSet, &licensetypes.Feature{
Name: valuer.NewString(flagger.FeatureUseNotificationTemplate.String()),
Active: useNotificationTemplate,
Usage: 0,
UsageLimit: -1,
Route: "",
})
ah.Respond(w, featureSet)
}

View File

@@ -298,6 +298,8 @@
// Steers call sites to the src/lib/router facade (allowlisted in overrides below)
"signoz/no-builder-ai-query-access": "error",
// Steers AI slot access to lib/query/builderSlot (allowlisted in overrides below)
"signoz/no-monaco-stripped-features": "error",
// Bans Monaco features the production build strips, and monaco-editor value imports outside src/lib/monaco/setup.ts (allowlisted in overrides below)
"no-restricted-globals": [
"error",
{
@@ -644,6 +646,13 @@
"rules": {
"signoz/no-builder-ai-query-access": "off"
}
},
{
// setup.ts owns the monaco-editor imports that pick the languages and workers
"files": ["src/lib/monaco/setup.ts"],
"rules": {
"signoz/no-monaco-stripped-features": "off"
}
}
]
}

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

@@ -0,0 +1,132 @@
import { ruleTester } from './rule-tester.mjs';
const IMPORT = 'Import Monaco from lib/monaco/setup';
const STRIPPED = 'which the production build strips';
await ruleTester({
rule: 'no-monaco-stripped-features',
valid: [
{
name: 'setup import',
code: "import { monaco } from 'lib/monaco/setup';",
},
{
name: 'type-only import',
code: "import type { editor } from 'monaco-editor';",
},
{
name: 'inline type specifiers only',
code: "import { type editor, type languages } from 'monaco-editor';",
},
{
name: 'type-only re-export',
code: "export type { editor } from 'monaco-editor';",
},
{
name: 'inline type re-export specifiers only',
code: "export { type editor, type languages } from 'monaco-editor';",
},
{
name: 'react wrapper',
code: "import Editor from '@monaco-editor/react';",
},
{
name: 'kept provider',
code: "monaco.languages.registerCompletionItemProvider('json', {});",
},
{
name: 'stripped option turned off',
code:
"const o = { experimentalGpuAcceleration: 'off', minimap: { showMarkSectionHeaders: false } };",
},
],
invalid: [
{
name: 'package entry import',
code: "import * as monaco from 'monaco-editor';",
errors: [{ message: IMPORT, line: 1, column: 25 }],
},
{
name: 'deep import',
code:
"import 'monaco-editor/esm/vs/basic-languages/python/python.contribution.js';",
errors: [{ message: IMPORT }],
},
{
name: 'mixed value and type specifiers',
code: "import { editor, type languages } from 'monaco-editor';",
errors: [{ message: IMPORT }],
},
{
name: 'dynamic import',
code: "const m = await import('monaco-editor');",
errors: [{ message: IMPORT }],
},
{
name: 'require',
code: "const m = require('monaco-editor');",
errors: [{ message: IMPORT }],
},
{
name: 're-export',
code: "export { editor } from 'monaco-editor';",
errors: [{ message: IMPORT }],
},
{
name: 'mixed value and type re-export specifiers',
code: "export { editor, type languages } from 'monaco-editor';",
errors: [{ message: IMPORT }],
},
{
name: 'export all',
code: "export * from 'monaco-editor';",
errors: [{ message: IMPORT }],
},
{
name: 'stripped provider on monaco.languages',
code: "monaco.languages.registerInlayHintsProvider('sql', {});",
errors: [
{
message: 'needs the Monaco `inlayHints` contribution',
line: 1,
column: 1,
},
],
},
{
name: 'stripped provider on a destructured languages',
code: "languages.registerSignatureHelpProvider('sql', {});",
errors: [{ message: '`parameterHints`' }],
},
{
name: 'stripped provider called bare',
code: "registerRenameProvider('json', {});",
errors: [{ message: '`rename`' }],
},
{
name: 'stripped provider through a string key',
code: "monaco.languages['registerRenameProvider']('json', {});",
errors: [{ message: '`rename`' }],
},
{
name: 'semantic tokens provider',
code: "monaco.languages.registerDocumentSemanticTokensProvider('json', {});",
errors: [{ message: '`semanticTokens`' }],
},
{
name: 'stripped option turned on',
code: "const o = { experimentalGpuAcceleration: 'on' };",
errors: [{ message: '`gpu`', line: 1, column: 13 }],
},
{
name: 'stripped option with a variable value',
code: 'const o = { minimap: { showRegionSectionHeaders: enabled } };',
errors: [{ message: STRIPPED }],
},
{
name: 'quoted option key',
code: "const o = { 'showMarkSectionHeaders': true };",
errors: [{ message: '`sectionHeaders`' }],
},
],
});

View File

@@ -0,0 +1,147 @@
/**
* Rule: no-monaco-stripped-features
*
* The production build drops the Monaco contributions listed in
* plugins/rules/shared/monaco-stripped-features.mjs. Dev and Storybook still carry them,
* so a provider or option for one of them works there and silently does nothing
* in production. This rule reports them, plus value imports of `monaco-editor`
* outside src/lib/monaco/setup.ts: the package entry registers every language and
* worker.
*
* src/lib/monaco/setup.ts is allowlisted via overrides in .oxlintrc.json.
*/
import { MONACO_STRIPPED_FEATURES } from './shared/monaco-stripped-features.mjs';
const featureByProvider = new Map();
const featureByOption = new Map();
for (const [feature, { providers = [], options = [] }] of Object.entries(
MONACO_STRIPPED_FEATURES,
)) {
providers.forEach((name) => featureByProvider.set(name, feature));
options.forEach((name) => featureByOption.set(name, feature));
}
function isMonacoSource(value) {
return value === 'monaco-editor' || value.startsWith('monaco-editor/');
}
function isTypeOnlyImport(node) {
return (
node.importKind === 'type' ||
(node.specifiers.length > 0 &&
node.specifiers.every((s) => s.importKind === 'type'))
);
}
function isTypeOnlyExport(node) {
return (
node.exportKind === 'type' ||
(node.specifiers.length > 0 &&
node.specifiers.every((s) => s.exportKind === 'type'))
);
}
function propertyName(node) {
if (node.type === 'Identifier') {
return node.name;
}
if (node.type === 'Literal' && typeof node.value === 'string') {
return node.value;
}
return null;
}
function isDisabledValue(node) {
return (
node.type === 'Literal' && (node.value === false || node.value === 'off')
);
}
export default {
meta: {
type: 'problem',
docs: {
description:
'Disallow Monaco features the production build strips, and value imports of monaco-editor outside src/lib/monaco/setup.ts',
category: 'Monaco',
},
schema: [],
messages: {
provider:
'{{name}} needs the Monaco `{{feature}}` contribution, which the production build strips, so it works in dev and does nothing in production. Remove `{{feature}}` from plugins/rules/shared/monaco-stripped-features.mjs to use it.',
option:
'`{{name}}` needs the Monaco `{{feature}}` contribution, which the production build strips, so it works in dev and does nothing in production. Remove `{{feature}}` from plugins/rules/shared/monaco-stripped-features.mjs to use it.',
import:
'Import Monaco from lib/monaco/setup, not monaco-editor: the package entry registers every language and worker. Type-only imports are fine.',
},
},
create(context) {
const reportSource = (source) => {
if (
source?.type === 'Literal' &&
typeof source.value === 'string' &&
isMonacoSource(source.value)
) {
context.report({ node: source, messageId: 'import' });
}
};
return {
ImportDeclaration(node) {
if (!isTypeOnlyImport(node)) {
reportSource(node.source);
}
},
ImportExpression: (node) => reportSource(node.source),
ExportAllDeclaration(node) {
if (node.exportKind !== 'type') {
reportSource(node.source);
}
},
ExportNamedDeclaration(node) {
if (!isTypeOnlyExport(node)) {
reportSource(node.source);
}
},
CallExpression(node) {
const { callee } = node;
if (callee.type === 'Identifier' && callee.name === 'require') {
reportSource(node.arguments[0]);
return;
}
const name =
callee.type === 'MemberExpression'
? propertyName(callee.property)
: callee.type === 'Identifier'
? callee.name
: null;
if (name !== null && featureByProvider.has(name)) {
context.report({
node: callee,
messageId: 'provider',
data: { name, feature: featureByProvider.get(name) },
});
}
},
Property(node) {
if (node.computed) {
return;
}
const name = propertyName(node.key);
if (
name !== null &&
featureByOption.has(name) &&
!isDisabledValue(node.value)
) {
context.report({
node: node.key,
messageId: 'option',
data: { name, feature: featureByOption.get(name) },
});
}
},
};
},
};

View File

@@ -0,0 +1,29 @@
/**
* Monaco editor contributions the production build drops (vite.config.ts marks
* them side-effect free), with the API that would need them at runtime.
* `signoz/no-monaco-stripped-features` reports those APIs, since the build
* leaves them without an error and without an effect.
*
* To use one, delete its entry here.
*/
export const MONACO_STRIPPED_FEATURES = {
codelens: { providers: ['registerCodeLensProvider'] },
dropOrPasteInto: {},
gpu: { options: ['experimentalGpuAcceleration'] },
inlayHints: { providers: ['registerInlayHintsProvider'] },
inlineCompletions: { providers: ['registerInlineCompletionsProvider'] },
linkedEditing: { providers: ['registerLinkedEditingRangeProvider'] },
parameterHints: { providers: ['registerSignatureHelpProvider'] },
rename: {
providers: ['registerRenameProvider', 'registerNewSymbolNameProvider'],
},
sectionHeaders: {
options: ['showRegionSectionHeaders', 'showMarkSectionHeaders'],
},
semanticTokens: {
providers: [
'registerDocumentSemanticTokensProvider',
'registerDocumentRangeSemanticTokensProvider',
],
},
};

View File

@@ -21,6 +21,7 @@ import noTextCss from './rules/no-text-css.mjs';
import requireDisableReason from './rules/require-disable-reason.mjs';
import noDomNodeAccess from './rules/no-dom-node-access.mjs';
import noBuilderAiQueryAccess from './rules/no-builder-ai-query-access.mjs';
import noMonacoStrippedFeatures from './rules/no-monaco-stripped-features.mjs';
export default {
meta: {
@@ -43,5 +44,6 @@ export default {
'require-disable-reason': requireDisableReason,
'no-dom-node-access': noDomNodeAccess,
'no-builder-ai-query-access': noBuilderAiQueryAccess,
'no-monaco-stripped-features': noMonacoStrippedFeatures,
},
};

View File

@@ -162,6 +162,16 @@ describe('SENTRY_IGNORE_ERRORS', () => {
),
).toBe(true);
});
it('ignores Safari loading a stale chunk served as index.html', () => {
expect(
SENTRY_IGNORE_ERRORS.some((pattern) =>
pattern.test(
"TypeError: 'text/html' is not a valid JavaScript MIME type for module script 'https://example.us.signoz.cloud/assets/AIAssistantModal-cna5ncpr.js'.",
),
),
).toBe(true);
});
});
describe('isExpectedRequestFailure', () => {

View File

@@ -5,11 +5,14 @@ export const SENTRY_IGNORE_ERRORS = [
// A tab that outlived a deploy requests hashed assets the new build no longer
// has. `lazyRetry` recovers by reloading once, so this class is not worth
// reporting. The stylesheet message is Vite's own; the module ones are the
// same failure worded differently by Chromium, Firefox and Safari.
// same failure worded differently by Chromium, Firefox and Safari. Safari
// reports the MIME type one when the server answers the missing asset with
// index.html.
/Unable to preload CSS for/,
/Failed to fetch dynamically imported module/,
/error loading dynamically imported module/,
/Importing a module script failed/,
/is not a valid JavaScript MIME type/,
// Thrown by the bundled posthog-js when its recorder script fails to load, so
// its frames point at our own bundle and the URL check below misses it.
/Called on script loaded before session recording is available/,

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

@@ -14206,7 +14206,19 @@ export interface SpantypesTraceAITokensDTO {
}
export interface SpantypesTraceAISummaryDTO {
/**
* @type integer
* @minimum 0
* @description Spans with gen_ai.request.model.
*/
llmCallCount: number;
tokens: SpantypesTraceAITokensDTO;
/**
* @type integer
* @minimum 0
* @description Spans with gen_ai.tool.name.
*/
toolCallCount: number;
/**
* @type number
*/
@@ -14634,6 +14646,298 @@ export interface SpantypesPostableWaterfallDTO {
uncollapsedSpans?: string[] | null;
}
export interface SpantypesSameNameSiblingStatsDTO {
/**
* @type integer
* @minimum 0
*/
errorSpanCount: number;
/**
* @type integer
* @minimum 0
*/
ownTimeNano: number;
/**
* @type integer
* @minimum 0
* @description This span included.
*/
spanCount: number;
}
/**
* All of them for a span read by ID; the selected ones in a list.
*/
export type SpantypesSpanDTOAttributes = { [key: string]: unknown };
/**
* Always has service.name. All of them for a span read by ID; the selected ones in a list.
*/
export type SpantypesSpanDTOResource = { [key: string]: string };
export interface SpantypesSpanDTO {
/**
* @type object
* @description All of them for a span read by ID; the selected ones in a list.
*/
attributes: SpantypesSpanDTOAttributes;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
db_name?: string;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
db_operation?: string;
/**
* @type integer
* @minimum 0
*/
duration_nano: number;
/**
* @type array
* @description All of them for a span read by ID; none in a list.
*/
events: SpantypesEventDTO[];
/**
* @type string
* @description Method of an outgoing HTTP call. Omitted when empty, and in a list unless selected.
*/
external_http_method?: string;
/**
* @type string
* @description Host of an outgoing HTTP call. Omitted when empty, and in a list unless selected.
*/
external_http_url?: string;
/**
* @type boolean
*/
has_error: boolean;
/**
* @type string
* @description Host or server address. Omitted when empty, and in a list unless selected.
*/
http_host?: string;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
http_method?: string;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
http_url?: string;
/**
* @type string
* @description For example Server, Client or Internal.
*/
kind_string: string;
/**
* @type string
*/
name: string;
/**
* @type string
* @description Empty for a root.
*/
parent_span_id: string;
/**
* @type array
* @description The parent as CHILD_OF, and each span link as FOLLOWS_FROM.
*/
references: SpantypesOtelSpanRefDTO[];
/**
* @type object
* @description Always has service.name. All of them for a span read by ID; the selected ones in a list.
*/
resource: SpantypesSpanDTOResource;
/**
* @type string
* @description HTTP or gRPC status code, for example 404.
*/
response_status_code: string;
/**
* @description Instrumentation scope. Omitted when empty, and in a list unless selected.
*/
scope?: SpantypesScopeDTO;
/**
* @type string
*/
span_id: string;
/**
* @type string
*/
status_code_string: string;
/**
* @type string
* @description Usually the error text.
*/
status_message: string;
/**
* @type integer
* @minimum 0
* @description Start time, in Unix milliseconds.
*/
time_unix: number;
/**
* @type string
*/
trace_id: string;
/**
* @type string
* @description W3C trace state. Omitted when empty, and in a list unless selected.
*/
trace_state?: string;
}
export interface SpantypesSpanTextMatchDTO {
/**
* @type string
* @description name, status_message, attributes.<name>, resource.<name> or events[<index>].
*/
field: string;
/**
* @type string
* @description About 40 characters on each side of the word.
*/
snippet: string;
}
export interface SpantypesSpanTreeStatsDTO {
/**
* @type integer
* @minimum 0
*/
childCount: number;
/**
* @type integer
* @minimum 0
* @description Ancestors marked as errors in an unbroken run up from the parent: how far an error spread.
*/
errorAncestorCount: number;
/**
* @type integer
* @minimum 0
* @description 0 for a root.
*/
level: number;
/**
* @type integer
* @minimum 0
* @description Duration minus the time its children cover.
*/
ownTimeNano: number;
/**
* @description Totals for the spans with this span's name and parent. Omitted when it has none.
*/
sameNameSiblings?: SpantypesSameNameSiblingStatsDTO;
/**
* @type integer
* @minimum 0
* @description Spans below this one, at any depth.
*/
subtreeSpanCount: number;
}
export enum SpantypesUnmarkedFailureKindDTO {
http_4xx = 'http_4xx',
http_5xx = 'http_5xx',
grpc_status = 'grpc_status',
exception_event = 'exception_event',
}
export interface SpantypesSpanItemDTO {
/**
* @type array
* @description Where the query's words were found, up to three places. Omitted when the query has no words.
*/
matches?: SpantypesSpanTextMatchDTO[];
span: SpantypesSpanDTO;
treeStats: SpantypesSpanTreeStatsDTO;
/**
* @description Why the span is an unmarked failure. Omitted for other spans.
*/
unmarkedFailureKind?: SpantypesUnmarkedFailureKindDTO;
}
export interface SpantypesSpanListDTO {
/**
* @type array
*/
items: SpantypesSpanItemDTO[];
/**
* @type integer
* @minimum 0
* @description Matching spans across all pages.
*/
total: number;
/**
* @type array
* @description Why the result may be incomplete, for example an unknown query key or a selected field no returned span has.
*/
warnings?: string[];
}
export enum SpantypesSpanListViewDTO {
error_origins = 'error_origins',
unmarked_failures = 'unmarked_failures',
time_spent = 'time_spent',
ai_usage = 'ai_usage',
links = 'links',
}
export interface SpantypesTraceServiceStatsDTO {
/**
* @type integer
* @minimum 0
*/
errorSpanCount: number;
/**
* @type integer
* @minimum 0
* @description Sum of the own time of the service's spans.
*/
ownTimeNano: number;
/**
* @type string
*/
serviceName: string;
/**
* @type integer
* @minimum 0
*/
spanCount: number;
}
export interface SpantypesTraceHighlightsDTO {
/**
* @description First page of the ai_usage view.
*/
aiUsage?: SpantypesSpanListDTO;
/**
* @description First page of the error_origins view.
*/
errorOrigins?: SpantypesSpanListDTO;
/**
* @description First page of the links view.
*/
links?: SpantypesSpanListDTO;
/**
* @type array
* @description Highest own time first.
*/
services: SpantypesTraceServiceStatsDTO[];
/**
* @description First page of the time_spent view.
*/
timeSpent?: SpantypesSpanListDTO;
/**
* @description First page of the unmarked_failures view.
*/
unmarkedFailures?: SpantypesSpanListDTO;
}
export interface SpantypesUpdatableSpanMapperDTO {
config?: SpantypesSpanMapperConfigDTO;
/**
@@ -16099,6 +16403,197 @@ export type GetTraceAggregations200 = {
status: string;
};
export type GetTraceHighlightsPathParameters = {
traceID: string;
};
export type GetTraceHighlightsParams = {
/**
* @type array
* @description The lists to return. Default: all.
*/
views?: SpantypesSpanListViewDTO[];
/**
* @type integer
* @description Spans in each list. Default: 10. Maximum: 1000.
*/
limit?: number;
};
export type GetTraceHighlights200 = {
data: SpantypesTraceHighlightsDTO;
/**
* @type string
*/
status: string;
};
export type ListTraceSpansPathParameters = {
traceID: string;
};
export type ListTraceSpansParams = {
/**
* @description Keeps only the spans of one kind, judged on the whole trace, by start time unless stated. error_origins: error spans with no failing child. unmarked_failures: spans not marked as errors with a 4xx or 5xx response, a non-OK gRPC status or an exception event. time_spent: one span per same-name sibling group, by the group's own time. ai_usage: spans with gen_ai token or cost usage, with those attributes, by cost, else tokens. links: spans that link to other spans.
*/
view?: SpantypesSpanListViewDTO;
/**
* @type string
* @description Words, a filter expression, or both, for example: worldpay AND has_error = true. Words match the name, status message, attributes, resource attributes and events, ignoring case. Applied before view.
*/
query?: string;
/**
* @type array
* @description Attributes or resource attributes to add to each span, for example http.route or resource.k8s.pod.name. Default: service.name only.
*/
selectFields?: string[];
/**
* @type integer
* @description Number of spans to skip. Default: 0.
*/
offset?: number;
/**
* @type integer
* @description Number of spans to return. Default: 50. Maximum: 1000.
*/
limit?: number;
};
export type ListTraceSpans200 = {
data: SpantypesSpanListDTO;
/**
* @type string
*/
status: string;
};
export type GetTraceSpanPathParameters = {
traceID: string;
spanID: string;
};
export type GetTraceSpan200 = {
data: SpantypesSpanDTO;
/**
* @type string
*/
status: string;
};
export type ListTraceSpanAncestorsPathParameters = {
traceID: string;
spanID: string;
};
export type ListTraceSpanAncestorsParams = {
/**
* @description Keeps only the spans of one kind, judged on the whole trace, by start time unless stated. error_origins: error spans with no failing child. unmarked_failures: spans not marked as errors with a 4xx or 5xx response, a non-OK gRPC status or an exception event. time_spent: one span per same-name sibling group, by the group's own time. ai_usage: spans with gen_ai token or cost usage, with those attributes, by cost, else tokens. links: spans that link to other spans.
*/
view?: SpantypesSpanListViewDTO;
/**
* @type string
* @description Words, a filter expression, or both, for example: worldpay AND has_error = true. Words match the name, status message, attributes, resource attributes and events, ignoring case. Applied before view.
*/
query?: string;
/**
* @type array
* @description Attributes or resource attributes to add to each span, for example http.route or resource.k8s.pod.name. Default: service.name only.
*/
selectFields?: string[];
/**
* @type integer
* @description Number of spans to skip. Default: 0.
*/
offset?: number;
/**
* @type integer
* @description Number of spans to return. Default: 50. Maximum: 1000.
*/
limit?: number;
};
export type ListTraceSpanAncestors200 = {
data: SpantypesSpanListDTO;
/**
* @type string
*/
status: string;
};
export type ListTraceSpanChildrenPathParameters = {
traceID: string;
spanID: string;
};
export type ListTraceSpanChildrenParams = {
/**
* @description Keeps only the spans of one kind, judged on the whole trace, by start time unless stated. error_origins: error spans with no failing child. unmarked_failures: spans not marked as errors with a 4xx or 5xx response, a non-OK gRPC status or an exception event. time_spent: one span per same-name sibling group, by the group's own time. ai_usage: spans with gen_ai token or cost usage, with those attributes, by cost, else tokens. links: spans that link to other spans.
*/
view?: SpantypesSpanListViewDTO;
/**
* @type string
* @description Words, a filter expression, or both, for example: worldpay AND has_error = true. Words match the name, status message, attributes, resource attributes and events, ignoring case. Applied before view.
*/
query?: string;
/**
* @type array
* @description Attributes or resource attributes to add to each span, for example http.route or resource.k8s.pod.name. Default: service.name only.
*/
selectFields?: string[];
/**
* @type integer
* @description Number of spans to skip. Default: 0.
*/
offset?: number;
/**
* @type integer
* @description Number of spans to return. Default: 50. Maximum: 1000.
*/
limit?: number;
};
export type ListTraceSpanChildren200 = {
data: SpantypesSpanListDTO;
/**
* @type string
*/
status: string;
};
export type ListTraceSpanDescendantsPathParameters = {
traceID: string;
spanID: string;
};
export type ListTraceSpanDescendantsParams = {
/**
* @description Keeps only the spans of one kind, judged on the whole trace, by start time unless stated. error_origins: error spans with no failing child. unmarked_failures: spans not marked as errors with a 4xx or 5xx response, a non-OK gRPC status or an exception event. time_spent: one span per same-name sibling group, by the group's own time. ai_usage: spans with gen_ai token or cost usage, with those attributes, by cost, else tokens. links: spans that link to other spans.
*/
view?: SpantypesSpanListViewDTO;
/**
* @type string
* @description Words, a filter expression, or both, for example: worldpay AND has_error = true. Words match the name, status message, attributes, resource attributes and events, ignoring case. Applied before view.
*/
query?: string;
/**
* @type array
* @description Attributes or resource attributes to add to each span, for example http.route or resource.k8s.pod.name. Default: service.name only.
*/
selectFields?: string[];
/**
* @type integer
* @description Number of spans to skip. Default: 0.
*/
offset?: number;
/**
* @type integer
* @description Number of spans to return. Default: 50. Maximum: 1000.
*/
limit?: number;
};
export type ListTraceSpanDescendants200 = {
data: SpantypesSpanListDTO;
/**
* @type string
*/
status: string;
};
export type GetTraceSummaryPathParameters = {
traceID: string;
};

View File

@@ -22,6 +22,11 @@ import type {
GetFlamegraphPathParameters,
GetTraceAggregations200,
GetTraceAggregationsPathParameters,
GetTraceHighlights200,
GetTraceHighlightsParams,
GetTraceHighlightsPathParameters,
GetTraceSpan200,
GetTraceSpanPathParameters,
GetTraceSummary200,
GetTraceSummaryPathParameters,
GetTraceThread200,
@@ -29,6 +34,18 @@ import type {
GetTraceThreadPathParameters,
GetWaterfallV4200,
GetWaterfallV4PathParameters,
ListTraceSpanAncestors200,
ListTraceSpanAncestorsParams,
ListTraceSpanAncestorsPathParameters,
ListTraceSpanChildren200,
ListTraceSpanChildrenParams,
ListTraceSpanChildrenPathParameters,
ListTraceSpanDescendants200,
ListTraceSpanDescendantsParams,
ListTraceSpanDescendantsPathParameters,
ListTraceSpans200,
ListTraceSpansParams,
ListTraceSpansPathParameters,
RenderErrorResponseDTO,
SpantypesPostableFlamegraphDTO,
SpantypesPostableTraceAggregationsDTO,
@@ -159,7 +176,710 @@ export const useGetTraceAggregations = <
return useMutation(getGetTraceAggregationsMutationOptions(options));
};
/**
* Returns the trace's time range, root span, span and error counts, and whether any spans are missing. AI traces also include token and cost totals.
* Returns the spans to look at, for a trace of any size: per-service totals and the first spans of each view of the span list. views names the lists to return; without it all of them are returned. Read more of a list from the span list with the view of the same name. The totals of the trace come from the trace summary.
* @summary Get highlights of a trace
*/
export const getTraceHighlights = (
{ traceID }: GetTraceHighlightsPathParameters,
params?: GetTraceHighlightsParams,
signal?: AbortSignal,
) => {
return GeneratedAPIInstance<GetTraceHighlights200>({
url: `/api/v1/traces/${traceID}/highlights`,
method: 'GET',
params,
signal,
});
};
export const getGetTraceHighlightsQueryKey = (
{ traceID }: GetTraceHighlightsPathParameters,
params?: GetTraceHighlightsParams,
) => {
return [
`/api/v1/traces/${traceID}/highlights`,
...(params ? [params] : []),
] as const;
};
export const getGetTraceHighlightsQueryOptions = <
TData = Awaited<ReturnType<typeof getTraceHighlights>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID }: GetTraceHighlightsPathParameters,
params?: GetTraceHighlightsParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof getTraceHighlights>>,
TError,
TData
>;
},
) => {
const { query: queryOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ?? getGetTraceHighlightsQueryKey({ traceID }, params);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof getTraceHighlights>>
> = ({ signal }) => getTraceHighlights({ traceID }, params, signal);
return {
queryKey,
queryFn,
enabled: traceID !== null && traceID !== undefined,
...queryOptions,
} as UseQueryOptions<
Awaited<ReturnType<typeof getTraceHighlights>>,
TError,
TData
> & { queryKey: QueryKey };
};
export type GetTraceHighlightsQueryResult = NonNullable<
Awaited<ReturnType<typeof getTraceHighlights>>
>;
export type GetTraceHighlightsQueryError = ErrorType<RenderErrorResponseDTO>;
/**
* @summary Get highlights of a trace
*/
export function useGetTraceHighlights<
TData = Awaited<ReturnType<typeof getTraceHighlights>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID }: GetTraceHighlightsPathParameters,
params?: GetTraceHighlightsParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof getTraceHighlights>>,
TError,
TData
>;
},
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getGetTraceHighlightsQueryOptions(
{ traceID },
params,
options,
);
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
};
return withQueryKey(query, queryOptions.queryKey);
}
/**
* @summary Get highlights of a trace
*/
export const invalidateGetTraceHighlights = async (
queryClient: QueryClient,
{ traceID }: GetTraceHighlightsPathParameters,
params?: GetTraceHighlightsParams,
options?: InvalidateOptions,
): Promise<QueryClient> => {
await queryClient.invalidateQueries(
{ queryKey: getGetTraceHighlightsQueryKey({ traceID }, params) },
options,
);
return queryClient;
};
/**
* Returns a page of the spans of a trace, in tree order from the top: a span is followed by the spans below it. view keeps only the spans of one kind, query narrows them, and selectFields names the attributes to fill. Values are returned whole.
* @summary List spans of a trace
*/
export const listTraceSpans = (
{ traceID }: ListTraceSpansPathParameters,
params?: ListTraceSpansParams,
signal?: AbortSignal,
) => {
return GeneratedAPIInstance<ListTraceSpans200>({
url: `/api/v1/traces/${traceID}/spans`,
method: 'GET',
params,
signal,
});
};
export const getListTraceSpansQueryKey = (
{ traceID }: ListTraceSpansPathParameters,
params?: ListTraceSpansParams,
) => {
return [
`/api/v1/traces/${traceID}/spans`,
...(params ? [params] : []),
] as const;
};
export const getListTraceSpansQueryOptions = <
TData = Awaited<ReturnType<typeof listTraceSpans>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID }: ListTraceSpansPathParameters,
params?: ListTraceSpansParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpans>>,
TError,
TData
>;
},
) => {
const { query: queryOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ?? getListTraceSpansQueryKey({ traceID }, params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof listTraceSpans>>> = ({
signal,
}) => listTraceSpans({ traceID }, params, signal);
return {
queryKey,
queryFn,
enabled: traceID !== null && traceID !== undefined,
...queryOptions,
} as UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpans>>,
TError,
TData
> & { queryKey: QueryKey };
};
export type ListTraceSpansQueryResult = NonNullable<
Awaited<ReturnType<typeof listTraceSpans>>
>;
export type ListTraceSpansQueryError = ErrorType<RenderErrorResponseDTO>;
/**
* @summary List spans of a trace
*/
export function useListTraceSpans<
TData = Awaited<ReturnType<typeof listTraceSpans>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID }: ListTraceSpansPathParameters,
params?: ListTraceSpansParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpans>>,
TError,
TData
>;
},
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getListTraceSpansQueryOptions(
{ traceID },
params,
options,
);
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
};
return withQueryKey(query, queryOptions.queryKey);
}
/**
* @summary List spans of a trace
*/
export const invalidateListTraceSpans = async (
queryClient: QueryClient,
{ traceID }: ListTraceSpansPathParameters,
params?: ListTraceSpansParams,
options?: InvalidateOptions,
): Promise<QueryClient> => {
await queryClient.invalidateQueries(
{ queryKey: getListTraceSpansQueryKey({ traceID }, params) },
options,
);
return queryClient;
};
/**
* Returns one span with every attribute, resource attribute and event. Values are returned whole. It returns only the stored span: its tree stats come with it in any span list, and the spans around it come from the children, descendants and ancestors routes.
* @summary Get span of a trace
*/
export const getTraceSpan = (
{ traceID, spanID }: GetTraceSpanPathParameters,
signal?: AbortSignal,
) => {
return GeneratedAPIInstance<GetTraceSpan200>({
url: `/api/v1/traces/${traceID}/spans/${spanID}`,
method: 'GET',
signal,
});
};
export const getGetTraceSpanQueryKey = ({
traceID,
spanID,
}: GetTraceSpanPathParameters) => {
return [`/api/v1/traces/${traceID}/spans/${spanID}`] as const;
};
export const getGetTraceSpanQueryOptions = <
TData = Awaited<ReturnType<typeof getTraceSpan>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID, spanID }: GetTraceSpanPathParameters,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof getTraceSpan>>,
TError,
TData
>;
},
) => {
const { query: queryOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ?? getGetTraceSpanQueryKey({ traceID, spanID });
const queryFn: QueryFunction<Awaited<ReturnType<typeof getTraceSpan>>> = ({
signal,
}) => getTraceSpan({ traceID, spanID }, signal);
return {
queryKey,
queryFn,
enabled:
traceID !== null &&
traceID !== undefined &&
spanID !== null &&
spanID !== undefined,
...queryOptions,
} as UseQueryOptions<
Awaited<ReturnType<typeof getTraceSpan>>,
TError,
TData
> & { queryKey: QueryKey };
};
export type GetTraceSpanQueryResult = NonNullable<
Awaited<ReturnType<typeof getTraceSpan>>
>;
export type GetTraceSpanQueryError = ErrorType<RenderErrorResponseDTO>;
/**
* @summary Get span of a trace
*/
export function useGetTraceSpan<
TData = Awaited<ReturnType<typeof getTraceSpan>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID, spanID }: GetTraceSpanPathParameters,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof getTraceSpan>>,
TError,
TData
>;
},
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getGetTraceSpanQueryOptions({ traceID, spanID }, options);
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
};
return withQueryKey(query, queryOptions.queryKey);
}
/**
* @summary Get span of a trace
*/
export const invalidateGetTraceSpan = async (
queryClient: QueryClient,
{ traceID, spanID }: GetTraceSpanPathParameters,
options?: InvalidateOptions,
): Promise<QueryClient> => {
await queryClient.invalidateQueries(
{ queryKey: getGetTraceSpanQueryKey({ traceID, spanID }) },
options,
);
return queryClient;
};
/**
* Returns a page of the spans above a span: the chain of parents from the span up to its root, the parent first, and nothing from other branches. The span itself is not included. It takes the same parameters as the span list. The list is empty for a root, and stops where a parent was never received.
* @summary List ancestors of a span
*/
export const listTraceSpanAncestors = (
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
params?: ListTraceSpanAncestorsParams,
signal?: AbortSignal,
) => {
return GeneratedAPIInstance<ListTraceSpanAncestors200>({
url: `/api/v1/traces/${traceID}/spans/${spanID}/ancestors`,
method: 'GET',
params,
signal,
});
};
export const getListTraceSpanAncestorsQueryKey = (
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
params?: ListTraceSpanAncestorsParams,
) => {
return [
`/api/v1/traces/${traceID}/spans/${spanID}/ancestors`,
...(params ? [params] : []),
] as const;
};
export const getListTraceSpanAncestorsQueryOptions = <
TData = Awaited<ReturnType<typeof listTraceSpanAncestors>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
params?: ListTraceSpanAncestorsParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpanAncestors>>,
TError,
TData
>;
},
) => {
const { query: queryOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ??
getListTraceSpanAncestorsQueryKey({ traceID, spanID }, params);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof listTraceSpanAncestors>>
> = ({ signal }) =>
listTraceSpanAncestors({ traceID, spanID }, params, signal);
return {
queryKey,
queryFn,
enabled:
traceID !== null &&
traceID !== undefined &&
spanID !== null &&
spanID !== undefined,
...queryOptions,
} as UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpanAncestors>>,
TError,
TData
> & { queryKey: QueryKey };
};
export type ListTraceSpanAncestorsQueryResult = NonNullable<
Awaited<ReturnType<typeof listTraceSpanAncestors>>
>;
export type ListTraceSpanAncestorsQueryError =
ErrorType<RenderErrorResponseDTO>;
/**
* @summary List ancestors of a span
*/
export function useListTraceSpanAncestors<
TData = Awaited<ReturnType<typeof listTraceSpanAncestors>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
params?: ListTraceSpanAncestorsParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpanAncestors>>,
TError,
TData
>;
},
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getListTraceSpanAncestorsQueryOptions(
{ traceID, spanID },
params,
options,
);
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
};
return withQueryKey(query, queryOptions.queryKey);
}
/**
* @summary List ancestors of a span
*/
export const invalidateListTraceSpanAncestors = async (
queryClient: QueryClient,
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
params?: ListTraceSpanAncestorsParams,
options?: InvalidateOptions,
): Promise<QueryClient> => {
await queryClient.invalidateQueries(
{ queryKey: getListTraceSpanAncestorsQueryKey({ traceID, spanID }, params) },
options,
);
return queryClient;
};
/**
* Returns a page of the direct children of a span, one level below it and nothing deeper, in start order. It takes the same parameters as the span list. The list is empty for a span without children.
* @summary List children of a span
*/
export const listTraceSpanChildren = (
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
params?: ListTraceSpanChildrenParams,
signal?: AbortSignal,
) => {
return GeneratedAPIInstance<ListTraceSpanChildren200>({
url: `/api/v1/traces/${traceID}/spans/${spanID}/children`,
method: 'GET',
params,
signal,
});
};
export const getListTraceSpanChildrenQueryKey = (
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
params?: ListTraceSpanChildrenParams,
) => {
return [
`/api/v1/traces/${traceID}/spans/${spanID}/children`,
...(params ? [params] : []),
] as const;
};
export const getListTraceSpanChildrenQueryOptions = <
TData = Awaited<ReturnType<typeof listTraceSpanChildren>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
params?: ListTraceSpanChildrenParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpanChildren>>,
TError,
TData
>;
},
) => {
const { query: queryOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ??
getListTraceSpanChildrenQueryKey({ traceID, spanID }, params);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof listTraceSpanChildren>>
> = ({ signal }) => listTraceSpanChildren({ traceID, spanID }, params, signal);
return {
queryKey,
queryFn,
enabled:
traceID !== null &&
traceID !== undefined &&
spanID !== null &&
spanID !== undefined,
...queryOptions,
} as UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpanChildren>>,
TError,
TData
> & { queryKey: QueryKey };
};
export type ListTraceSpanChildrenQueryResult = NonNullable<
Awaited<ReturnType<typeof listTraceSpanChildren>>
>;
export type ListTraceSpanChildrenQueryError = ErrorType<RenderErrorResponseDTO>;
/**
* @summary List children of a span
*/
export function useListTraceSpanChildren<
TData = Awaited<ReturnType<typeof listTraceSpanChildren>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
params?: ListTraceSpanChildrenParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpanChildren>>,
TError,
TData
>;
},
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getListTraceSpanChildrenQueryOptions(
{ traceID, spanID },
params,
options,
);
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
};
return withQueryKey(query, queryOptions.queryKey);
}
/**
* @summary List children of a span
*/
export const invalidateListTraceSpanChildren = async (
queryClient: QueryClient,
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
params?: ListTraceSpanChildrenParams,
options?: InvalidateOptions,
): Promise<QueryClient> => {
await queryClient.invalidateQueries(
{ queryKey: getListTraceSpanChildrenQueryKey({ traceID, spanID }, params) },
options,
);
return queryClient;
};
/**
* Returns a page of the spans below a span, at any depth, in tree order. It takes the same parameters as the span list, so view=error_origins returns the errors that started below the span.
* @summary List descendants of a span
*/
export const listTraceSpanDescendants = (
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
params?: ListTraceSpanDescendantsParams,
signal?: AbortSignal,
) => {
return GeneratedAPIInstance<ListTraceSpanDescendants200>({
url: `/api/v1/traces/${traceID}/spans/${spanID}/descendants`,
method: 'GET',
params,
signal,
});
};
export const getListTraceSpanDescendantsQueryKey = (
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
params?: ListTraceSpanDescendantsParams,
) => {
return [
`/api/v1/traces/${traceID}/spans/${spanID}/descendants`,
...(params ? [params] : []),
] as const;
};
export const getListTraceSpanDescendantsQueryOptions = <
TData = Awaited<ReturnType<typeof listTraceSpanDescendants>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
params?: ListTraceSpanDescendantsParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpanDescendants>>,
TError,
TData
>;
},
) => {
const { query: queryOptions } = options ?? {};
const queryKey =
queryOptions?.queryKey ??
getListTraceSpanDescendantsQueryKey({ traceID, spanID }, params);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof listTraceSpanDescendants>>
> = ({ signal }) =>
listTraceSpanDescendants({ traceID, spanID }, params, signal);
return {
queryKey,
queryFn,
enabled:
traceID !== null &&
traceID !== undefined &&
spanID !== null &&
spanID !== undefined,
...queryOptions,
} as UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpanDescendants>>,
TError,
TData
> & { queryKey: QueryKey };
};
export type ListTraceSpanDescendantsQueryResult = NonNullable<
Awaited<ReturnType<typeof listTraceSpanDescendants>>
>;
export type ListTraceSpanDescendantsQueryError =
ErrorType<RenderErrorResponseDTO>;
/**
* @summary List descendants of a span
*/
export function useListTraceSpanDescendants<
TData = Awaited<ReturnType<typeof listTraceSpanDescendants>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
params?: ListTraceSpanDescendantsParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listTraceSpanDescendants>>,
TError,
TData
>;
},
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getListTraceSpanDescendantsQueryOptions(
{ traceID, spanID },
params,
options,
);
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
};
return withQueryKey(query, queryOptions.queryKey);
}
/**
* @summary List descendants of a span
*/
export const invalidateListTraceSpanDescendants = async (
queryClient: QueryClient,
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
params?: ListTraceSpanDescendantsParams,
options?: InvalidateOptions,
): Promise<QueryClient> => {
await queryClient.invalidateQueries(
{
queryKey: getListTraceSpanDescendantsQueryKey({ traceID, spanID }, params),
},
options,
);
return queryClient;
};
/**
* Returns the totals of a trace and no spans: its time range, root span, span and error counts, and whether any spans are missing. AI traces also include model and tool call counts, and token and cost totals. For the spans to look at, use the trace highlights.
* @summary Get summary for a trace
*/
export const getTraceSummary = (
@@ -261,7 +981,7 @@ export const invalidateGetTraceSummary = async (
};
/**
* Returns the gen_ai spans of a trace, model calls, tool calls and agent spans, in timestamp order. The messages a span carries are decoded into formattedInput and formattedOutput, with formatterWarnings holding what the converter could not resolve; a span without messages has both empty. Pass nextCursor as after or prevCursor as before to page, or spanId to open the page around a span.
* Returns the gen_ai spans of a trace, LLM calls, tool calls and agent spans, in timestamp order. The messages a span carries are decoded into formattedInput and formattedOutput, with formatterWarnings holding what the converter could not resolve; a span without messages has both empty. Pass nextCursor as after or prevCursor as before to page, or spanId to open the page around a span.
* @summary Get thread view for a trace
*/
export const getTraceThread = (

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

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

@@ -72,7 +72,6 @@ function LogDetailBody({
target.closest('.cm-tooltip-autocomplete') ||
target.closest('.drawer-popover') ||
target.closest('.query-status-popover') ||
target.closest('[data-radix-popper-content-wrapper]') ||
target.closest('[data-base-ui-portal]')
) {
return;

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

@@ -9,4 +9,5 @@ export enum FeatureKeys {
ANOMALY_DETECTION = 'anomaly_detection',
USE_JSON_BODY = 'use_json_body',
ENABLE_METRICS_REDUCTION = 'enable_metrics_reduction',
USE_NOTIFICATION_TEMPLATE = 'use_notification_template',
}

View File

@@ -6,10 +6,10 @@
justify-content: flex-end;
gap: var(--spacing-3) var(--spacing-4);
margin-top: -28px;
padding: 0 calc(var(--spacing-8) + 28px) var(--spacing-4) var(--spacing-8);
padding: 0 calc(var(--spacing-8) + 28px) var(--spacing-2) var(--spacing-8);
&.compact {
padding: 0 calc(var(--spacing-3) + 28px) var(--spacing-3) var(--spacing-3);
padding: 0 calc(var(--spacing-3) + 28px) var(--spacing-2) var(--spacing-3);
}
}

View File

@@ -1,6 +1,7 @@
.message {
display: flex;
padding: 8px 16px;
// Each message ends in its 28px hover row; the 4px under it makes 32px between messages.
padding: 0 var(--spacing-8) var(--spacing-2);
// CSS variable consumed by MessageFeedback to fade in on hover.
--feedback-opacity: 0;
@@ -9,7 +10,12 @@
}
&.compact {
padding: 6px;
padding: 0 var(--spacing-3) var(--spacing-2);
}
// An error reply has no hover row, so it holds the 32px itself.
&.noActions {
padding-bottom: var(--spacing-16);
}
}
@@ -74,6 +80,10 @@
border-bottom-left-radius: var(--radius-2);
}
.assistant &:not(.error) {
padding-block: 0;
}
// The full page sets replies flush on the pane; errors keep their callout.
.assistant .fullPage &:not(.error) {
padding: 0 0 0 var(--spacing-5);
@@ -114,7 +124,7 @@
}
.retryButton {
margin-top: 6px;
margin-top: var(--spacing-2);
align-self: flex-start;
}

View File

@@ -142,6 +142,7 @@ export default function MessageBubble({
isUser ? styles.user : styles.assistant,
{
[styles.compact]: isCompact,
[styles.noActions]: isError && !showRetry,
},
);
const bodyClass = cx(styles.body, {

View File

@@ -9,12 +9,12 @@
// Room around the thread lives in its rows: Virtuoso measures only rows, so padding outside them leaves its scrolls short.
.row.first {
padding-top: var(--spacing-8);
padding-top: var(--spacing-12);
}
// Keeps the last bubble off the disclaimer and input bar.
.row.last {
padding-bottom: var(--spacing-32);
padding-bottom: var(--spacing-2);
}
// As wide as the full-page input; the extra 32px is the rows' own gutters.

View File

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

View File

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

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

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

@@ -1,35 +0,0 @@
.json-view-container {
border-radius: 3px;
border: 1px solid var(--l1-border);
padding-top: 16px;
.json-view-footer {
height: 36px;
display: flex;
align-items: center;
border-top: 1px solid var(--l1-border);
}
.log-switch {
display: flex;
justify-content: space-between;
align-items: center;
.wrap-word-switch {
display: flex;
gap: 8px;
margin-left: var(--margin-3);
align-items: center;
}
.log-switch-btn {
border: 1px solid var(--l1-border);
background-color: var(--l2-background);
width: 40px;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
}
}

View File

@@ -35,13 +35,6 @@
display: flex;
align-items: center;
.wrap-word-switch {
display: flex;
gap: 8px;
margin-left: var(--margin-3);
align-items: center;
}
.log-switch-btn {
border: 1px solid var(--l1-border);
background-color: var(--l2-background);
@@ -53,74 +46,12 @@
}
}
.attribute-table {
margin-top: var(--margin-1);
}
.ant-collapse {
border: 1px solid var(--l1-border);
}
.collapse-content {
border-bottom: 1px solid var(--l1-border);
.ant-collapse-header {
align-items: center;
border-radius: 2px;
background-color: var(--l3-background);
border: 1px solid var(--l3-border);
padding: 8px;
.ant-collapse-extra {
display: flex;
align-items: center;
.action-btn {
display: flex;
.ant-btn {
background: color-mix(in srgb, var(--bg-robin-400) 8%, transparent);
}
}
}
}
.ant-collapse-content {
padding: 0;
background: var(--l2-background);
border-top: 1px solid var(--l1-border);
.ant-collapse-content-box {
padding: var(--padding-2) 0 0 0;
}
}
}
.logs-body-content {
padding-top: 12px;
}
[data-slot='badge'] {
border-radius: 2px;
background: color-mix(in srgb, var(--bg-robin-400) 8%, transparent);
}
.attribute-collapse {
.ant-collapse-content {
.ant-collapse-content-box {
padding: 0;
}
}
}
.ant-table-wrapper .ant-table-cell {
padding: 14px 14px;
}
.attribute-tab-header {
display: flex;
align-items: center;
justify-content: space-between;
}
}

View File

@@ -1,5 +0,0 @@
export const DROPDOWN_KEY = {
FILTER_IN: 'filterIn',
FILTER_OUT: 'filterOut',
GROUP_BY: 'groupBy',
};

View File

@@ -76,9 +76,6 @@ export const generateFieldKeyForArray = (
return `body.${newResultNodeKey}`;
};
export const removeObjectFromString = (str: string): string =>
str.replace(/\[object Object\]./g, '');
// Split `str` on the first occurrence of `delimiter`
// For example, will return `['a', 'b.c']` when splitting `'a.b.c'` at dots
const splitOnce = (str: string, delimiter: string): string[] => {
@@ -303,30 +300,6 @@ export const unescapeString = (str: string): string =>
String.fromCharCode(parseInt(hex, 16)),
); // Replaces Unicode escape sequences
export function findKeyPath(
obj: AnyObject,
targetKey: string,
currentPath = '',
): string | null {
let finalPath = null;
Object.keys(obj).forEach((key) => {
const value = obj[key];
const newPath = currentPath ? `${currentPath}.${key}` : key;
if (key === targetKey) {
finalPath = newPath;
}
if (typeof value === 'object' && value !== null) {
const result = findKeyPath(value, targetKey, newPath);
if (result) {
finalPath = result;
}
}
});
return finalPath;
}
export const getSanitizedLogBody = (
text: string,
options: { shouldEscapeHtml?: boolean } = {},

View File

@@ -1,10 +0,0 @@
.qb-search-view-container {
padding: 8px 16px;
.ant-select-selector {
border-radius: 2px;
border: 1px solid var(--l1-border) !important;
background-color: var(--l1-background) !important;
color: var(--l2-foreground);
}
}

View File

@@ -7,8 +7,6 @@ import { useShareBuilderUrl } from 'hooks/queryBuilder/useShareBuilderUrl';
import { ExplorerViews } from 'pages/LogsExplorer/utils';
import { DataSource } from 'types/common/queryBuilder';
import './LogsExplorerQuerySection.styles.scss';
function LogExplorerQuerySection({
selectedView,
}: {

View File

@@ -62,16 +62,6 @@ const SEVERITY_VARIANT_COLORS: Record<string, string> = {
PANIC: Color.BG_SAKURA_600,
};
// Simple function to get severity color for any component
export function getSeverityColor(severityText: string): string {
const variantColor = SEVERITY_VARIANT_COLORS[severityText.trim()];
if (variantColor) {
return variantColor;
}
return Color.BG_ROBIN_500; // Default fallback
}
export function getColorsForSeverityLabels(
label: string,
index: number,

View File

@@ -7,252 +7,6 @@
letter-spacing: -0.005em;
text-align: left;
min-height: 0;
.logs-list-table-view-container {
.data-table-container {
border: none !important;
}
table {
thead {
tr {
th {
font-size: 12px;
color: white !important;
.cursor-col-resize {
width: 24px !important;
cursor: col-resize !important;
opacity: 1 !important;
background-color: transparent !important;
border: none !important;
&:hover {
opacity: 1 !important;
}
}
}
td {
font-size: 12px;
}
border-bottom: 1px solid var(--l1-border) !important;
}
border-bottom: 1px solid var(--l1-border) !important;
background-color: var(--l2-background) !important;
tr {
&:hover {
background-color: var(--l2-background) !important;
}
}
}
tbody {
tr {
td {
font-size: 12px;
padding: 4px !important;
white-space: pre-wrap !important;
overflow: hidden !important;
}
&:hover {
background-color: var(--l1-border) !important;
}
border-bottom: 1px solid var(--l1-border) !important;
}
tr:has(.active-log) {
background-color: rgba(78, 116, 248, 0.5) !important; // same as bg-robin-500
color: var(--l1-foreground) !important;
}
}
thead {
z-index: 2 !important;
}
.log-state-indicator {
padding-left: 0 !important;
.line {
margin: 0 0 !important;
}
}
}
.sticky-header-table-container {
&::-webkit-scrollbar {
width: 0.4rem;
height: 0.4rem;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: var(--l3-background);
}
&::-webkit-scrollbar-thumb:hover {
background: var(--l3-background);
}
}
&[data-max-lines-per-row='1'] {
tbody {
tr {
td {
.table-cell-content {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
}
}
}
}
}
&[data-max-lines-per-row='2'] {
tbody {
tr {
td {
.table-cell-content {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
}
}
}
}
&[data-max-lines-per-row='3'] {
tbody {
tr {
td {
.table-cell-content {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
}
}
}
}
&[data-max-lines-per-row='4'] {
tbody {
tr {
td {
.table-cell-content {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
overflow: hidden;
}
}
}
}
}
&[data-max-lines-per-row='5'] {
tbody {
tr {
td {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 5;
overflow: hidden;
}
}
}
}
&[data-max-lines-per-row='6'] {
tbody {
tr {
td {
.table-cell-content {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 6;
overflow: hidden;
}
}
}
}
}
&[data-max-lines-per-row='7'] {
tbody {
tr {
td {
.table-cell-content {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 7;
overflow: hidden;
}
}
}
}
}
&[data-max-lines-per-row='8'] {
tbody {
tr {
td {
.table-cell-content {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 8;
overflow: hidden;
}
}
}
}
}
&[data-max-lines-per-row='9'] {
tbody {
tr {
td {
.table-cell-content {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 9;
overflow: hidden;
}
}
}
}
}
&[data-max-lines-per-row='10'] {
tbody {
tr {
td {
.table-cell-content {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 10;
overflow: hidden;
}
}
}
}
}
}
}
.logs-linked-row td {

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