Compare commits

..

1 Commits

Author SHA1 Message Date
nityanandagohain
515ca8ee4e fix(querybuilder): select traces by the filter in ai trace aggregations 2026-12-02 16:16:36 +05:30
177 changed files with 1310 additions and 4292 deletions

View File

@@ -113,11 +113,10 @@ CI runs each play once, with its story's own args. Anyone can flip a control in
Before writing the clicks, list what has to be on screen for the play's target to exist. Then walk every control the story exposes, the page's own as well as the shared ones, and return early for each value that takes something on that list away. These are the cases plays have missed:
- An arg the story sets. The story sets it because the play needs what that value renders, and the panel can flip it. On the `mine` view the dashboards Created-by filter opens with a tag to remove; on the other views it opens empty and there is no × to click. Check the tag is there by parsing the route the view resolves to.
- The controls every story has. `State` on loading or error renders no rows and no filter suggestions. `Access`, `Permissions` and `Revoked` remove rows, row actions and gated buttons, and the `editor` and `viewer` presets grant telemetry reads only, so a page gated on its own resource shows them nothing. `Check state` on loading disables every gated control, and on error an `AuthZButton` stays enabled while an `AuthZGuardContent` set to fail closed hides what it wraps. `License` and `Banner` decide the plan, so a cloud-only form is gone on the others. `Hold tooltips open` shows a label a second time, inside its tooltip, and fails any check that no tooltip is open.
- The controls every story has. `State` on loading or error renders no rows and no filter suggestions. `Access`, `Permissions` and `Revoked` remove rows, row actions and gated buttons, and the `editor` and `viewer` presets grant telemetry reads only, so a page gated on its own resource shows them nothing. `Check state` on loading disables every gated control, and on error an `AuthZButton` stays enabled while an `AuthZGuardContent` set to fail closed hides what it wraps. `License` and `Banner` decide the plan, so a cloud-only form is gone on the others. `Hold tooltips open` shows a label a second time, inside its tooltip.
- A count at 0. The page can swap its whole list for an empty state, and the header, filters and column picker go with it.
- A view, filter or invalid query that leaves no rows, even when the count is above 0.
- A tab without the widget. A filter box that one tab has is not on the next.
- A control that moves the widget out of the canvas. Trace details with `Panel position` on dialog renders span details in a floating panel under `document.body`, so a lookup `within(canvasElement)` never finds its tabs. Return early for that value, or search with `screen`.
- A second list beside the main one, such as saved views. At 0, loading or failed, its actions are gone.
- Text that depends on an arg. A disabled rule offers Enable, not Disable. A write that fails raises a different toast from one that lands, and one left loading raises none. Pick the expected text from the args.
- Rows that move. A view, a sort or pinning changes which row is locked, pinned or legacy, so find the row by what it is, not by its index.

View File

@@ -13065,12 +13065,6 @@ components:
additionalProperties: {}
description: All of them for a span read by ID; the selected ones in a list.
type: object
db_name:
description: Omitted when empty, and in a list unless selected.
type: string
db_operation:
description: Omitted when empty, and in a list unless selected.
type: string
duration_nano:
minimum: 0
type: integer
@@ -13079,26 +13073,8 @@ components:
items:
$ref: '#/components/schemas/SpantypesEvent'
type: array
external_http_method:
description: Method of an outgoing HTTP call. Omitted when empty, and in
a list unless selected.
type: string
external_http_url:
description: Host of an outgoing HTTP call. Omitted when empty, and in a
list unless selected.
type: string
has_error:
type: boolean
http_host:
description: Host or server address. Omitted when empty, and in a list unless
selected.
type: string
http_method:
description: Omitted when empty, and in a list unless selected.
type: string
http_url:
description: Omitted when empty, and in a list unless selected.
type: string
kind_string:
description: For example Server, Client or Internal.
type: string
@@ -13121,11 +13097,6 @@ components:
response_status_code:
description: HTTP or gRPC status code, for example 404.
type: string
scope:
allOf:
- $ref: '#/components/schemas/SpantypesScope'
description: Instrumentation scope. Omitted when empty, and in a list unless
selected.
span_id:
type: string
status_code_string:
@@ -13139,9 +13110,6 @@ components:
type: integer
trace_id:
type: string
trace_state:
description: W3C trace state. Omitted when empty, and in a list unless selected.
type: string
required:
- span_id
- trace_id
@@ -14528,9 +14496,8 @@ paths:
x-signoz-stability: alpha
/api/v1/channels:
get:
deprecated: true
description: 'Deprecated: use GET /api/v2/notification_channels instead. This
endpoint lists all notification channels for the organization'
deprecated: false
description: This endpoint lists all notification channels for the organization
operationId: ListChannels
responses:
"200":
@@ -14577,9 +14544,8 @@ paths:
- channels
x-signoz-stability: alpha
post:
deprecated: true
description: 'Deprecated: use POST /api/v2/notification_channels instead. This
endpoint creates a notification channel'
deprecated: false
description: This endpoint creates a notification channel
operationId: CreateChannel
requestBody:
content:
@@ -14636,9 +14602,8 @@ paths:
x-signoz-stability: alpha
/api/v1/channels/{id}:
delete:
deprecated: true
description: 'Deprecated: use DELETE /api/v2/notification_channels/{id} instead.
This endpoint deletes a notification channel by ID'
deprecated: false
description: This endpoint deletes a notification channel by ID
operationId: DeleteChannelByID
parameters:
- in: path
@@ -14683,9 +14648,8 @@ paths:
- channels
x-signoz-stability: alpha
get:
deprecated: true
description: 'Deprecated: use GET /api/v2/notification_channels/{id} instead.
This endpoint returns a notification channel by ID'
deprecated: false
description: This endpoint returns a notification channel by ID
operationId: GetChannelByID
parameters:
- in: path
@@ -14742,9 +14706,8 @@ paths:
- channels
x-signoz-stability: alpha
put:
deprecated: true
description: 'Deprecated: use PUT /api/v2/notification_channels/{id} instead.
This endpoint updates a notification channel by ID'
deprecated: false
description: This endpoint updates a notification channel by ID
operationId: UpdateChannelByID
parameters:
- in: path
@@ -14801,9 +14764,8 @@ paths:
x-signoz-stability: alpha
/api/v1/channels/test:
post:
deprecated: true
description: 'Deprecated: use POST /api/v2/notification_channels/test instead.
This endpoint tests a notification channel by sending a test notification'
deprecated: false
description: This endpoint tests a notification channel by sending a test notification
operationId: TestChannel
requestBody:
content:

View File

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

View File

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

View File

@@ -29,7 +29,6 @@
"commitlint": "commitlint --edit $1",
"test": "jest",
"test:changedsince": "jest --changedSince=main --coverage --silent",
"test:affected": "node scripts/affected-tests.mjs",
"generate:api": "orval --config ./orval.config.ts && sh scripts/post-types-generation.sh",
"generate:config:web-settings": "json2ts ./src/schemas/generated/webSettings.schema.json -o src/types/generated/webSettings.ts --style.useTabs --style.tabWidth=1 --style.singleQuote --bannerComment '/* AUTO GENERATED FILE - DO NOT EDIT - GENERATED FROM frontend/src/schemas/generated/webSettings.schema.json */'",
"build:geo-outlines": "node scripts/geo-outlines/build.mjs"

View File

@@ -1,210 +0,0 @@
#!/usr/bin/env node
// Usage: node scripts/affected-tests.mjs [--suite unit|storybook|e2e|all] [--base <ref>] [--list] [-- <runner args>]
import path from 'node:path';
import {
E2E,
e2eIndex,
specsImporting,
specsVisiting,
} from './affected/e2e.mjs';
import {
REPO,
changedFiles,
changedPackages,
git,
importersOf,
} from './affected/git.mjs';
import { FRONTEND, pnpm, relatedFiles } from './affected/jestGraph.mjs';
import { log } from './affected/log.mjs';
import { SHELL_ENTRY, pageEntries } from './affected/routes.mjs';
const SHARED = String.raw`^frontend/(pnpm-lock\.yaml|pnpm-workspace\.yaml|tsconfig.*\.json)$`;
// Any change here can affect every test of the suite, so the import graph cannot narrow it.
const RUN_ALL = {
unit: [
SHARED,
String.raw`^frontend/(jest\.\w+\.\w+|babel\.config\.cjs)$`,
'^frontend/(__mocks__|src/__tests__)/',
],
storybook: [
SHARED,
String.raw`^frontend/vite\.config\.ts$`,
'^frontend/(\\.storybook|src/storybook/mocks|vite-plugins)/',
],
e2e: [
SHARED,
String.raw`^frontend/(vite\.config\.ts|index\.html)$`,
'^frontend/vite-plugins/',
String.raw`^tests/e2e/(package\.json|pnpm-lock\.yaml|playwright\.config\.ts|tsconfig\.json)$`,
'^tests/e2e/bootstrap/',
],
};
const STORY_MATCH = [
'<rootDir>/src/**/*.stories.ts',
'<rootDir>/src/**/*.stories.tsx',
];
const SHELL_SPEC_DIRS = ['app-shell', 'routing'];
function parseArgs(argv) {
const sep = argv.indexOf('--');
const own = sep === -1 ? argv : argv.slice(0, sep);
const opts = {
base: 'origin/main',
list: false,
suite: 'unit',
extra: sep === -1 ? [] : argv.slice(sep + 1),
};
for (let i = 0; i < own.length; i++) {
if (own[i] === '--base') {
opts.base = own[++i];
} else if (own[i] === '--suite') {
opts.suite = own[++i];
} else if (own[i] === '--list') {
opts.list = true;
}
}
return opts;
}
// src/pages/DashboardPage/x/y.test.tsx -> pages/DashboardPage
function srcFeature(file) {
const parts = path.relative(path.join(FRONTEND, 'src'), file).split(path.sep);
return parts.length > 2 ? `${parts[0]}/${parts[1]}` : parts[0];
}
function printGroups(title, files, feature) {
const groups = Object.entries(Object.groupBy(files, feature)).sort(
(a, b) => b[1].length - a[1].length,
);
log(`\n[${title}] ${groups.length} features, ${files.length} files:`);
groups.forEach(([name, list]) =>
log(` ${String(list.length).padStart(4)} ${name}`),
);
}
// Swaps a dependency-only package.json bump for the source files that import the bumped packages.
function expandBumps(files, mergeBase) {
if (!files.includes('frontend/package.json')) {
return { files };
}
const pkgs = changedPackages(mergeBase, 'frontend/package.json');
if (!pkgs) {
return {
files,
reason: 'frontend/package.json changed beyond dependency versions',
};
}
log(`\nBumped packages: ${pkgs.join(', ')}`);
const rest = files.filter(
(f) => f !== 'frontend/package.json' && f !== 'frontend/pnpm-lock.yaml',
);
return {
files: [
...new Set([
...rest,
...pkgs.flatMap((p) => importersOf(p, 'frontend/src')),
]),
],
};
}
const planners = {
unit: (src) => ({ files: relatedFiles(src), feature: srcFeature }),
storybook: (src) => ({
files: relatedFiles(src, STORY_MATCH),
feature: srcFeature,
}),
e2e: (src, changed) => {
const pages = pageEntries();
const hit = new Set(
relatedFiles(src, [...pages.map((p) => p.file), SHELL_ENTRY]),
);
const routes = pages.filter((p) => hit.has(p.file)).flatMap((p) => p.paths);
log(
`\n[e2e] routes reached: ${routes.join(' ') || 'none'}${hit.has(SHELL_ENTRY) ? ' + app shell' : ''}`,
);
const index = e2eIndex(pages.flatMap((p) => p.paths));
const shell = hit.has(SHELL_ENTRY)
? index.specs.filter((s) => SHELL_SPEC_DIRS.includes(index.feature(s)))
: [];
const own = specsImporting(
index,
changed.filter((f) => f.startsWith('tests/e2e/')),
);
return {
files: [...new Set([...specsVisiting(index, routes), ...own, ...shell])],
feature: index.feature,
};
},
};
const runners = {
unit: (files, extra) =>
pnpm(
['exec', 'jest', ...(files ? ['--runTestsByPath', ...files] : []), ...extra],
FRONTEND,
),
storybook: (files, extra) =>
pnpm(
[
'test:storybook',
...(files ?? []).map((f) => path.relative(FRONTEND, f)),
...extra,
],
FRONTEND,
),
e2e: (files, extra) =>
pnpm(
[
'exec',
'playwright',
'test',
...(files ?? []).map((f) => path.relative(E2E, f)),
...extra,
],
E2E,
),
};
function runSuite(suite, changed, bumpReason, src, opts) {
const trigger = changed.find((f) =>
RUN_ALL[suite].some((re) => new RegExp(re).test(f)),
);
const reason = bumpReason ?? (trigger && `${trigger} affects every test`);
if (reason) {
log(`\n[${suite}] ${reason}; running the full suite.`);
return opts.list ? 0 : runners[suite](null, opts.extra).status;
}
const { files, feature } = planners[suite](src, changed);
printGroups(suite, files, feature);
if (opts.list || !files.length) {
return 0;
}
return runners[suite](files, opts.extra).status;
}
const opts = parseArgs(process.argv.slice(2));
const mergeBase = git('merge-base', opts.base, 'HEAD');
const original = changedFiles(mergeBase);
if (!original.length) {
log(`No frontend or e2e changes since ${opts.base}.`);
process.exit(0);
}
log(`Changed files since ${opts.base} (${original.length}):`);
original.forEach((f) => log(` ${f}`));
const { files: changed, reason: bumpReason } = expandBumps(original, mergeBase);
const src = changed
.filter((f) => f.startsWith('frontend/'))
.map((f) => path.join(REPO, f));
const suites = opts.suite === 'all' ? Object.keys(planners) : [opts.suite];
const failed = suites.filter(
(s) => runSuite(s, changed, bumpReason, src, opts) !== 0,
);
if (failed.length) {
log(`\nFailed: ${failed.join(', ')}`);
}
process.exit(failed.length ? 1 : 0);

View File

@@ -1,107 +0,0 @@
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import path from 'node:path';
import { REPO } from './git.mjs';
export const E2E = path.join(REPO, 'tests/e2e');
// A driver used by this many features is infrastructure; its URLs say nothing about a spec's pages.
const SHARED_FEATURE_COUNT = 5;
const feature = (spec) =>
path.relative(path.join(E2E, 'tests'), spec).split(path.sep)[0];
function listSpecs(dir = path.join(E2E, 'tests')) {
return readdirSync(dir, { withFileTypes: true }).flatMap((d) => {
const full = path.join(dir, d.name);
if (d.isDirectory()) {
return listSpecs(full);
}
return d.name.endsWith('.spec.ts') ? [full] : [];
});
}
function localImports(file) {
const body = readFileSync(file, 'utf8');
return [...body.matchAll(/(?:from|import)\s+'(\.[^']+)'/g)]
.map(([, spec]) => path.resolve(path.dirname(file), spec))
.map((base) =>
[base, `${base}.ts`, `${base}/index.ts`].find(
(f) => f.endsWith('.ts') && existsSync(f),
),
)
.filter((f) => f?.startsWith(E2E));
}
function closure(spec) {
const seen = new Set();
const visit = (f) => {
if (seen.has(f)) {
return;
}
seen.add(f);
localImports(f).forEach(visit);
};
visit(spec);
return seen;
}
function routeRegex(route, nested) {
const body = route.replace(/\/$/, '').replace(/:[^/]+/g, '[^/]+');
return new RegExp(`^${body}${nested ? '(/.*)?' : '/?'}$`);
}
// The routes a URL literal from a spec lands on; `/dashboard/` comes from `/dashboard/${id}`.
function routesFor(literal, routes) {
const probe = literal.endsWith('/') ? `${literal}x` : literal;
const exact = routes.filter((r) => routeRegex(r, false).test(probe));
if (exact.length) {
return exact;
}
const nested = routes.filter((r) => routeRegex(r, true).test(probe));
return nested.sort((a, b) => b.length - a.length).slice(0, 1);
}
export function e2eIndex(routes) {
const specs = listSpecs();
const deps = new Map(specs.map((s) => [s, closure(s)]));
const users = new Map();
for (const [spec, files] of deps) {
files.forEach((f) =>
users.set(f, new Set([...(users.get(f) ?? []), feature(spec)])),
);
}
const shared = new Set(
[...users]
.filter(([, feats]) => feats.size >= SHARED_FEATURE_COUNT)
.map(([f]) => f),
);
const specRoutes = new Map(
specs.map((spec) => {
const own = [...deps.get(spec)].filter((f) => f === spec || !shared.has(f));
const literals = own.flatMap((f) =>
[...readFileSync(f, 'utf8').matchAll(/['"`](\/[a-z][a-z0-9/_-]*)/gi)].map(
([, l]) => l,
),
);
const hit = literals
.filter((l) => !l.startsWith('/api/'))
.flatMap((l) => routesFor(l, routes));
return [spec, new Set(hit)];
}),
);
return { specs, deps, specRoutes, feature };
}
export function specsImporting(index, files) {
const abs = new Set(files.map((f) => path.join(REPO, f)));
return index.specs.filter((s) =>
[...index.deps.get(s)].some((f) => abs.has(f)),
);
}
export function specsVisiting(index, routes) {
return index.specs.filter((s) =>
routes.some((r) => index.specRoutes.get(s).has(r)),
);
}

View File

@@ -1,60 +0,0 @@
import { execFileSync, spawnSync } from 'node:child_process';
import { existsSync, readFileSync } from 'node:fs';
import path from 'node:path';
export const REPO = execFileSync('git', ['rev-parse', '--show-toplevel'], {
cwd: import.meta.dirname,
encoding: 'utf8',
}).trim();
const DEP_FIELDS = ['dependencies', 'devDependencies'];
export function git(...args) {
return execFileSync('git', args, { cwd: REPO, encoding: 'utf8' }).trim();
}
const lines = (out) => out.split('\n').filter(Boolean);
// Repo-relative paths under frontend/ and tests/e2e/ that differ from mergeBase, uncommitted included.
export function changedFiles(mergeBase) {
const scope = ['frontend', 'tests/e2e'];
const tracked = lines(git('diff', '--name-only', mergeBase, '--', ...scope));
const untracked = lines(
git('ls-files', '--others', '--exclude-standard', '--', ...scope),
);
return [...new Set([...tracked, ...untracked])].filter((f) =>
existsSync(path.join(REPO, f)),
);
}
// Changed package names, or null when anything besides dependency versions changed.
export function changedPackages(mergeBase, pkgJson) {
const before = JSON.parse(git('show', `${mergeBase}:${pkgJson}`));
const after = JSON.parse(readFileSync(path.join(REPO, pkgJson), 'utf8'));
const strip = (pkg) =>
JSON.stringify({
...pkg,
...Object.fromEntries(DEP_FIELDS.map((k) => [k, null])),
});
if (strip(before) !== strip(after)) {
return null;
}
const names = new Set(
DEP_FIELDS.flatMap((k) => Object.keys({ ...before[k], ...after[k] })),
);
return [...names].filter((n) =>
DEP_FIELDS.some((k) => before[k]?.[n] !== after[k]?.[n]),
);
}
export function importersOf(pkg, dir) {
const out = spawnSync(
'git',
['grep', '-lE', `['"]${pkg}(/[^'"]*)?['"]`, '--', dir],
{
cwd: REPO,
encoding: 'utf8',
},
).stdout;
return lines(out);
}

View File

@@ -1,30 +0,0 @@
import { spawnSync } from 'node:child_process';
import path from 'node:path';
export const FRONTEND = path.resolve(import.meta.dirname, '../..');
export function pnpm(args, cwd, stdio = 'inherit') {
return spawnSync('pnpm', args, {
cwd,
encoding: 'utf8',
stdio,
maxBuffer: 64 * 1024 * 1024,
});
}
// Absolute paths of files matching testMatch whose import graph reaches any of files.
export function relatedFiles(files, testMatch) {
if (!files.length) {
return [];
}
const match = testMatch ? ['--testMatch', ...testMatch] : [];
const res = pnpm(
['exec', 'jest', '--listTests', '--findRelatedTests', ...files, ...match],
FRONTEND,
'pipe',
);
if (res.status !== 0) {
throw new Error(`jest --listTests failed:\n${res.stderr}`);
}
return res.stdout.split('\n').filter((l) => l.startsWith('/'));
}

View File

@@ -1 +0,0 @@
export const log = (message) => process.stdout.write(`${message}\n`);

View File

@@ -1,57 +0,0 @@
import { existsSync, readFileSync } from 'node:fs';
import path from 'node:path';
import { FRONTEND } from './jestGraph.mjs';
const SRC = path.join(FRONTEND, 'src');
const read = (rel) => readFileSync(path.join(SRC, rel), 'utf8');
// Mounted around every page, so a change it reaches shows up as the shell, not as a page.
export const SHELL_ENTRY = path.join(SRC, 'container/AppLayout/index.tsx');
function resolveModule(spec) {
const base = path.join(SRC, spec);
const candidates = ['.tsx', '.ts', '/index.tsx', '/index.ts'].map(
(ext) => base + ext,
);
return candidates.find(existsSync);
}
function routePaths() {
const body = read('constants/routes.ts');
return Object.fromEntries(
[...body.matchAll(/^\s*(\w+):\s*'([^']+)'/gm)].map(([, k, v]) => [
k,
v.split('?')[0],
]),
);
}
function componentModules() {
const body = read('AppRoutes/pageComponents.ts');
const re =
/export const (\w+) = Loadable\(\s*\(\)\s*=>\s*import\(\s*(?:\/\*[\s\S]*?\*\/\s*)?'([^']+)'/g;
return Object.fromEntries(
[...body.matchAll(re)].map(([, name, spec]) => [name, resolveModule(spec)]),
);
}
// [{ file, paths }] for every page module the router mounts.
export function pageEntries() {
const paths = routePaths();
const modules = componentModules();
const byFile = new Map();
for (const [block] of read('AppRoutes/routes.ts').matchAll(/\{[^{}]*\}/g)) {
const component = block.match(/component:\s*(\w+)/)?.[1];
const pathLine = block.match(/path:\s*([^\n]+)/)?.[1] ?? '';
const file = modules[component];
if (!file) {
continue;
}
const routeKeys = [...pathLine.matchAll(/ROUTES\.(\w+)/g)]
.map(([, k]) => paths[k])
.filter(Boolean);
byFile.set(file, [...(byFile.get(file) ?? []), ...routeKeys]);
}
return [...byFile].map(([file, p]) => ({ file, paths: [...new Set(p)] }));
}

View File

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

View File

@@ -14681,16 +14681,6 @@ export interface SpantypesSpanDTO {
* @description All of them for a span read by ID; the selected ones in a list.
*/
attributes: SpantypesSpanDTOAttributes;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
db_name?: string;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
db_operation?: string;
/**
* @type integer
* @minimum 0
@@ -14701,35 +14691,10 @@ export interface SpantypesSpanDTO {
* @description All of them for a span read by ID; none in a list.
*/
events: SpantypesEventDTO[];
/**
* @type string
* @description Method of an outgoing HTTP call. Omitted when empty, and in a list unless selected.
*/
external_http_method?: string;
/**
* @type string
* @description Host of an outgoing HTTP call. Omitted when empty, and in a list unless selected.
*/
external_http_url?: string;
/**
* @type boolean
*/
has_error: boolean;
/**
* @type string
* @description Host or server address. Omitted when empty, and in a list unless selected.
*/
http_host?: string;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
http_method?: string;
/**
* @type string
* @description Omitted when empty, and in a list unless selected.
*/
http_url?: string;
/**
* @type string
* @description For example Server, Client or Internal.
@@ -14759,10 +14724,6 @@ export interface SpantypesSpanDTO {
* @description HTTP or gRPC status code, for example 404.
*/
response_status_code: string;
/**
* @description Instrumentation scope. Omitted when empty, and in a list unless selected.
*/
scope?: SpantypesScopeDTO;
/**
* @type string
*/
@@ -14786,11 +14747,6 @@ export interface SpantypesSpanDTO {
* @type string
*/
trace_id: string;
/**
* @type string
* @description W3C trace state. Omitted when empty, and in a list unless selected.
*/
trace_state?: string;
}
export interface SpantypesSpanTextMatchDTO {

View File

@@ -1,6 +1,7 @@
import { ApiV5Instance } from 'api';
import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';
import { AxiosError } from 'axios';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';
import {
MetricRangePayloadV5,
@@ -16,10 +17,24 @@ import {
*/
export const getQueryRangeV5 = async (
props: QueryRangePayloadV5,
version: string,
signal?: AbortSignal,
headers?: Record<string, string>,
): Promise<SuccessResponseV2<MetricRangePayloadV5>> => {
try {
if (version && version === ENTITY_VERSION_V5) {
const response = await ApiV5Instance.post('/query_range', props, {
signal,
headers,
});
return {
httpStatusCode: response.status,
data: response.data,
};
}
// Default V5 behavior
const response = await ApiV5Instance.post('/query_range', props, {
signal,
headers,
@@ -27,7 +42,7 @@ export const getQueryRangeV5 = async (
return {
httpStatusCode: response.status,
data: response.data,
data: response.data.data,
};
} catch (error) {
ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);

View File

@@ -7,6 +7,7 @@ import { useAppLocation } from 'lib/router/useAppLocation';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { ViewMenuAction } from 'container/WidgetCard/config';
import { ENTITY_VERSION_V5 } from 'constants/app';
import GridCard from 'container/WidgetCard/Card';
import { Card } from 'container/WidgetCard/styles';
import { useIsDarkMode } from 'hooks/useDarkMode';
@@ -178,6 +179,7 @@ function CeleryTaskBar({
{barState === CeleryTaskState.All && (
<GridCard
widget={celeryAllStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
@@ -199,6 +201,7 @@ function CeleryTaskBar({
{barState === CeleryTaskState.Failed && (
<GridCard
widget={celeryFailedStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
@@ -219,6 +222,7 @@ function CeleryTaskBar({
{barState === CeleryTaskState.Retry && (
<GridCard
widget={celeryRetryStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
@@ -239,6 +243,7 @@ function CeleryTaskBar({
{barState === CeleryTaskState.Successful && (
<GridCard
widget={celerySuccessStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}

View File

@@ -1,6 +1,7 @@
import { useCallback, useMemo } from 'react';
// eslint-disable-next-line no-restricted-imports
import { useDispatch } from 'react-redux';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { navigate } from 'lib/router/navigation';
import { useAppLocation } from 'lib/router/useAppLocation';
import { QueryParams } from 'constants/query';
@@ -136,6 +137,7 @@ function CeleryTaskGraph({
isQueryEnabled={queryEnabled}
openTracesButton={openTracesButton}
onOpenTraceBtnClick={onOpenTraceBtnClick}
version={ENTITY_VERSION_V5}
customErrorMessage={customErrorMessage}
start={start}
end={end}

View File

@@ -9,6 +9,7 @@ import logEvent from 'api/common/logEvent';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { ViewMenuAction } from 'container/WidgetCard/config';
import { ENTITY_VERSION_V5 } from 'constants/app';
import GridCard from 'container/WidgetCard/Card';
import { Card } from 'container/WidgetCard/styles';
import { Button } from 'container/MetricsApplication/Tabs/styles';
@@ -201,6 +202,7 @@ function CeleryTaskLatencyGraph({
</Button>
<GridCard
widget={updatedWidgetData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={onGraphClick('Celery_p99_latency')}
@@ -222,6 +224,7 @@ function CeleryTaskLatencyGraph({
</Button>
<GridCard
widget={updatedWidgetData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={onGraphClick('Celery_p95_latency')}
@@ -242,6 +245,7 @@ function CeleryTaskLatencyGraph({
</Button>
<GridCard
widget={updatedWidgetData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={onGraphClick('Celery_p90_latency')}

View File

@@ -2,6 +2,7 @@ import { useCallback } from 'react';
import { useQueries } from 'react-query';
// eslint-disable-next-line no-restricted-imports
import { useSelector } from 'react-redux';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
import {
@@ -41,9 +42,9 @@ export const useGetValueFromWidget = (
const queries = useQueries(
queryPayloads().map((payload) => ({
queryKey: [...queryKey, payload],
queryKey: [...queryKey, payload, ENTITY_VERSION_V5],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload),
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
enabled: !!payload,
})),
);

View File

@@ -21,4 +21,9 @@
line-height: var(--paragraph-small-400-line-height);
margin: 0;
}
&__helper {
color: var(--l3-foreground);
margin: calc(var(--spacing-2) * -1) 0 var(--spacing-4) 0;
}
}

View File

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

View File

@@ -1,21 +0,0 @@
import { Fragment } from 'react';
import type { HeaderAction } from './DetailsHeader';
import styles from './HeaderActions.module.scss';
interface HeaderActionsProps {
actions: HeaderAction[];
}
function HeaderActions({ actions }: HeaderActionsProps): JSX.Element {
return (
<div className={styles.actions}>
{actions.map((action) => (
<Fragment key={action.key}>{action.component}</Fragment>
))}
</div>
);
}
export default HeaderActions;

View File

@@ -1,6 +1,4 @@
import { Drawer } from '@signozhq/ui/drawer';
import type { HeaderAction } from 'components/DetailsPanel/DetailsHeader/DetailsHeader';
import HeaderActions from 'components/DetailsPanel/DetailsHeader/HeaderActions';
import { LogDetailProps } from './LogDetail.interfaces';
import LogDetailBody from './LogDetailBody';
@@ -36,34 +34,6 @@ function LogDetail({
const title = useLogTimestamp(shownLog);
const headerActions: HeaderAction[] = [
...(shownLog
? [
{
key: 'log-actions',
component: (
<LogActions
log={shownLog}
showOpenInExplorer={!!handleOpenInExplorer}
onOpenInExplorer={handleOpenInExplorer}
/>
),
},
]
: []),
{
key: 'navigation',
component: (
<LogNavigation
onNavigatePrev={goToPrev}
onNavigateNext={goToNext}
isPrevDisabled={isPrevDisabled}
isNextDisabled={isNextDisabled}
/>
),
},
];
return (
<Drawer
type="inspector"
@@ -73,7 +43,23 @@ function LogDetail({
title={title}
width="extra-wide"
closePosition="start"
headerSuffix={<HeaderActions actions={headerActions} />}
headerSuffix={
<>
{shownLog && (
<LogActions
log={shownLog}
showOpenInExplorer={!!handleOpenInExplorer}
onOpenInExplorer={handleOpenInExplorer}
/>
)}
<LogNavigation
onNavigatePrev={goToPrev}
onNavigateNext={goToNext}
isPrevDisabled={isPrevDisabled}
isNextDisabled={isNextDisabled}
/>
</>
}
testId="log-detail-drawer"
>
{shownLog && (

View File

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

View File

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

View File

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

View File

@@ -15,7 +15,6 @@ import {
} from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';
import { Button } from 'antd';
import { Typography } from '@signozhq/ui/typography';
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
import { GripVertical } from '@signozhq/icons';
import { TelemetryFieldKey } from 'types/api/v5/queryRange';
@@ -47,17 +46,7 @@ function SortableFilter({
>
<div {...attributes} {...listeners} className="drag-handle">
{allowDrag && <GripVertical size={16} />}
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
display="block"
textOverflow="ellipsis"
>
{filter.name}
</Typography>
{filter.name}
</div>
{allowRemove && (
<Button

View File

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

View File

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

View File

@@ -90,35 +90,6 @@ export const handlers = [
fieldValuesHandler(['checkout', 'frontend', 'payments']),
];
const LONG_FILTER_NAME =
'gen_ai.response.tool_calls.0.tool_call.function.arguments';
/** One added and one other filter whose names are wider than the settings panel. */
export const longFilterNameHandlers = [
rest.get('http://localhost/api/v2/quick_filters/logs', (_req, res, ctx) =>
res(
ctx.status(200),
ctx.json(
quickFiltersResponse(QuickfiltertypesSourceDTO.logs, [
...customFilters,
{
name: LONG_FILTER_NAME,
fieldDataType: TelemetrytypesFieldDataTypeDTO.string,
fieldContext: TelemetrytypesFieldContextDTO.attribute,
},
]),
),
),
),
rest.get('http://localhost/api/v1/fields/keys', (_req, res, ctx) =>
res(
ctx.status(200),
ctx.json(fieldKeysResponse([`${LONG_FILTER_NAME}.raw`])),
),
),
...handlers,
];
export const noSavedFiltersHandler = rest.get(
'http://localhost/api/v2/quick_filters/logs',
(_req, res, ctx) =>

View File

@@ -11,7 +11,6 @@ import {
hoverTruncatedTitle,
openQueryPicker,
openSettings,
showsLongFilterNames,
} from './__story_mockdata__/quickFilters.play';
import {
checkboxConfig,
@@ -20,7 +19,6 @@ import {
handlers,
LONG_FILTER_VALUES,
loadingFiltersHandlers,
longFilterNameHandlers,
longTitleConfig,
MANY_FILTER_VALUES,
queryBuilder,
@@ -67,12 +65,6 @@ export const SettingsOpen: GlobalArgsStory = {
play: openSettings,
};
/** Settings with filter names wider than the panel: each name is cut with an ellipsis and its action stays in view. */
export const SettingsLongFilterNames: GlobalArgsStory = {
parameters: { msw: { handlers: longFilterNameHandlers } },
play: showsLongFilterNames,
};
/** Mutation: changing the settings list reveals the fixed save and discard footer. */
export const SettingsDirtyFooter: GlobalArgsStory = {
play: dirtySettings,

View File

@@ -64,32 +64,6 @@ export const dirtySettings = async (context: PlayContext): Promise<void> => {
await screen.findByRole('button', { name: 'Save changes' });
};
/** Every Add and Remove sits inside its list: a long name is cut, not scrolled. */
export const showsLongFilterNames = async (
context: PlayContext,
): Promise<void> => {
if (!canManageQuickFilters(context.args)) {
return;
}
await openSettings(context);
await Promise.all(
['quick-filters-added', 'quick-filters-other'].map(async (testId) => {
const list = await screen.findByTestId(testId);
const actions = await within(list).findAllByRole(
'button',
{ name: /^(Add|Remove)$/ },
UNTIL_LOADED,
);
const listRight = list.getBoundingClientRect().right;
actions.forEach((action) => {
expect(action.getBoundingClientRect().right).toBeLessThanOrEqual(listRight);
});
}),
);
};
export const hoverTruncatedTitle = async ({
canvasElement,
args,

View File

@@ -18,6 +18,18 @@
letter-spacing: -0.07px;
}
&__input {
height: 32px;
background: var(--l2-background);
border-color: var(--l1-border);
color: var(--l1-foreground);
box-shadow: none;
&::placeholder {
color: var(--l3-foreground);
}
}
&__datepicker {
width: 100%;
height: 32px;
@@ -88,4 +100,11 @@
text-transform: uppercase;
margin-bottom: var(--spacing-4);
}
&__learn-more {
display: inline-flex;
align-items: center;
gap: var(--spacing-1);
color: var(--primary);
}
}

View File

@@ -1,6 +1,7 @@
import { useCallback, useEffect, useMemo } from 'react';
import QuerySearch from 'components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch';
import { combineInitialAndUserExpression } from 'components/QueryBuilderV2/QueryV2/QuerySearch/utils';
import { ENTITY_VERSION_V5 } from 'constants/app';
import {
getAllEndpointsWidgetData,
getGroupByExpressionFromRowData,
@@ -155,6 +156,7 @@ function AllEndPoints({
customOnDragSelect={(): void => {}}
customTimeRange={timeRange}
customOnRowClick={onRowClick}
version={ENTITY_VERSION_V5}
/>
</div>
</div>

View File

@@ -2,6 +2,7 @@ import { useCallback, useMemo } from 'react';
import { useQueries } from 'react-query';
import QuerySearch from 'components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch';
import { combineInitialAndUserExpression } from 'components/QueryBuilderV2/QueryV2/QuerySearch/utils';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import {
END_POINT_DETAILS_QUERY_KEYS_ARRAY,
@@ -92,9 +93,13 @@ function EndPointDetails({
const endPointDetailsDataQueries = useQueries(
endPointDetailsQueryPayload.map((payload, index) => ({
queryKey: [END_POINT_DETAILS_QUERY_KEYS_ARRAY[index], payload],
queryKey: [
END_POINT_DETAILS_QUERY_KEYS_ARRAY[index],
payload,
ENTITY_VERSION_V5,
],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload),
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
enabled: !!payload,
// Keeps the table's rows, and so its height, while a new filter loads
keepPreviousData:

View File

@@ -9,6 +9,7 @@ import { MetricRangePayloadV5, ScalarData } from 'api/v5/v5';
import { useNavigateToExplorer } from 'components/CeleryTask/useNavigateToExplorer';
import { combineInitialAndUserExpression } from 'components/QueryBuilderV2/QueryV2/QuerySearch/utils';
import { withErrorBoundary } from 'components/ErrorBoundaryHOC';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import {
formatTopErrorsDataForTable,
@@ -75,12 +76,13 @@ function TopErrors({
queryKey: [
REACT_QUERY_KEY.GET_TOP_ERRORS_BY_DOMAIN,
queryPayload,
ENTITY_VERSION_V5,
showStatusCodeErrors,
],
queryFn: ({
signal,
}: QueryFunctionContext): Promise<SuccessResponseV2<MetricRangePayloadV5>> =>
getQueryRangeV5(queryPayload, signal),
getQueryRangeV5(queryPayload, ENTITY_VERSION_V5, signal),
enabled: !!queryPayload,
staleTime: 0,
cacheTime: 0,

View File

@@ -1,9 +1,8 @@
import { QueryClient, QueryClientProvider } from 'react-query';
import { render, screen, waitFor } from 'tests/test-utils';
import { TraceAggregation } from 'api/v5/v5';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
import { MetricQueryRangeSuccessResponse } from 'types/api/metrics/getQueryRange';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
import { SPAN_ATTRIBUTES } from '../constants';
import DomainMetrics from './DomainMetrics';
@@ -13,33 +12,6 @@ jest.mock('lib/dashboard/getQueryResults', () => ({
GetMetricQueryRange: jest.fn(),
}));
const mockGetMetricQueryRange = jest.mocked(GetMetricQueryRange);
const buildResponse = (
rows: { data: Record<string, string> }[],
): MetricQueryRangeSuccessResponse => ({
statusCode: 200,
message: 'success',
error: null,
payload: {
data: {
resultType: '',
newResult: { data: { result: [], resultType: '' } },
result: [
{ queryName: 'A', metric: {}, values: [], table: { rows, columns: [] } },
],
},
},
});
const findQuery = (queryData: IBuilderQuery[], name: string): IBuilderQuery => {
const query = queryData.find((q) => q.queryName === name);
if (!query) {
throw new Error(`Query ${name} missing from the payload`);
}
return query;
};
// Mock ErrorState component
jest.mock('./ErrorState', () => ({
__esModule: true,
@@ -64,16 +36,30 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
domainListFilterExpression: '',
};
const mockSuccessResponse = buildResponse([
{
const mockSuccessResponse = {
statusCode: 200,
error: null,
payload: {
data: {
A: '150',
B: '125000000',
D: '2021-01-01T23:00:00Z',
F1: '5.5',
result: [
{
table: {
rows: [
{
data: {
A: '150',
B: '125000000',
D: '2021-01-01T23:00:00Z',
F1: '5.5',
},
},
],
},
},
],
},
},
]);
};
beforeEach(() => {
queryClient = new QueryClient({
@@ -100,7 +86,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
describe('1. V5 Query Payload with Filters', () => {
it('sends correct V5 payload structure with domain name filters', async () => {
mockGetMetricQueryRange.mockResolvedValue(mockSuccessResponse);
(GetMetricQueryRange as jest.Mock).mockResolvedValue(mockSuccessResponse);
renderComponent();
@@ -108,7 +94,10 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
expect(GetMetricQueryRange).toHaveBeenCalledTimes(1);
});
const [payload] = mockGetMetricQueryRange.mock.calls[0];
const [payload, version] = (GetMetricQueryRange as jest.Mock).mock.calls[0];
// Verify it's using V5
expect(version).toBe(ENTITY_VERSION_V5);
// Verify time range
expect(payload.start).toBe(1758259531000);
@@ -122,60 +111,64 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
const queryData = payload.query.builder.queryData;
// Verify Query A - count with URL filter
const queryA = findQuery(queryData, 'A');
const queryA = queryData.find((q: any) => q.queryName === 'A');
expect(queryA).toBeDefined();
expect(queryA.dataSource).toBe('traces');
expect(queryA.aggregations?.[0]).toBeDefined();
expect((queryA.aggregations?.[0] as TraceAggregation)?.expression).toBe(
'count()',
);
// Verify exact domain filter expression structure
expect(queryA.filter?.expression).toContain("http_host = '0.0.0.0'");
expect(queryA.filter?.expression).toContain(
expect(queryA.filter.expression).toContain("http_host = '0.0.0.0'");
expect(queryA.filter.expression).toContain(
`${SPAN_ATTRIBUTES.HTTP_URL} EXISTS`,
);
// Verify Query B - p99 latency
const queryB = findQuery(queryData, 'B');
const queryB = queryData.find((q: any) => q.queryName === 'B');
expect(queryB).toBeDefined();
expect(queryB.aggregateOperator).toBe('p99');
expect(queryB.aggregations?.[0]).toBeDefined();
expect((queryB.aggregations?.[0] as TraceAggregation)?.expression).toBe(
'p99(duration_nano)',
);
// Verify exact domain filter expression structure
expect(queryB.filter?.expression).toContain("http_host = '0.0.0.0'");
expect(queryB.filter.expression).toContain("http_host = '0.0.0.0'");
// Verify Query C - error count (disabled)
const queryC = findQuery(queryData, 'C');
const queryC = queryData.find((q: any) => q.queryName === 'C');
expect(queryC).toBeDefined();
expect(queryC.disabled).toBe(true);
expect(queryC.filter?.expression).toContain("http_host = '0.0.0.0'");
expect(queryC.filter.expression).toContain("http_host = '0.0.0.0'");
expect(queryC.aggregations?.[0]).toBeDefined();
expect((queryC.aggregations?.[0] as TraceAggregation)?.expression).toBe(
'count()',
);
expect(queryC.filter?.expression).toContain('has_error = true');
expect(queryC.filter.expression).toContain('has_error = true');
// Verify Query D - max timestamp
const queryD = findQuery(queryData, 'D');
const queryD = queryData.find((q: any) => q.queryName === 'D');
expect(queryD).toBeDefined();
expect(queryD.aggregateOperator).toBe('max');
expect(queryD.aggregations?.[0]).toBeDefined();
expect((queryD.aggregations?.[0] as TraceAggregation)?.expression).toBe(
'max(timestamp)',
);
// Verify exact domain filter expression structure
expect(queryD.filter?.expression).toContain("http_host = '0.0.0.0'");
expect(queryD.filter.expression).toContain("http_host = '0.0.0.0'");
// Verify Formula F1 - error rate calculation
const formulas = payload.query.builder.queryFormulas;
expect(formulas).toBeDefined();
expect(formulas.length).toBeGreaterThan(0);
const formulaF1 = formulas.find((f) => f.queryName === 'F1');
const formulaF1 = formulas.find((f: any) => f.queryName === 'F1');
expect(formulaF1).toBeDefined();
expect(formulaF1?.expression).toBe('(C/A)*100');
expect(formulaF1.expression).toBe('(C/A)*100');
});
it('includes custom filters in filter expressions', async () => {
mockGetMetricQueryRange.mockResolvedValue(mockSuccessResponse);
(GetMetricQueryRange as jest.Mock).mockResolvedValue(mockSuccessResponse);
const customFilterExpression =
"service.name = 'my-service' AND deployment.environment = 'production'";
@@ -189,21 +182,24 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
expect(GetMetricQueryRange).toHaveBeenCalled();
});
const [payload] = mockGetMetricQueryRange.mock.calls[0];
const [payload] = (GetMetricQueryRange as jest.Mock).mock.calls[0];
const queryData = payload.query.builder.queryData;
// Verify all queries include the custom filters
const expressions = queryData.map((query) => query.filter?.expression);
expect(expressions).toHaveLength(4);
expressions.forEach((expression) => {
expect(expression).toContain(customFilterExpression);
queryData.forEach((query: any) => {
if (query.filter && query.filter.expression) {
expect(query.filter.expression).toContain('service.name');
expect(query.filter.expression).toContain('my-service');
expect(query.filter.expression).toContain('deployment.environment');
expect(query.filter.expression).toContain('production');
}
});
});
});
describe('2. Data Display State', () => {
it('displays metrics when data is successfully loaded', async () => {
mockGetMetricQueryRange.mockResolvedValue(mockSuccessResponse);
(GetMetricQueryRange as jest.Mock).mockResolvedValue(mockSuccessResponse);
renderComponent();
@@ -224,9 +220,23 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
describe('3. Empty/Missing Data State', () => {
it('displays "-" for missing data values', async () => {
const emptyResponse = buildResponse([]);
const emptyResponse = {
statusCode: 200,
error: null,
payload: {
data: {
result: [
{
table: {
rows: [],
},
},
],
},
},
};
mockGetMetricQueryRange.mockResolvedValue(emptyResponse);
(GetMetricQueryRange as jest.Mock).mockResolvedValue(emptyResponse);
renderComponent();
@@ -238,7 +248,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
describe('4. Error State', () => {
it('displays error state when API call fails', async () => {
mockGetMetricQueryRange.mockRejectedValue(new Error('API Error'));
(GetMetricQueryRange as jest.Mock).mockRejectedValue(new Error('API Error'));
renderComponent();
@@ -251,7 +261,7 @@ describe('DomainMetrics - V5 Query Payload Tests', () => {
it('retries API call when retry button is clicked', async () => {
let callCount = 0;
mockGetMetricQueryRange.mockImplementation(() => {
(GetMetricQueryRange as jest.Mock).mockImplementation(() => {
callCount += 1;
if (callCount === 1) {
return Promise.reject(new Error('API Error'));

View File

@@ -3,6 +3,7 @@ import { useQueries } from 'react-query';
import { Skeleton, Tooltip } from 'antd';
import { Progress } from '@signozhq/ui/progress';
import { Typography } from '@signozhq/ui/typography';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import {
DomainMetricsResponseRow,
@@ -40,9 +41,13 @@ function DomainMetrics({
// Since only one query here
const domainMetricsDataQueries = useQueries(
queryPayloads.map((payload) => ({
queryKey: [REACT_QUERY_KEY.GET_DOMAIN_METRICS_DATA, payload],
queryKey: [
REACT_QUERY_KEY.GET_DOMAIN_METRICS_DATA,
payload,
ENTITY_VERSION_V5,
],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload),
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
enabled: !!payload,
staleTime: 60 * 1000, // 1 minute stale time : optimize this part
})),

View File

@@ -1,6 +1,7 @@
import { useMemo } from 'react';
import { useQuery } from 'react-query';
import { Combobox, type ComboboxItemType } from '@signozhq/ui/combobox';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import {
getEndPointDropDownQueryPayload,
@@ -43,8 +44,12 @@ function EndPointPicker({
);
const { data, isLoading, isFetching } = useQuery({
queryKey: [REACT_QUERY_KEY.GET_ENDPOINT_DROPDOWN_DATA, payload],
queryFn: () => GetMetricQueryRange(payload),
queryKey: [
REACT_QUERY_KEY.GET_ENDPOINT_DROPDOWN_DATA,
payload,
ENTITY_VERSION_V5,
],
queryFn: () => GetMetricQueryRange(payload, ENTITY_VERSION_V5),
staleTime: 60 * 1000,
});

View File

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

View File

@@ -8,6 +8,7 @@ import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import QueryCancelledPlaceholder from 'components/QueryCancelledPlaceholder';
import Spinner from 'components/Spinner';
import WarningPopover from 'components/WarningPopover/WarningPopover';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { QueryParams } from 'constants/query';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
@@ -176,6 +177,7 @@ function ChartPreview({
},
originalGraphType: graphType,
},
ENTITY_VERSION_V5,
{
queryKey: [
REACT_QUERY_KEY.ALERT_RULES_CHART_PREVIEW,

View File

@@ -20,6 +20,7 @@ import Header from 'components/Header/Header';
import HeaderRightSection from 'components/HeaderRightSection/HeaderRightSection';
import NoAuthBanner from 'components/NoAuthBanner/NoAuthBanner';
import { getIsNoAuthMode } from 'utils/noAuthMode';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { ORG_PREFERENCES } from 'constants/orgPreferences';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
@@ -101,6 +102,7 @@ export default function Home(): JSX.Element {
},
formatForWeb: false,
},
ENTITY_VERSION_V5,
{
queryKey: [
REACT_QUERY_KEY.GET_QUERY_RANGE,
@@ -125,6 +127,7 @@ export default function Home(): JSX.Element {
},
formatForWeb: false,
},
ENTITY_VERSION_V5,
{
queryKey: [
REACT_QUERY_KEY.GET_QUERY_RANGE,

View File

@@ -4,6 +4,7 @@ import { QueryKey } from 'react-query';
import { useSelector } from 'react-redux';
import { Button, Select, Skeleton, Table } from 'antd';
import logEvent from 'api/common/logEvent';
import { ENTITY_VERSION_V5 } from 'constants/app';
import ROUTES from 'constants/routes';
import {
getQueryRangeRequestData,
@@ -225,23 +226,27 @@ function ServiceMetrics({
[globalSelectedInterval, topLevelOperations],
);
const dataQueries = useGetQueriesRange(queryRangeRequestData, {
queryKey: useMemo(
() => [
`GetMetricsQueryRange-home-${globalSelectedInterval}`,
timeRange.endTime,
timeRange.startTime,
globalSelectedInterval,
],
[globalSelectedInterval, timeRange.endTime, timeRange.startTime],
),
keepPreviousData: true,
enabled: true,
refetchOnMount: false,
onError: () => {
setIsError(true);
const dataQueries = useGetQueriesRange(
queryRangeRequestData,
ENTITY_VERSION_V5,
{
queryKey: useMemo(
() => [
`GetMetricsQueryRange-home-${globalSelectedInterval}`,
timeRange.endTime,
timeRange.startTime,
globalSelectedInterval,
],
[globalSelectedInterval, timeRange.endTime, timeRange.startTime],
),
keepPreviousData: true,
enabled: true,
refetchOnMount: false,
onError: () => {
setIsError(true);
},
},
});
);
const isLoading = useMemo(
() => dataQueries.some((query) => query.isLoading),

View File

@@ -1,5 +1,6 @@
import { useCallback, useMemo } from 'react';
import { useQuery, useQueryClient } from 'react-query';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
import { ILog } from 'types/api/logs/log';
@@ -76,7 +77,7 @@ export function useEntityEvents({
offset,
pageSize,
});
return GetMetricQueryRange(query, undefined, signal);
return GetMetricQueryRange(query, ENTITY_VERSION_V5, undefined, signal);
},
enabled: !!expression?.trim(),
});

View File

@@ -1,5 +1,6 @@
import { useCallback, useMemo } from 'react';
import { useInfiniteQuery, useQueryClient } from 'react-query';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { DEFAULT_PER_PAGE_VALUE } from 'container/Controls/config';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
@@ -62,7 +63,7 @@ export function useInfiniteEntityLogs({
offset: pageParam as number,
pageSize: DEFAULT_PER_PAGE_VALUE,
});
return GetMetricQueryRange(query, undefined, signal);
return GetMetricQueryRange(query, ENTITY_VERSION_V5, undefined, signal);
},
getNextPageParam: (lastPage, allPages) => {
const list = lastPage?.payload?.data?.newResult?.data?.result?.[0]?.list;

View File

@@ -1,5 +1,6 @@
import { useMemo } from 'react';
import { QueryFunctionContext, useQueries, UseQueryResult } from 'react-query';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { InfraMonitoringEntity } from 'container/InfraMonitoringK8sV2/constants';
@@ -50,12 +51,18 @@ export function useEntityMetrics<T>({
const queries = useQueries(
queryPayloads.map((payload, index) => ({
// TODO: remove AUTO_REFRESH_QUERY when migrating to date time selection v3
queryKey: [REACT_QUERY_KEY.AUTO_REFRESH_QUERY, queryKey, payload, category],
queryKey: [
REACT_QUERY_KEY.AUTO_REFRESH_QUERY,
queryKey,
payload,
ENTITY_VERSION_V5,
category,
],
queryFn: ({
signal,
}: QueryFunctionContext): Promise<
SuccessResponse<MetricRangePayloadProps>
> => GetMetricQueryRange(payload, undefined, signal),
> => GetMetricQueryRange(payload, ENTITY_VERSION_V5, undefined, signal),
enabled: !!payload && visibilities[index],
keepPreviousData: true,
})),

View File

@@ -1,5 +1,6 @@
import { useCallback, useMemo } from 'react';
import { useQuery, useQueryClient } from 'react-query';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
@@ -67,7 +68,7 @@ export function useEntityTraces({
offset,
pageSize,
});
return GetMetricQueryRange(query, undefined, signal);
return GetMetricQueryRange(query, ENTITY_VERSION_V5, undefined, signal);
},
enabled: !!expression?.trim(),
});

View File

@@ -14,6 +14,7 @@ import logEvent from 'api/common/logEvent';
import ListViewOrderBy from 'components/OrderBy/ListViewOrderBy';
import { SavedviewtypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
import type { TableColumnDef } from 'components/TanStackTableView/types';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { LOCALSTORAGE } from 'constants/localStorage';
import { QueryParams } from 'constants/query';
import { initialQueryAIWithType, PANEL_TYPES } from 'constants/queryBuilder';
@@ -144,6 +145,7 @@ function ListView({
selectColumns,
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled:

View File

@@ -12,6 +12,7 @@ import { useSelector } from 'react-redux';
import Space from 'periscope/components/Space/Space';
import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import ExportMenu from 'components/ExportMenu/ExportMenu';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { QueryTable } from 'container/QueryTable';
@@ -70,6 +71,7 @@ function TableView({
dataSource: 'traces',
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled: !!stagedQuery && panelType === PANEL_TYPES.TABLE,

View File

@@ -8,6 +8,7 @@ import {
import { QueryKey } from 'react-query';
// eslint-disable-next-line no-restricted-imports
import { useSelector } from 'react-redux';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import TimeSeriesView from 'container/TimeSeriesView/TimeSeriesView';
@@ -88,6 +89,7 @@ function TimeSeriesViewContainer({
dataSource,
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled: !!stagedQuery && panelType === PANEL_TYPES.TIME_SERIES,

View File

@@ -14,6 +14,7 @@ import logEvent from 'api/common/logEvent';
import ListViewOrderBy from 'components/OrderBy/ListViewOrderBy';
import { SavedviewtypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
import type { TableColumnDef } from 'components/TanStackTableView/types';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { LOCALSTORAGE } from 'constants/localStorage';
import { QueryParams } from 'constants/query';
import { initialQueryAIWithType, PANEL_TYPES } from 'constants/queryBuilder';
@@ -139,6 +140,7 @@ function TracesView({
pagination: paginationQueryData,
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled: !!stagedQuery && panelType === PANEL_TYPES.TRACE,

View File

@@ -1,4 +1,5 @@
import { useMemo } from 'react';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { LIVE_TAIL_GRAPH_INTERVAL } from 'constants/liveTail';
import { PANEL_TYPES } from 'constants/queryBuilder';
import LogsExplorerChart from 'container/LogsExplorerChart';
@@ -56,6 +57,7 @@ function LiveLogsListChart({
const { data, isFetching } = useGetExplorerQueryRange(
listChartQuery,
PANEL_TYPES.TIME_SERIES,
ENTITY_VERSION_V5,
{
enabled: isConnectionOpen,
refetchInterval: LIVE_TAIL_GRAPH_INTERVAL,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -12,6 +12,7 @@ import { useSelector } from 'react-redux';
import Space from 'periscope/components/Space/Space';
import ErrorInPlace from 'components/ErrorInPlace/ErrorInPlace';
import ExportMenu from 'components/ExportMenu/ExportMenu';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { QueryTable } from 'container/QueryTable';
@@ -70,6 +71,7 @@ function TableView({
dataSource: 'traces',
},
},
ENTITY_VERSION_V5,
{
queryKey,
enabled: !!stagedQuery && panelType === PANEL_TYPES.TABLE,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,6 +2,7 @@ import { MutableRefObject, useMemo } from 'react';
import { UseQueryOptions, UseQueryResult } 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 { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
@@ -16,6 +17,7 @@ import { useQueryBuilder } from './useQueryBuilder';
export const useGetExplorerQueryRange = (
requestData: Query | null,
panelType: PANEL_TYPES | null,
version: string,
options?: UseQueryOptions<MetricQueryRangeSuccessResponse, Error>,
params?: Record<string, unknown>,
isDependentOnQB = true,
@@ -59,6 +61,8 @@ export const useGetExplorerQueryRange = (
query: requestData || initialQueriesMap.metrics,
params,
},
// version,
ENTITY_VERSION_V5,
{
...options,
queryKey: [key, globalSelectedInterval, requestData, minTime, maxTime],

View File

@@ -15,6 +15,7 @@ import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
export const useGetQueriesRange = (
requestData: GetQueryResultsProps[],
version: string,
options: UseQueryOptions<SuccessResponse<MetricRangePayloadProps>, Error>,
): UseQueryResult<SuccessResponse<MetricRangePayloadProps>, Error>[] => {
const queryKey = useMemo(() => {
@@ -26,7 +27,7 @@ export const useGetQueriesRange = (
const queryData = requestData.map((request, index) => ({
queryFn: async (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(request),
GetMetricQueryRange(request, version),
...options,
queryKey: [...queryKey, index] as QueryKey,
}));

View File

@@ -22,12 +22,14 @@ type UseGetQueryRangeOptions = UseQueryOptions<
type UseGetQueryRange = (
requestData: GetQueryResultsProps,
version: string,
options?: UseGetQueryRangeOptions,
headers?: Record<string, string>,
) => UseQueryResult<MetricQueryRangeSuccessResponse, Error>;
export const useGetQueryRange: UseGetQueryRange = (
requestData,
version,
options,
headers,
) => {
@@ -148,6 +150,7 @@ export const useGetQueryRange: UseGetQueryRange = (
queryFn: async ({ signal }) =>
GetMetricQueryRange(
modifiedRequestData,
version,
dashboardDynamicVariables,
signal,
headers,

View File

@@ -1,6 +1,7 @@
import { useEffect, useMemo, useState } from 'react';
// eslint-disable-next-line no-restricted-imports
import { useSelector } from 'react-redux';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { QueryParams } from 'constants/query';
import {
initialQueryBuilderFormValues,
@@ -140,6 +141,7 @@ export const useLogsData = ({
const { data, isFetching } = useGetExplorerQueryRange(
requestData,
panelType,
ENTITY_VERSION_V5,
{
keepPreviousData: true,
enabled: !isLimit && !!requestData,

View File

@@ -2,3 +2,7 @@
box-sizing: border-box;
width: 100%;
}
.permission {
color: var(--l2-foreground);
}

View File

@@ -88,3 +88,8 @@
align-items: center;
gap: var(--spacing-2);
}
.count {
flex: 0 0 auto;
white-space: nowrap;
}

View File

@@ -47,6 +47,15 @@
--typography-color: var(--accent-primary);
}
.separator {
flex: 0 0 auto;
}
.object {
flex: 0 1 auto;
min-width: 0;
}
.permissionMeta {
display: flex;
flex: 0 0 auto;

View File

@@ -14,6 +14,11 @@ export type ObservedPermission = {
lastSeen: number;
};
export type PermissionOverride = {
permission: BrandedPermission;
state: OverrideState;
};
export type AuthZDevStore = {
isModalOpen: boolean;
observed: Record<string, ObservedPermission>;

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