mirror of
https://github.com/SigNoz/signoz.git
synced 2026-05-12 21:20:30 +01:00
Compare commits
2 Commits
main
...
chore/deps
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ea98ba8f2 | ||
|
|
13c9f7abcd |
@@ -1,19 +0,0 @@
|
||||
---
|
||||
description: Prefer SigNoz UI and icons across frontend code
|
||||
globs: **/*.{ts,tsx,js,jsx}
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# UI Components and Icons Source of Truth
|
||||
|
||||
For all frontend implementation work in this repository:
|
||||
|
||||
- Always use UI primitives/components from `@signozhq/ui`.
|
||||
- Always use icons from `@signozhq/icons`.
|
||||
- Do not introduce new usage of icon libraries directly (for example `lucide-react`) in app code.
|
||||
- Do not mix multiple component systems for the same UI surface when an equivalent exists in `@signozhq/ui`.
|
||||
|
||||
## Migration guidance
|
||||
|
||||
- If touching a file that already uses non-`@signozhq/icons` icons, prefer migrating that file to `@signozhq/icons` as part of the same change when practical.
|
||||
- If a required component or icon is missing from SigNoz packages, call this out explicitly in the PR/summary before introducing alternatives.
|
||||
@@ -291,8 +291,6 @@
|
||||
// Prevents window.open(path), window.location.origin + path, window.location.href = path
|
||||
"signoz/no-antd-components": "error",
|
||||
// Prevents the usage of specific antd components in favor of our lib
|
||||
"signoz/no-signozhq-ui-barrel": "error",
|
||||
// Forces subpath imports (@signozhq/ui/<component>) instead of the eagerly-loaded barrel
|
||||
"no-restricted-globals": [
|
||||
"error",
|
||||
{
|
||||
|
||||
@@ -29,18 +29,6 @@ if (!HTMLElement.prototype.scrollIntoView) {
|
||||
HTMLElement.prototype.scrollIntoView = function (): void {};
|
||||
}
|
||||
|
||||
if (typeof window.IntersectionObserver === 'undefined') {
|
||||
class IntersectionObserverMock {
|
||||
observe(): void {}
|
||||
unobserve(): void {}
|
||||
disconnect(): void {}
|
||||
takeRecords(): IntersectionObserverEntry[] {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
(window as any).IntersectionObserver = IntersectionObserverMock;
|
||||
}
|
||||
|
||||
// Patch getComputedStyle to handle CSS parsing errors from @signozhq/* packages.
|
||||
// These packages inject CSS at import time via style-inject / vite-plugin-css-injected-by-js.
|
||||
// jsdom's nwsapi cannot parse some of the injected selectors (e.g. Tailwind's :animate-in),
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/knip@5/schema.json",
|
||||
"project": ["src/**/*.ts", "src/**/*.tsx"],
|
||||
"ignore": ["src/api/generated/**/*.ts", "src/typings/*.ts"]
|
||||
"ignore": ["src/api/generated/**/*.ts", "src/typings/*.ts"],
|
||||
"ignoreDependencies": [
|
||||
"http-proxy-middleware",
|
||||
"react-error-boundary",
|
||||
"@typescript/native-preview"
|
||||
]
|
||||
}
|
||||
@@ -40,12 +40,8 @@
|
||||
"@dnd-kit/modifiers": "7.0.0",
|
||||
"@dnd-kit/sortable": "8.0.0",
|
||||
"@dnd-kit/utilities": "3.2.2",
|
||||
"@grafana/data": "^11.2.3",
|
||||
"@mdx-js/loader": "2.3.0",
|
||||
"@mdx-js/react": "2.3.0",
|
||||
"@monaco-editor/react": "^4.3.1",
|
||||
"@radix-ui/react-tabs": "1.0.4",
|
||||
"@radix-ui/react-tooltip": "1.0.7",
|
||||
"@grafana/data": "^11.6.14",
|
||||
"@monaco-editor/react": "^4.7.0",
|
||||
"@sentry/react": "8.41.0",
|
||||
"@sentry/vite-plugin": "2.22.6",
|
||||
"@signozhq/design-tokens": "2.1.4",
|
||||
@@ -57,7 +53,6 @@
|
||||
"@uiw/codemirror-theme-copilot": "4.23.11",
|
||||
"@uiw/codemirror-theme-github": "4.24.1",
|
||||
"@uiw/react-codemirror": "4.23.10",
|
||||
"@uiw/react-md-editor": "3.23.5",
|
||||
"@visx/group": "3.3.0",
|
||||
"@visx/hierarchy": "3.12.0",
|
||||
"@visx/shape": "3.5.0",
|
||||
@@ -67,38 +62,29 @@
|
||||
"antd": "5.11.0",
|
||||
"antd-table-saveas-excel": "2.2.1",
|
||||
"antlr4": "4.13.2",
|
||||
"axios": "1.12.0",
|
||||
"axios": "1.16.0",
|
||||
"babel-jest": "^29.6.4",
|
||||
"babel-loader": "9.1.3",
|
||||
"babel-plugin-named-asset-import": "^0.3.7",
|
||||
"babel-preset-minify": "^0.5.1",
|
||||
"babel-preset-react-app": "^10.0.1",
|
||||
"chart.js": "3.9.1",
|
||||
"chartjs-adapter-date-fns": "^2.0.0",
|
||||
"chartjs-plugin-annotation": "^1.4.0",
|
||||
"classnames": "2.3.2",
|
||||
"color": "^4.2.1",
|
||||
"color-alpha": "2.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"crypto-js": "4.2.0",
|
||||
"d3-hierarchy": "3.1.2",
|
||||
"dayjs": "^1.10.7",
|
||||
"dompurify": "3.2.4",
|
||||
"dotenv": "8.2.0",
|
||||
"dompurify": "3.4.0",
|
||||
"event-source-polyfill": "1.0.31",
|
||||
"eventemitter3": "5.0.1",
|
||||
"fontfaceobserver": "2.3.0",
|
||||
"history": "4.10.1",
|
||||
"http-proxy-middleware": "3.0.5",
|
||||
"http-proxy-middleware": "4.0.0",
|
||||
"http-status-codes": "2.3.0",
|
||||
"i18next": "^21.6.12",
|
||||
"i18next-browser-languagedetector": "^6.1.3",
|
||||
"i18next-http-backend": "^1.3.2",
|
||||
"i18next-http-backend": "^4.0.0",
|
||||
"immer": "11.1.3",
|
||||
"jest": "30.2.0",
|
||||
"js-base64": "^3.7.2",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mini-css-extract-plugin": "2.4.5",
|
||||
"motion": "12.4.13",
|
||||
"nuqs": "2.8.8",
|
||||
"overlayscrollbars": "^2.8.1",
|
||||
@@ -106,7 +92,6 @@
|
||||
"papaparse": "5.4.1",
|
||||
"posthog-js": "1.298.0",
|
||||
"rc-select": "14.10.0",
|
||||
"rc-tween-one": "3.0.6",
|
||||
"react": "18.2.0",
|
||||
"react-addons-update": "15.6.3",
|
||||
"react-beautiful-dnd": "13.1.1",
|
||||
@@ -122,13 +107,12 @@
|
||||
"react-hook-form": "7.71.2",
|
||||
"react-i18next": "^11.16.1",
|
||||
"react-json-tree": "^0.20.0",
|
||||
"react-lottie": "1.2.10",
|
||||
"react-markdown": "8.0.7",
|
||||
"react-query": "3.39.3",
|
||||
"react-redux": "^7.2.2",
|
||||
"react-rnd": "^10.5.3",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-router-dom-v5-compat": "6.27.0",
|
||||
"react-router-dom-v5-compat": "6.30.3",
|
||||
"react-syntax-highlighter": "15.5.0",
|
||||
"react-use": "^17.3.2",
|
||||
"react-virtuoso": "4.0.3",
|
||||
@@ -137,16 +121,13 @@
|
||||
"rehype-raw": "7.0.0",
|
||||
"rollup-plugin-visualizer": "7.0.0",
|
||||
"rrule": "2.8.1",
|
||||
"stream": "^0.0.2",
|
||||
"styled-components": "^5.3.11",
|
||||
"timestamp-nano": "^1.0.0",
|
||||
"ts-node": "^10.2.1",
|
||||
"typescript": "5.9.3",
|
||||
"uplot": "1.6.31",
|
||||
"uuid": "^8.3.2",
|
||||
"vite": "npm:rolldown-vite@7.3.1",
|
||||
"vite-plugin-html": "3.2.2",
|
||||
"web-vitals": "^0.2.4",
|
||||
"zod": "4.3.6",
|
||||
"zustand": "5.0.11"
|
||||
},
|
||||
@@ -165,28 +146,23 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.11",
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
"@babel/plugin-syntax-jsx": "^7.12.13",
|
||||
"@babel/preset-env": "^7.22.14",
|
||||
"@babel/preset-react": "^7.12.13",
|
||||
"@babel/preset-typescript": "^7.21.4",
|
||||
"@commitlint/cli": "20.4.4",
|
||||
"@commitlint/config-conventional": "20.4.4",
|
||||
"@faker-js/faker": "9.3.0",
|
||||
"@jest/globals": "30.2.0",
|
||||
"@jest/globals": "30.4.1",
|
||||
"@testing-library/jest-dom": "5.16.5",
|
||||
"@testing-library/react": "13.4.0",
|
||||
"@testing-library/user-event": "14.4.3",
|
||||
"@types/color": "^3.0.3",
|
||||
"@types/crypto-js": "4.2.2",
|
||||
"@types/dompurify": "^2.4.0",
|
||||
"@types/event-source-polyfill": "^1.0.0",
|
||||
"@types/d3-hierarchy": "1.1.11",
|
||||
"@types/fontfaceobserver": "2.1.0",
|
||||
"@types/history": "4.7.11",
|
||||
"@types/jest": "30.0.0",
|
||||
"@jest/types": "30.2.0",
|
||||
"@types/lodash-es": "^4.17.4",
|
||||
"@types/mini-css-extract-plugin": "^2.5.1",
|
||||
"@types/node": "^16.10.3",
|
||||
"@types/papaparse": "5.3.7",
|
||||
"@types/react": "18.0.26",
|
||||
@@ -194,8 +170,6 @@
|
||||
"@types/react-beautiful-dnd": "13.1.8",
|
||||
"@types/react-dom": "18.0.10",
|
||||
"@types/react-grid-layout": "^1.1.2",
|
||||
"@types/react-helmet-async": "1.0.3",
|
||||
"@types/react-lottie": "1.2.10",
|
||||
"@types/react-redux": "^7.1.11",
|
||||
"@types/react-resizable": "3.0.3",
|
||||
"@types/react-router-dom": "^5.1.6",
|
||||
@@ -205,39 +179,27 @@
|
||||
"@types/testing-library__jest-dom": "^5.14.5",
|
||||
"@types/uuid": "^8.3.1",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260430.1",
|
||||
"autoprefixer": "10.4.19",
|
||||
"babel-plugin-styled-components": "^1.12.0",
|
||||
"eslint-plugin-sonarjs": "4.0.2",
|
||||
"glob": "^13.0.6",
|
||||
"husky": "^7.0.4",
|
||||
"imagemin": "^8.0.1",
|
||||
"imagemin-svgo": "^10.0.1",
|
||||
"is-ci": "^3.0.1",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
"jest-environment-node": "29.7.0",
|
||||
"jest-styled-components": "^7.2.0",
|
||||
"lint-staged": "^12.5.0",
|
||||
"lint-staged": "^17.0.4",
|
||||
"msw": "1.3.2",
|
||||
"npm-run-all": "latest",
|
||||
"orval": "7.21.0",
|
||||
"orval": "8.9.1",
|
||||
"oxfmt": "0.47.0",
|
||||
"oxlint": "1.62.0",
|
||||
"oxlint-tsgolint": "0.22.1",
|
||||
"portfinder-sync": "^0.0.2",
|
||||
"postcss": "8.5.6",
|
||||
"postcss": "8.5.14",
|
||||
"postcss-scss": "4.0.9",
|
||||
"prop-types": "15.8.1",
|
||||
"react-hooks-testing-library": "0.6.0",
|
||||
"react-resizable": "3.0.4",
|
||||
"redux-mock-store": "1.5.4",
|
||||
"sass": "1.97.3",
|
||||
"sharp": "0.34.5",
|
||||
"stylelint": "17.7.0",
|
||||
"stylelint-scss": "7.0.0",
|
||||
"svgo": "4.0.0",
|
||||
"ts-api-utils": "2.4.0",
|
||||
"svgo": "4.0.1",
|
||||
"ts-jest": "29.4.9",
|
||||
"ts-node": "^10.2.1",
|
||||
"typescript-plugin-css-modules": "5.2.0",
|
||||
"use-sync-external-store": "1.6.0",
|
||||
"vite-plugin-checker": "0.12.0",
|
||||
@@ -265,7 +227,7 @@
|
||||
"xml2js": "0.5.0",
|
||||
"phin": "^3.7.1",
|
||||
"body-parser": "1.20.3",
|
||||
"http-proxy-middleware": "3.0.5",
|
||||
"http-proxy-middleware": "4.0.0",
|
||||
"cross-spawn": "7.0.5",
|
||||
"cookie": "^0.7.1",
|
||||
"serialize-javascript": "6.0.2",
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
/**
|
||||
* Rule: no-signozhq-ui-barrel
|
||||
*
|
||||
* Forbids importing from the `@signozhq/ui` barrel and requires the matching
|
||||
* subpath instead.
|
||||
*
|
||||
* This rule catches:
|
||||
* import { Typography } from '@signozhq/ui'
|
||||
* import { Button, toast } from '@signozhq/ui'
|
||||
* import '@signozhq/ui'
|
||||
*
|
||||
* And expects:
|
||||
* import { Typography } from '@signozhq/ui/typography'
|
||||
* import { Button } from '@signozhq/ui/button'
|
||||
* import { toast } from '@signozhq/ui/sonner'
|
||||
*
|
||||
* Why: the barrel eagerly require()s every component (~90 of them) along with
|
||||
* their Radix/cmdk/motion/react-day-picker dependencies. Under Jest this caused
|
||||
* 5s timeouts and flaky tests after the Antd→@signozhq/ui Typography migration
|
||||
* (#11199). Subpath imports (added in @signozhq/ui@0.0.18) load only what's
|
||||
* used.
|
||||
*
|
||||
* The auto-generated `auto-import-registry.d.ts` is a pure declaration file
|
||||
* that exists solely to nudge VS Code's auto-import indexer; its bare
|
||||
* `import '@signozhq/ui';` is type-only and not emitted, so it is exempt.
|
||||
*
|
||||
* Autofix:
|
||||
* Rewrites named imports to the matching subpath, splitting one statement
|
||||
* into multiple when specifiers come from different subpaths. The
|
||||
* export-name → subpath map is derived lazily from the installed
|
||||
* `@signozhq/ui` dist `.d.ts` files. Imports we can't classify (namespace,
|
||||
* default, side-effect, or unknown specifier) are reported without a fix.
|
||||
*/
|
||||
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const ALLOWED_FILES = new Set(['auto-import-registry.d.ts']);
|
||||
|
||||
const PLUGIN_DIR = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
let exportMap = null;
|
||||
|
||||
function loadExportMap() {
|
||||
if (exportMap === null) {
|
||||
exportMap = buildExportMap();
|
||||
}
|
||||
return exportMap;
|
||||
}
|
||||
|
||||
function buildExportMap() {
|
||||
const map = new Map();
|
||||
const root = findSignozUiRoot();
|
||||
if (!root) return map;
|
||||
|
||||
let pkg;
|
||||
try {
|
||||
pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf-8'));
|
||||
} catch {
|
||||
return map;
|
||||
}
|
||||
|
||||
const subpathKeys = Object.keys(pkg.exports || {}).filter((k) => k !== '.');
|
||||
for (const key of subpathKeys) {
|
||||
const subpath = key.replace(/^\.\//, '');
|
||||
const entry = join(root, 'dist', subpath, 'index.d.ts');
|
||||
if (!existsSync(entry)) continue;
|
||||
|
||||
const names = new Set();
|
||||
collectExportedNames(entry, names, new Set());
|
||||
// First-wins: package.json subpath order is the canonical home for
|
||||
// names re-exported across multiple subpaths (e.g. `ToggleColor` is
|
||||
// declared in `toggle` and re-exported from `toggle-group`).
|
||||
for (const name of names) {
|
||||
if (!map.has(name)) map.set(name, subpath);
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
function findSignozUiRoot() {
|
||||
let dir = PLUGIN_DIR;
|
||||
while (true) {
|
||||
const candidate = join(dir, 'node_modules', '@signozhq', 'ui');
|
||||
if (existsSync(join(candidate, 'package.json'))) return candidate;
|
||||
const parent = dirname(dir);
|
||||
if (parent === dir) return null;
|
||||
dir = parent;
|
||||
}
|
||||
}
|
||||
|
||||
function collectExportedNames(filepath, out, visited) {
|
||||
if (visited.has(filepath) || !existsSync(filepath)) return;
|
||||
visited.add(filepath);
|
||||
|
||||
let content;
|
||||
try {
|
||||
content = readFileSync(filepath, 'utf-8');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
// `export * from './x.js'` / `export type * from './x.js'`
|
||||
for (const m of content.matchAll(
|
||||
/export\s+(?:type\s+)?\*\s+from\s+['"]([^'"]+)['"]/g,
|
||||
)) {
|
||||
collectExportedNames(resolveRelativeDts(filepath, m[1]), out, visited);
|
||||
}
|
||||
|
||||
// `export { Foo, type Bar, Foo as Baz } from '...';` and `export { ... };`
|
||||
for (const m of content.matchAll(/export\s+(?:type\s+)?\{([^}]*)\}/g)) {
|
||||
for (const item of m[1].split(',')) {
|
||||
const cleaned = item.trim().replace(/^type\s+/, '');
|
||||
if (!cleaned) continue;
|
||||
const idMatch = cleaned.match(
|
||||
/^([A-Za-z_$][A-Za-z0-9_$]*)(?:\s+as\s+([A-Za-z_$][A-Za-z0-9_$]*))?$/,
|
||||
);
|
||||
if (idMatch) out.add(idMatch[2] || idMatch[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// `export (declare) const|let|var|function|class|enum|type|interface Foo`
|
||||
for (const m of content.matchAll(
|
||||
/export\s+(?:declare\s+)?(?:const|let|var|function|class|enum|type|interface)\s+([A-Za-z_$][A-Za-z0-9_$]*)/g,
|
||||
)) {
|
||||
out.add(m[1]);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveRelativeDts(fromFile, spec) {
|
||||
const base = dirname(fromFile);
|
||||
const stripped = spec.replace(/\.(js|mjs|cjs)$/, '');
|
||||
const sibling = join(base, `${stripped}.d.ts`);
|
||||
if (existsSync(sibling)) return sibling;
|
||||
const indexed = join(base, stripped, 'index.d.ts');
|
||||
if (existsSync(indexed)) return indexed;
|
||||
return sibling;
|
||||
}
|
||||
|
||||
function buildReplacement(node, map) {
|
||||
const specifiers = node.specifiers || [];
|
||||
if (specifiers.length === 0) return null;
|
||||
|
||||
for (const spec of specifiers) {
|
||||
if (spec.type !== 'ImportSpecifier') return null;
|
||||
if (spec.imported?.type !== 'Identifier') return null;
|
||||
}
|
||||
|
||||
const quote = node.source.raw?.[0] === '"' ? '"' : "'";
|
||||
const topLevelType = node.importKind === 'type';
|
||||
const keyword = topLevelType ? 'import type' : 'import';
|
||||
|
||||
const groups = new Map();
|
||||
for (const spec of specifiers) {
|
||||
const importedName = spec.imported.name;
|
||||
const subpath = map.get(importedName);
|
||||
if (!subpath) return null;
|
||||
|
||||
const localName = spec.local.name;
|
||||
const inlineType = !topLevelType && spec.importKind === 'type';
|
||||
let text = inlineType ? 'type ' : '';
|
||||
text += importedName;
|
||||
if (localName !== importedName) text += ` as ${localName}`;
|
||||
|
||||
if (!groups.has(subpath)) groups.set(subpath, []);
|
||||
groups.get(subpath).push(text);
|
||||
}
|
||||
|
||||
const lines = [];
|
||||
for (const [subpath, items] of groups) {
|
||||
lines.push(
|
||||
`${keyword} { ${items.join(', ')} } from ${quote}@signozhq/ui/${subpath}${quote};`,
|
||||
);
|
||||
}
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
export default {
|
||||
meta: {
|
||||
fixable: 'code',
|
||||
},
|
||||
create(context) {
|
||||
const filename = context.filename || '';
|
||||
const basename = filename.split(/[\\/]/).pop();
|
||||
if (ALLOWED_FILES.has(basename)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
ImportDeclaration(node) {
|
||||
if (node.source.value !== '@signozhq/ui') {
|
||||
return;
|
||||
}
|
||||
|
||||
const replacement = buildReplacement(node, loadExportMap());
|
||||
const report = {
|
||||
node: node.source,
|
||||
message:
|
||||
"Do not import from the '@signozhq/ui' barrel. Use the matching subpath instead (e.g. '@signozhq/ui/typography', '@signozhq/ui/button', '@signozhq/ui/sonner'). The barrel eagerly loads ~90 components and slows tests substantially.",
|
||||
};
|
||||
if (replacement) {
|
||||
report.fix = (fixer) => fixer.replaceText(node, replacement);
|
||||
}
|
||||
context.report(report);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -10,7 +10,6 @@ import noNavigatorClipboard from './rules/no-navigator-clipboard.mjs';
|
||||
import noUnsupportedAssetPattern from './rules/no-unsupported-asset-pattern.mjs';
|
||||
import noRawAbsolutePath from './rules/no-raw-absolute-path.mjs';
|
||||
import noAntdComponents from './rules/no-antd-components.mjs';
|
||||
import noSignozhqUiBarrel from './rules/no-signozhq-ui-barrel.mjs';
|
||||
|
||||
export default {
|
||||
meta: {
|
||||
@@ -22,6 +21,5 @@ export default {
|
||||
'no-unsupported-asset-pattern': noUnsupportedAssetPattern,
|
||||
'no-raw-absolute-path': noRawAbsolutePath,
|
||||
'no-antd-components': noAntdComponents,
|
||||
'no-signozhq-ui-barrel': noSignozhqUiBarrel,
|
||||
},
|
||||
};
|
||||
|
||||
6495
frontend/pnpm-lock.yaml
generated
6495
frontend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
6
frontend/pnpm-workspace.yaml
Normal file
6
frontend/pnpm-workspace.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
trustPolicy: no-downgrade
|
||||
minimumReleaseAge: 2880 # 2d
|
||||
minimumReleaseAgeStrict: true
|
||||
minimumReleaseAgeExclude:
|
||||
- '@signozhq/*'
|
||||
blockExoticSubdeps: true
|
||||
@@ -21,7 +21,7 @@ i18n
|
||||
escapeValue: false, // not needed for react as it escapes by default
|
||||
},
|
||||
backend: {
|
||||
loadPath: (language, namespace) => {
|
||||
loadPath: (language: string, namespace: string): string => {
|
||||
const ns = namespace[0];
|
||||
const pathkey = `/${language}/${ns}`;
|
||||
const hash = cacheBursting[pathkey as keyof typeof cacheBursting] || '';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -77,9 +78,7 @@ export function useGetAlerts<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -98,9 +99,7 @@ export function useListAuthDomains<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +122,7 @@ export const invalidateListAuthDomains = async (
|
||||
* @summary Create auth domain
|
||||
*/
|
||||
export const createAuthDomain = (
|
||||
authtypesPostableAuthDomainDTO: BodyType<AuthtypesPostableAuthDomainDTO>,
|
||||
authtypesPostableAuthDomainDTO?: BodyType<AuthtypesPostableAuthDomainDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateAuthDomain201>({
|
||||
@@ -142,13 +141,13 @@ export const getCreateAuthDomainMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableAuthDomainDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableAuthDomainDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createAuthDomain'];
|
||||
@@ -162,7 +161,7 @@ export const getCreateAuthDomainMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> }
|
||||
{ data?: BodyType<AuthtypesPostableAuthDomainDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -176,7 +175,8 @@ export type CreateAuthDomainMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createAuthDomain>>
|
||||
>;
|
||||
export type CreateAuthDomainMutationBody =
|
||||
BodyType<AuthtypesPostableAuthDomainDTO>;
|
||||
| BodyType<AuthtypesPostableAuthDomainDTO>
|
||||
| undefined;
|
||||
export type CreateAuthDomainMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -189,27 +189,29 @@ export const useCreateAuthDomain = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableAuthDomainDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createAuthDomain>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableAuthDomainDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableAuthDomainDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateAuthDomainMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateAuthDomainMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes an auth domain
|
||||
* @summary Delete auth domain
|
||||
*/
|
||||
export const deleteAuthDomain = ({ id }: DeleteAuthDomainPathParameters) => {
|
||||
export const deleteAuthDomain = (
|
||||
{ id }: DeleteAuthDomainPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/domains/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -275,9 +277,7 @@ export const useDeleteAuthDomain = <
|
||||
{ pathParams: DeleteAuthDomainPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteAuthDomainMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteAuthDomainMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns an auth domain by ID
|
||||
@@ -361,9 +361,7 @@ export function useGetAuthDomain<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,13 +386,15 @@ export const invalidateGetAuthDomain = async (
|
||||
*/
|
||||
export const updateAuthDomain = (
|
||||
{ id }: UpdateAuthDomainPathParameters,
|
||||
authtypesUpdatableAuthDomainDTO: BodyType<AuthtypesUpdatableAuthDomainDTO>,
|
||||
authtypesUpdatableAuthDomainDTO?: BodyType<AuthtypesUpdatableAuthDomainDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/domains/${id}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: authtypesUpdatableAuthDomainDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -407,7 +407,7 @@ export const getUpdateAuthDomainMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateAuthDomainPathParameters;
|
||||
data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
data?: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -416,7 +416,7 @@ export const getUpdateAuthDomainMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateAuthDomainPathParameters;
|
||||
data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
data?: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -433,7 +433,7 @@ export const getUpdateAuthDomainMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateAuthDomain>>,
|
||||
{
|
||||
pathParams: UpdateAuthDomainPathParameters;
|
||||
data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
data?: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -448,7 +448,8 @@ export type UpdateAuthDomainMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateAuthDomain>>
|
||||
>;
|
||||
export type UpdateAuthDomainMutationBody =
|
||||
BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
| BodyType<AuthtypesUpdatableAuthDomainDTO>
|
||||
| undefined;
|
||||
export type UpdateAuthDomainMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -463,7 +464,7 @@ export const useUpdateAuthDomain = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateAuthDomainPathParameters;
|
||||
data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
data?: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -472,11 +473,9 @@ export const useUpdateAuthDomain = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateAuthDomainPathParameters;
|
||||
data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
data?: BodyType<AuthtypesUpdatableAuthDomainDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateAuthDomainMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateAuthDomainMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation } from 'react-query';
|
||||
import type {
|
||||
@@ -25,7 +26,7 @@ import type { ErrorType, BodyType } from '../../../generatedAPIInstance';
|
||||
* @summary Check permissions
|
||||
*/
|
||||
export const authzCheck = (
|
||||
authtypesTransactionDTO: BodyType<AuthtypesTransactionDTO[]>,
|
||||
authtypesTransactionDTO?: BodyType<AuthtypesTransactionDTO[]>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<AuthzCheck200>({
|
||||
@@ -44,13 +45,13 @@ export const getAuthzCheckMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof authzCheck>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesTransactionDTO[]> },
|
||||
{ data?: BodyType<AuthtypesTransactionDTO[]> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof authzCheck>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesTransactionDTO[]> },
|
||||
{ data?: BodyType<AuthtypesTransactionDTO[]> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['authzCheck'];
|
||||
@@ -64,7 +65,7 @@ export const getAuthzCheckMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof authzCheck>>,
|
||||
{ data: BodyType<AuthtypesTransactionDTO[]> }
|
||||
{ data?: BodyType<AuthtypesTransactionDTO[]> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -77,7 +78,9 @@ export const getAuthzCheckMutationOptions = <
|
||||
export type AuthzCheckMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof authzCheck>>
|
||||
>;
|
||||
export type AuthzCheckMutationBody = BodyType<AuthtypesTransactionDTO[]>;
|
||||
export type AuthzCheckMutationBody =
|
||||
| BodyType<AuthtypesTransactionDTO[]>
|
||||
| undefined;
|
||||
export type AuthzCheckMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -90,16 +93,14 @@ export const useAuthzCheck = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof authzCheck>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesTransactionDTO[]> },
|
||||
{ data?: BodyType<AuthtypesTransactionDTO[]> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof authzCheck>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesTransactionDTO[]> },
|
||||
{ data?: BodyType<AuthtypesTransactionDTO[]> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getAuthzCheckMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getAuthzCheckMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -98,9 +99,7 @@ export function useListChannels<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +122,7 @@ export const invalidateListChannels = async (
|
||||
* @summary Create notification channel
|
||||
*/
|
||||
export const createChannel = (
|
||||
alertmanagertypesPostableChannelDTO: BodyType<AlertmanagertypesPostableChannelDTO>,
|
||||
alertmanagertypesPostableChannelDTO?: BodyType<AlertmanagertypesPostableChannelDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateChannel201>({
|
||||
@@ -142,13 +141,13 @@ export const getCreateChannelMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createChannel>>,
|
||||
TError,
|
||||
{ data: BodyType<AlertmanagertypesPostableChannelDTO> },
|
||||
{ data?: BodyType<AlertmanagertypesPostableChannelDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createChannel>>,
|
||||
TError,
|
||||
{ data: BodyType<AlertmanagertypesPostableChannelDTO> },
|
||||
{ data?: BodyType<AlertmanagertypesPostableChannelDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createChannel'];
|
||||
@@ -162,7 +161,7 @@ export const getCreateChannelMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createChannel>>,
|
||||
{ data: BodyType<AlertmanagertypesPostableChannelDTO> }
|
||||
{ data?: BodyType<AlertmanagertypesPostableChannelDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -176,7 +175,8 @@ export type CreateChannelMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createChannel>>
|
||||
>;
|
||||
export type CreateChannelMutationBody =
|
||||
BodyType<AlertmanagertypesPostableChannelDTO>;
|
||||
| BodyType<AlertmanagertypesPostableChannelDTO>
|
||||
| undefined;
|
||||
export type CreateChannelMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -189,27 +189,29 @@ export const useCreateChannel = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createChannel>>,
|
||||
TError,
|
||||
{ data: BodyType<AlertmanagertypesPostableChannelDTO> },
|
||||
{ data?: BodyType<AlertmanagertypesPostableChannelDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createChannel>>,
|
||||
TError,
|
||||
{ data: BodyType<AlertmanagertypesPostableChannelDTO> },
|
||||
{ data?: BodyType<AlertmanagertypesPostableChannelDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateChannelMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateChannelMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes a notification channel by ID
|
||||
* @summary Delete notification channel
|
||||
*/
|
||||
export const deleteChannelByID = ({ id }: DeleteChannelByIDPathParameters) => {
|
||||
export const deleteChannelByID = (
|
||||
{ id }: DeleteChannelByIDPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/channels/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -275,9 +277,7 @@ export const useDeleteChannelByID = <
|
||||
{ pathParams: DeleteChannelByIDPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteChannelByIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteChannelByIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns a notification channel by ID
|
||||
@@ -361,9 +361,7 @@ export function useGetChannelByID<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,13 +386,15 @@ export const invalidateGetChannelByID = async (
|
||||
*/
|
||||
export const updateChannelByID = (
|
||||
{ id }: UpdateChannelByIDPathParameters,
|
||||
configReceiverDTO: BodyType<ConfigReceiverDTO>,
|
||||
configReceiverDTO?: BodyType<ConfigReceiverDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/channels/${id}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: configReceiverDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -407,7 +407,7 @@ export const getUpdateChannelByIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateChannelByIDPathParameters;
|
||||
data: BodyType<ConfigReceiverDTO>;
|
||||
data?: BodyType<ConfigReceiverDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -416,7 +416,7 @@ export const getUpdateChannelByIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateChannelByIDPathParameters;
|
||||
data: BodyType<ConfigReceiverDTO>;
|
||||
data?: BodyType<ConfigReceiverDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -433,7 +433,7 @@ export const getUpdateChannelByIDMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateChannelByID>>,
|
||||
{
|
||||
pathParams: UpdateChannelByIDPathParameters;
|
||||
data: BodyType<ConfigReceiverDTO>;
|
||||
data?: BodyType<ConfigReceiverDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -447,7 +447,9 @@ export const getUpdateChannelByIDMutationOptions = <
|
||||
export type UpdateChannelByIDMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateChannelByID>>
|
||||
>;
|
||||
export type UpdateChannelByIDMutationBody = BodyType<ConfigReceiverDTO>;
|
||||
export type UpdateChannelByIDMutationBody =
|
||||
| BodyType<ConfigReceiverDTO>
|
||||
| undefined;
|
||||
export type UpdateChannelByIDMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -462,7 +464,7 @@ export const useUpdateChannelByID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateChannelByIDPathParameters;
|
||||
data: BodyType<ConfigReceiverDTO>;
|
||||
data?: BodyType<ConfigReceiverDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -471,20 +473,18 @@ export const useUpdateChannelByID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateChannelByIDPathParameters;
|
||||
data: BodyType<ConfigReceiverDTO>;
|
||||
data?: BodyType<ConfigReceiverDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateChannelByIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateChannelByIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint tests a notification channel by sending a test notification
|
||||
* @summary Test notification channel
|
||||
*/
|
||||
export const testChannel = (
|
||||
configReceiverDTO: BodyType<ConfigReceiverDTO>,
|
||||
configReceiverDTO?: BodyType<ConfigReceiverDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
@@ -503,13 +503,13 @@ export const getTestChannelMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof testChannel>>,
|
||||
TError,
|
||||
{ data: BodyType<ConfigReceiverDTO> },
|
||||
{ data?: BodyType<ConfigReceiverDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof testChannel>>,
|
||||
TError,
|
||||
{ data: BodyType<ConfigReceiverDTO> },
|
||||
{ data?: BodyType<ConfigReceiverDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['testChannel'];
|
||||
@@ -523,7 +523,7 @@ export const getTestChannelMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof testChannel>>,
|
||||
{ data: BodyType<ConfigReceiverDTO> }
|
||||
{ data?: BodyType<ConfigReceiverDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -536,7 +536,7 @@ export const getTestChannelMutationOptions = <
|
||||
export type TestChannelMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof testChannel>>
|
||||
>;
|
||||
export type TestChannelMutationBody = BodyType<ConfigReceiverDTO>;
|
||||
export type TestChannelMutationBody = BodyType<ConfigReceiverDTO> | undefined;
|
||||
export type TestChannelMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -549,18 +549,16 @@ export const useTestChannel = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof testChannel>>,
|
||||
TError,
|
||||
{ data: BodyType<ConfigReceiverDTO> },
|
||||
{ data?: BodyType<ConfigReceiverDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof testChannel>>,
|
||||
TError,
|
||||
{ data: BodyType<ConfigReceiverDTO> },
|
||||
{ data?: BodyType<ConfigReceiverDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getTestChannelMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getTestChannelMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Deprecated: use /api/v1/channels/test instead
|
||||
@@ -568,7 +566,7 @@ export const useTestChannel = <
|
||||
* @summary Test notification channel (deprecated)
|
||||
*/
|
||||
export const testChannelDeprecated = (
|
||||
configReceiverDTO: BodyType<ConfigReceiverDTO>,
|
||||
configReceiverDTO?: BodyType<ConfigReceiverDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
@@ -587,13 +585,13 @@ export const getTestChannelDeprecatedMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof testChannelDeprecated>>,
|
||||
TError,
|
||||
{ data: BodyType<ConfigReceiverDTO> },
|
||||
{ data?: BodyType<ConfigReceiverDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof testChannelDeprecated>>,
|
||||
TError,
|
||||
{ data: BodyType<ConfigReceiverDTO> },
|
||||
{ data?: BodyType<ConfigReceiverDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['testChannelDeprecated'];
|
||||
@@ -607,7 +605,7 @@ export const getTestChannelDeprecatedMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof testChannelDeprecated>>,
|
||||
{ data: BodyType<ConfigReceiverDTO> }
|
||||
{ data?: BodyType<ConfigReceiverDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -620,7 +618,9 @@ export const getTestChannelDeprecatedMutationOptions = <
|
||||
export type TestChannelDeprecatedMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof testChannelDeprecated>>
|
||||
>;
|
||||
export type TestChannelDeprecatedMutationBody = BodyType<ConfigReceiverDTO>;
|
||||
export type TestChannelDeprecatedMutationBody =
|
||||
| BodyType<ConfigReceiverDTO>
|
||||
| undefined;
|
||||
export type TestChannelDeprecatedMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -635,16 +635,14 @@ export const useTestChannelDeprecated = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof testChannelDeprecated>>,
|
||||
TError,
|
||||
{ data: BodyType<ConfigReceiverDTO> },
|
||||
{ data?: BodyType<ConfigReceiverDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof testChannelDeprecated>>,
|
||||
TError,
|
||||
{ data: BodyType<ConfigReceiverDTO> },
|
||||
{ data?: BodyType<ConfigReceiverDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getTestChannelDeprecatedMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getTestChannelDeprecatedMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -56,7 +57,7 @@ import type { ErrorType, BodyType } from '../../../generatedAPIInstance';
|
||||
*/
|
||||
export const agentCheckInDeprecated = (
|
||||
{ cloudProvider }: AgentCheckInDeprecatedPathParameters,
|
||||
cloudintegrationtypesPostableAgentCheckInDTO: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>,
|
||||
cloudintegrationtypesPostableAgentCheckInDTO?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<AgentCheckInDeprecated200>({
|
||||
@@ -77,7 +78,7 @@ export const getAgentCheckInDeprecatedMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: AgentCheckInDeprecatedPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -86,7 +87,7 @@ export const getAgentCheckInDeprecatedMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: AgentCheckInDeprecatedPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -103,7 +104,7 @@ export const getAgentCheckInDeprecatedMutationOptions = <
|
||||
Awaited<ReturnType<typeof agentCheckInDeprecated>>,
|
||||
{
|
||||
pathParams: AgentCheckInDeprecatedPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -118,7 +119,8 @@ export type AgentCheckInDeprecatedMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof agentCheckInDeprecated>>
|
||||
>;
|
||||
export type AgentCheckInDeprecatedMutationBody =
|
||||
BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
| BodyType<CloudintegrationtypesPostableAgentCheckInDTO>
|
||||
| undefined;
|
||||
export type AgentCheckInDeprecatedMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -135,7 +137,7 @@ export const useAgentCheckInDeprecated = <
|
||||
TError,
|
||||
{
|
||||
pathParams: AgentCheckInDeprecatedPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -144,13 +146,11 @@ export const useAgentCheckInDeprecated = <
|
||||
TError,
|
||||
{
|
||||
pathParams: AgentCheckInDeprecatedPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getAgentCheckInDeprecatedMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getAgentCheckInDeprecatedMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint lists the accounts for the specified cloud provider
|
||||
@@ -235,9 +235,7 @@ export function useListAccounts<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +260,7 @@ export const invalidateListAccounts = async (
|
||||
*/
|
||||
export const createAccount = (
|
||||
{ cloudProvider }: CreateAccountPathParameters,
|
||||
cloudintegrationtypesPostableAccountDTO: BodyType<CloudintegrationtypesPostableAccountDTO>,
|
||||
cloudintegrationtypesPostableAccountDTO?: BodyType<CloudintegrationtypesPostableAccountDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateAccount201>({
|
||||
@@ -283,7 +281,7 @@ export const getCreateAccountMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -292,7 +290,7 @@ export const getCreateAccountMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -309,7 +307,7 @@ export const getCreateAccountMutationOptions = <
|
||||
Awaited<ReturnType<typeof createAccount>>,
|
||||
{
|
||||
pathParams: CreateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -324,7 +322,8 @@ export type CreateAccountMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createAccount>>
|
||||
>;
|
||||
export type CreateAccountMutationBody =
|
||||
BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
| BodyType<CloudintegrationtypesPostableAccountDTO>
|
||||
| undefined;
|
||||
export type CreateAccountMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -339,7 +338,7 @@ export const useCreateAccount = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -348,25 +347,24 @@ export const useCreateAccount = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateAccountMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateAccountMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint disconnects an account for the specified cloud provider
|
||||
* @summary Disconnect account
|
||||
*/
|
||||
export const disconnectAccount = ({
|
||||
cloudProvider,
|
||||
id,
|
||||
}: DisconnectAccountPathParameters) => {
|
||||
export const disconnectAccount = (
|
||||
{ cloudProvider, id }: DisconnectAccountPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/cloud_integrations/${cloudProvider}/accounts/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -432,9 +430,7 @@ export const useDisconnectAccount = <
|
||||
{ pathParams: DisconnectAccountPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDisconnectAccountMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDisconnectAccountMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint gets an account for the specified cloud provider
|
||||
@@ -518,9 +514,7 @@ export function useGetAccount<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -545,13 +539,15 @@ export const invalidateGetAccount = async (
|
||||
*/
|
||||
export const updateAccount = (
|
||||
{ cloudProvider, id }: UpdateAccountPathParameters,
|
||||
cloudintegrationtypesUpdatableAccountDTO: BodyType<CloudintegrationtypesUpdatableAccountDTO>,
|
||||
cloudintegrationtypesUpdatableAccountDTO?: BodyType<CloudintegrationtypesUpdatableAccountDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/cloud_integrations/${cloudProvider}/accounts/${id}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: cloudintegrationtypesUpdatableAccountDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -564,7 +560,7 @@ export const getUpdateAccountMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -573,7 +569,7 @@ export const getUpdateAccountMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -590,7 +586,7 @@ export const getUpdateAccountMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateAccount>>,
|
||||
{
|
||||
pathParams: UpdateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -605,7 +601,8 @@ export type UpdateAccountMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateAccount>>
|
||||
>;
|
||||
export type UpdateAccountMutationBody =
|
||||
BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
| BodyType<CloudintegrationtypesUpdatableAccountDTO>
|
||||
| undefined;
|
||||
export type UpdateAccountMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -620,7 +617,7 @@ export const useUpdateAccount = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -629,13 +626,11 @@ export const useUpdateAccount = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateAccountPathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateAccountMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateAccountMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint updates a service for the specified cloud provider
|
||||
@@ -643,13 +638,15 @@ export const useUpdateAccount = <
|
||||
*/
|
||||
export const updateService = (
|
||||
{ cloudProvider, id, serviceId }: UpdateServicePathParameters,
|
||||
cloudintegrationtypesUpdatableServiceDTO: BodyType<CloudintegrationtypesUpdatableServiceDTO>,
|
||||
cloudintegrationtypesUpdatableServiceDTO?: BodyType<CloudintegrationtypesUpdatableServiceDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/cloud_integrations/${cloudProvider}/accounts/${id}/services/${serviceId}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: cloudintegrationtypesUpdatableServiceDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -662,7 +659,7 @@ export const getUpdateServiceMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServicePathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -671,7 +668,7 @@ export const getUpdateServiceMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServicePathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -688,7 +685,7 @@ export const getUpdateServiceMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateService>>,
|
||||
{
|
||||
pathParams: UpdateServicePathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -703,7 +700,8 @@ export type UpdateServiceMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateService>>
|
||||
>;
|
||||
export type UpdateServiceMutationBody =
|
||||
BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
| BodyType<CloudintegrationtypesUpdatableServiceDTO>
|
||||
| undefined;
|
||||
export type UpdateServiceMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -718,7 +716,7 @@ export const useUpdateService = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServicePathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -727,13 +725,11 @@ export const useUpdateService = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServicePathParameters;
|
||||
data: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
data?: BodyType<CloudintegrationtypesUpdatableServiceDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateServiceMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateServiceMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint is called by the deployed agent to check in
|
||||
@@ -741,7 +737,7 @@ export const useUpdateService = <
|
||||
*/
|
||||
export const agentCheckIn = (
|
||||
{ cloudProvider }: AgentCheckInPathParameters,
|
||||
cloudintegrationtypesPostableAgentCheckInDTO: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>,
|
||||
cloudintegrationtypesPostableAgentCheckInDTO?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<AgentCheckIn200>({
|
||||
@@ -762,7 +758,7 @@ export const getAgentCheckInMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: AgentCheckInPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -771,7 +767,7 @@ export const getAgentCheckInMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: AgentCheckInPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -788,7 +784,7 @@ export const getAgentCheckInMutationOptions = <
|
||||
Awaited<ReturnType<typeof agentCheckIn>>,
|
||||
{
|
||||
pathParams: AgentCheckInPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -803,7 +799,8 @@ export type AgentCheckInMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof agentCheckIn>>
|
||||
>;
|
||||
export type AgentCheckInMutationBody =
|
||||
BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
| BodyType<CloudintegrationtypesPostableAgentCheckInDTO>
|
||||
| undefined;
|
||||
export type AgentCheckInMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -818,7 +815,7 @@ export const useAgentCheckIn = <
|
||||
TError,
|
||||
{
|
||||
pathParams: AgentCheckInPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -827,13 +824,11 @@ export const useAgentCheckIn = <
|
||||
TError,
|
||||
{
|
||||
pathParams: AgentCheckInPathParameters;
|
||||
data: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
data?: BodyType<CloudintegrationtypesPostableAgentCheckInDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getAgentCheckInMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getAgentCheckInMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint retrieves the connection credentials required for integration
|
||||
@@ -923,9 +918,7 @@ export function useGetConnectionCredentials<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1040,9 +1033,7 @@ export function useListServicesMetadata<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1156,9 +1147,7 @@ export function useGetService<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -40,12 +41,14 @@ import type { ErrorType, BodyType } from '../../../generatedAPIInstance';
|
||||
* This endpoint deletes the public sharing config and disables the public sharing of a dashboard
|
||||
* @summary Delete public dashboard
|
||||
*/
|
||||
export const deletePublicDashboard = ({
|
||||
id,
|
||||
}: DeletePublicDashboardPathParameters) => {
|
||||
export const deletePublicDashboard = (
|
||||
{ id }: DeletePublicDashboardPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/dashboards/${id}/public`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -112,9 +115,7 @@ export const useDeletePublicDashboard = <
|
||||
{ pathParams: DeletePublicDashboardPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeletePublicDashboardMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeletePublicDashboardMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns public sharing config for a dashboard
|
||||
@@ -199,9 +200,7 @@ export function useGetPublicDashboard<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,7 +225,7 @@ export const invalidateGetPublicDashboard = async (
|
||||
*/
|
||||
export const createPublicDashboard = (
|
||||
{ id }: CreatePublicDashboardPathParameters,
|
||||
dashboardtypesPostablePublicDashboardDTO: BodyType<DashboardtypesPostablePublicDashboardDTO>,
|
||||
dashboardtypesPostablePublicDashboardDTO?: BodyType<DashboardtypesPostablePublicDashboardDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreatePublicDashboard201>({
|
||||
@@ -247,7 +246,7 @@ export const getCreatePublicDashboardMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -256,7 +255,7 @@ export const getCreatePublicDashboardMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -273,7 +272,7 @@ export const getCreatePublicDashboardMutationOptions = <
|
||||
Awaited<ReturnType<typeof createPublicDashboard>>,
|
||||
{
|
||||
pathParams: CreatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -288,7 +287,8 @@ export type CreatePublicDashboardMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createPublicDashboard>>
|
||||
>;
|
||||
export type CreatePublicDashboardMutationBody =
|
||||
BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
| BodyType<DashboardtypesPostablePublicDashboardDTO>
|
||||
| undefined;
|
||||
export type CreatePublicDashboardMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -304,7 +304,7 @@ export const useCreatePublicDashboard = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -313,13 +313,11 @@ export const useCreatePublicDashboard = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesPostablePublicDashboardDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreatePublicDashboardMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreatePublicDashboardMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint updates the public sharing config for a dashboard
|
||||
@@ -327,13 +325,15 @@ export const useCreatePublicDashboard = <
|
||||
*/
|
||||
export const updatePublicDashboard = (
|
||||
{ id }: UpdatePublicDashboardPathParameters,
|
||||
dashboardtypesUpdatablePublicDashboardDTO: BodyType<DashboardtypesUpdatablePublicDashboardDTO>,
|
||||
dashboardtypesUpdatablePublicDashboardDTO?: BodyType<DashboardtypesUpdatablePublicDashboardDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/dashboards/${id}/public`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: dashboardtypesUpdatablePublicDashboardDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -346,7 +346,7 @@ export const getUpdatePublicDashboardMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -355,7 +355,7 @@ export const getUpdatePublicDashboardMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -372,7 +372,7 @@ export const getUpdatePublicDashboardMutationOptions = <
|
||||
Awaited<ReturnType<typeof updatePublicDashboard>>,
|
||||
{
|
||||
pathParams: UpdatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -387,7 +387,8 @@ export type UpdatePublicDashboardMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updatePublicDashboard>>
|
||||
>;
|
||||
export type UpdatePublicDashboardMutationBody =
|
||||
BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
| BodyType<DashboardtypesUpdatablePublicDashboardDTO>
|
||||
| undefined;
|
||||
export type UpdatePublicDashboardMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -403,7 +404,7 @@ export const useUpdatePublicDashboard = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -412,13 +413,11 @@ export const useUpdatePublicDashboard = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdatePublicDashboardPathParameters;
|
||||
data: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
data?: BodyType<DashboardtypesUpdatablePublicDashboardDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdatePublicDashboardMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdatePublicDashboardMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns the sanitized dashboard data for public access
|
||||
@@ -504,9 +503,7 @@ export function useGetPublicDashboardData<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -614,9 +611,7 @@ export function useGetPublicDashboardWidgetQueryRange<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -111,9 +112,7 @@ export function useListDowntimeSchedules<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +136,7 @@ export const invalidateListDowntimeSchedules = async (
|
||||
* @summary Create downtime schedule
|
||||
*/
|
||||
export const createDowntimeSchedule = (
|
||||
ruletypesPostablePlannedMaintenanceDTO: BodyType<RuletypesPostablePlannedMaintenanceDTO>,
|
||||
ruletypesPostablePlannedMaintenanceDTO?: BodyType<RuletypesPostablePlannedMaintenanceDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateDowntimeSchedule201>({
|
||||
@@ -156,13 +155,13 @@ export const getCreateDowntimeScheduleMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createDowntimeSchedule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostablePlannedMaintenanceDTO> },
|
||||
{ data?: BodyType<RuletypesPostablePlannedMaintenanceDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createDowntimeSchedule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostablePlannedMaintenanceDTO> },
|
||||
{ data?: BodyType<RuletypesPostablePlannedMaintenanceDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createDowntimeSchedule'];
|
||||
@@ -176,7 +175,7 @@ export const getCreateDowntimeScheduleMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createDowntimeSchedule>>,
|
||||
{ data: BodyType<RuletypesPostablePlannedMaintenanceDTO> }
|
||||
{ data?: BodyType<RuletypesPostablePlannedMaintenanceDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -190,7 +189,8 @@ export type CreateDowntimeScheduleMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createDowntimeSchedule>>
|
||||
>;
|
||||
export type CreateDowntimeScheduleMutationBody =
|
||||
BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
| BodyType<RuletypesPostablePlannedMaintenanceDTO>
|
||||
| undefined;
|
||||
export type CreateDowntimeScheduleMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -204,29 +204,29 @@ export const useCreateDowntimeSchedule = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createDowntimeSchedule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostablePlannedMaintenanceDTO> },
|
||||
{ data?: BodyType<RuletypesPostablePlannedMaintenanceDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createDowntimeSchedule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostablePlannedMaintenanceDTO> },
|
||||
{ data?: BodyType<RuletypesPostablePlannedMaintenanceDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateDowntimeScheduleMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateDowntimeScheduleMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes a downtime schedule by ID
|
||||
* @summary Delete downtime schedule
|
||||
*/
|
||||
export const deleteDowntimeScheduleByID = ({
|
||||
id,
|
||||
}: DeleteDowntimeScheduleByIDPathParameters) => {
|
||||
export const deleteDowntimeScheduleByID = (
|
||||
{ id }: DeleteDowntimeScheduleByIDPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/downtime_schedules/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -293,9 +293,7 @@ export const useDeleteDowntimeScheduleByID = <
|
||||
{ pathParams: DeleteDowntimeScheduleByIDPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteDowntimeScheduleByIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteDowntimeScheduleByIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns a downtime schedule by ID
|
||||
@@ -381,9 +379,7 @@ export function useGetDowntimeScheduleByID<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -408,13 +404,15 @@ export const invalidateGetDowntimeScheduleByID = async (
|
||||
*/
|
||||
export const updateDowntimeScheduleByID = (
|
||||
{ id }: UpdateDowntimeScheduleByIDPathParameters,
|
||||
ruletypesPostablePlannedMaintenanceDTO: BodyType<RuletypesPostablePlannedMaintenanceDTO>,
|
||||
ruletypesPostablePlannedMaintenanceDTO?: BodyType<RuletypesPostablePlannedMaintenanceDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/downtime_schedules/${id}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: ruletypesPostablePlannedMaintenanceDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -427,7 +425,7 @@ export const getUpdateDowntimeScheduleByIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateDowntimeScheduleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
data?: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -436,7 +434,7 @@ export const getUpdateDowntimeScheduleByIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateDowntimeScheduleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
data?: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -453,7 +451,7 @@ export const getUpdateDowntimeScheduleByIDMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateDowntimeScheduleByID>>,
|
||||
{
|
||||
pathParams: UpdateDowntimeScheduleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
data?: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -468,7 +466,8 @@ export type UpdateDowntimeScheduleByIDMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateDowntimeScheduleByID>>
|
||||
>;
|
||||
export type UpdateDowntimeScheduleByIDMutationBody =
|
||||
BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
| BodyType<RuletypesPostablePlannedMaintenanceDTO>
|
||||
| undefined;
|
||||
export type UpdateDowntimeScheduleByIDMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -484,7 +483,7 @@ export const useUpdateDowntimeScheduleByID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateDowntimeScheduleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
data?: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -493,11 +492,9 @@ export const useUpdateDowntimeScheduleByID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateDowntimeScheduleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
data?: BodyType<RuletypesPostablePlannedMaintenanceDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateDowntimeScheduleByIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateDowntimeScheduleByIDMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -85,9 +86,7 @@ export function useGetFeatures<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -101,9 +102,7 @@ export function useGetFieldsKeys<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,9 +197,7 @@ export function useGetFieldsValues<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -119,9 +120,7 @@ export function useGetIngestionKeys<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,7 +144,7 @@ export const invalidateGetIngestionKeys = async (
|
||||
* @summary Create ingestion key for workspace
|
||||
*/
|
||||
export const createIngestionKey = (
|
||||
gatewaytypesPostableIngestionKeyDTO: BodyType<GatewaytypesPostableIngestionKeyDTO>,
|
||||
gatewaytypesPostableIngestionKeyDTO?: BodyType<GatewaytypesPostableIngestionKeyDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateIngestionKey201>({
|
||||
@@ -164,13 +163,13 @@ export const getCreateIngestionKeyMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||
TError,
|
||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
||||
{ data?: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||
TError,
|
||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
||||
{ data?: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createIngestionKey'];
|
||||
@@ -184,7 +183,7 @@ export const getCreateIngestionKeyMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> }
|
||||
{ data?: BodyType<GatewaytypesPostableIngestionKeyDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -198,7 +197,8 @@ export type CreateIngestionKeyMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createIngestionKey>>
|
||||
>;
|
||||
export type CreateIngestionKeyMutationBody =
|
||||
BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
| BodyType<GatewaytypesPostableIngestionKeyDTO>
|
||||
| undefined;
|
||||
export type CreateIngestionKeyMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -211,29 +211,29 @@ export const useCreateIngestionKey = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||
TError,
|
||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
||||
{ data?: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createIngestionKey>>,
|
||||
TError,
|
||||
{ data: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
||||
{ data?: BodyType<GatewaytypesPostableIngestionKeyDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateIngestionKeyMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateIngestionKeyMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes an ingestion key for the workspace
|
||||
* @summary Delete ingestion key for workspace
|
||||
*/
|
||||
export const deleteIngestionKey = ({
|
||||
keyId,
|
||||
}: DeleteIngestionKeyPathParameters) => {
|
||||
export const deleteIngestionKey = (
|
||||
{ keyId }: DeleteIngestionKeyPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/gateway/ingestion_keys/${keyId}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -299,9 +299,7 @@ export const useDeleteIngestionKey = <
|
||||
{ pathParams: DeleteIngestionKeyPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteIngestionKeyMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteIngestionKeyMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint updates an ingestion key for the workspace
|
||||
@@ -309,13 +307,15 @@ export const useDeleteIngestionKey = <
|
||||
*/
|
||||
export const updateIngestionKey = (
|
||||
{ keyId }: UpdateIngestionKeyPathParameters,
|
||||
gatewaytypesPostableIngestionKeyDTO: BodyType<GatewaytypesPostableIngestionKeyDTO>,
|
||||
gatewaytypesPostableIngestionKeyDTO?: BodyType<GatewaytypesPostableIngestionKeyDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/gateway/ingestion_keys/${keyId}`,
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: gatewaytypesPostableIngestionKeyDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -328,7 +328,7 @@ export const getUpdateIngestionKeyMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -337,7 +337,7 @@ export const getUpdateIngestionKeyMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -354,7 +354,7 @@ export const getUpdateIngestionKeyMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateIngestionKey>>,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -369,7 +369,8 @@ export type UpdateIngestionKeyMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateIngestionKey>>
|
||||
>;
|
||||
export type UpdateIngestionKeyMutationBody =
|
||||
BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
| BodyType<GatewaytypesPostableIngestionKeyDTO>
|
||||
| undefined;
|
||||
export type UpdateIngestionKeyMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -384,7 +385,7 @@ export const useUpdateIngestionKey = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -393,13 +394,11 @@ export const useUpdateIngestionKey = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateIngestionKeyMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateIngestionKeyMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint creates an ingestion key limit
|
||||
@@ -407,7 +406,7 @@ export const useUpdateIngestionKey = <
|
||||
*/
|
||||
export const createIngestionKeyLimit = (
|
||||
{ keyId }: CreateIngestionKeyLimitPathParameters,
|
||||
gatewaytypesPostableIngestionKeyLimitDTO: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>,
|
||||
gatewaytypesPostableIngestionKeyLimitDTO?: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateIngestionKeyLimit201>({
|
||||
@@ -428,7 +427,7 @@ export const getCreateIngestionKeyLimitMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -437,7 +436,7 @@ export const getCreateIngestionKeyLimitMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -454,7 +453,7 @@ export const getCreateIngestionKeyLimitMutationOptions = <
|
||||
Awaited<ReturnType<typeof createIngestionKeyLimit>>,
|
||||
{
|
||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -469,7 +468,8 @@ export type CreateIngestionKeyLimitMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createIngestionKeyLimit>>
|
||||
>;
|
||||
export type CreateIngestionKeyLimitMutationBody =
|
||||
BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
| BodyType<GatewaytypesPostableIngestionKeyLimitDTO>
|
||||
| undefined;
|
||||
export type CreateIngestionKeyLimitMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -485,7 +485,7 @@ export const useCreateIngestionKeyLimit = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -494,24 +494,24 @@ export const useCreateIngestionKeyLimit = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesPostableIngestionKeyLimitDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateIngestionKeyLimitMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateIngestionKeyLimitMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes an ingestion key limit
|
||||
* @summary Delete limit for the ingestion key
|
||||
*/
|
||||
export const deleteIngestionKeyLimit = ({
|
||||
limitId,
|
||||
}: DeleteIngestionKeyLimitPathParameters) => {
|
||||
export const deleteIngestionKeyLimit = (
|
||||
{ limitId }: DeleteIngestionKeyLimitPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/gateway/ingestion_keys/limits/${limitId}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -578,9 +578,7 @@ export const useDeleteIngestionKeyLimit = <
|
||||
{ pathParams: DeleteIngestionKeyLimitPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteIngestionKeyLimitMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteIngestionKeyLimitMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint updates an ingestion key limit
|
||||
@@ -588,13 +586,15 @@ export const useDeleteIngestionKeyLimit = <
|
||||
*/
|
||||
export const updateIngestionKeyLimit = (
|
||||
{ limitId }: UpdateIngestionKeyLimitPathParameters,
|
||||
gatewaytypesUpdatableIngestionKeyLimitDTO: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>,
|
||||
gatewaytypesUpdatableIngestionKeyLimitDTO?: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/gateway/ingestion_keys/limits/${limitId}`,
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: gatewaytypesUpdatableIngestionKeyLimitDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -607,7 +607,7 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -616,7 +616,7 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -633,7 +633,7 @@ export const getUpdateIngestionKeyLimitMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateIngestionKeyLimit>>,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -648,7 +648,8 @@ export type UpdateIngestionKeyLimitMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateIngestionKeyLimit>>
|
||||
>;
|
||||
export type UpdateIngestionKeyLimitMutationBody =
|
||||
BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
| BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>
|
||||
| undefined;
|
||||
export type UpdateIngestionKeyLimitMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -664,7 +665,7 @@ export const useUpdateIngestionKeyLimit = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -673,13 +674,11 @@ export const useUpdateIngestionKeyLimit = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateIngestionKeyLimitPathParameters;
|
||||
data: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
data?: BodyType<GatewaytypesUpdatableIngestionKeyLimitDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateIngestionKeyLimitMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateIngestionKeyLimitMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns the ingestion keys for a workspace
|
||||
@@ -763,9 +762,7 @@ export function useSearchIngestionKeys<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -88,9 +89,7 @@ export function useGetGlobalConfig<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -83,9 +84,7 @@ export function useHealthz<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,9 +157,7 @@ export function useLivez<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,9 +227,7 @@ export function useReadyz<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation } from 'react-query';
|
||||
import type {
|
||||
@@ -35,7 +36,7 @@ import type { ErrorType, BodyType } from '../../../generatedAPIInstance';
|
||||
* @summary List Clusters for Infra Monitoring
|
||||
*/
|
||||
export const listClusters = (
|
||||
inframonitoringtypesPostableClustersDTO: BodyType<InframonitoringtypesPostableClustersDTO>,
|
||||
inframonitoringtypesPostableClustersDTO?: BodyType<InframonitoringtypesPostableClustersDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListClusters200>({
|
||||
@@ -54,13 +55,13 @@ export const getListClustersMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listClusters>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableClustersDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableClustersDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listClusters>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableClustersDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableClustersDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['listClusters'];
|
||||
@@ -74,7 +75,7 @@ export const getListClustersMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof listClusters>>,
|
||||
{ data: BodyType<InframonitoringtypesPostableClustersDTO> }
|
||||
{ data?: BodyType<InframonitoringtypesPostableClustersDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -88,7 +89,8 @@ export type ListClustersMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listClusters>>
|
||||
>;
|
||||
export type ListClustersMutationBody =
|
||||
BodyType<InframonitoringtypesPostableClustersDTO>;
|
||||
| BodyType<InframonitoringtypesPostableClustersDTO>
|
||||
| undefined;
|
||||
export type ListClustersMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -101,25 +103,23 @@ export const useListClusters = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listClusters>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableClustersDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableClustersDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof listClusters>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableClustersDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableClustersDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getListClustersMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getListClustersMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns a paginated list of hosts with key infrastructure metrics: CPU usage (%), memory usage (%), I/O wait (%), disk usage (%), and 15-minute load average. Each host includes its current status (active/inactive based on metrics reported in the last 10 minutes) and metadata attributes (e.g., os.type). Supports filtering via a filter expression, filtering by host status, custom groupBy to aggregate hosts by any attribute, ordering by any of the five metrics, and pagination via offset/limit. The response type is 'list' for the default host.name grouping or 'grouped_list' for custom groupBy keys. Also reports missing required metrics and whether the requested time range falls before the data retention boundary. Numeric metric fields (cpu, memory, wait, load15, diskUsage) return -1 as a sentinel when no data is available for that field.
|
||||
* @summary List Hosts for Infra Monitoring
|
||||
*/
|
||||
export const listHosts = (
|
||||
inframonitoringtypesPostableHostsDTO: BodyType<InframonitoringtypesPostableHostsDTO>,
|
||||
inframonitoringtypesPostableHostsDTO?: BodyType<InframonitoringtypesPostableHostsDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListHosts200>({
|
||||
@@ -138,13 +138,13 @@ export const getListHostsMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listHosts>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableHostsDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableHostsDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listHosts>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableHostsDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableHostsDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['listHosts'];
|
||||
@@ -158,7 +158,7 @@ export const getListHostsMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof listHosts>>,
|
||||
{ data: BodyType<InframonitoringtypesPostableHostsDTO> }
|
||||
{ data?: BodyType<InframonitoringtypesPostableHostsDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -172,7 +172,8 @@ export type ListHostsMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listHosts>>
|
||||
>;
|
||||
export type ListHostsMutationBody =
|
||||
BodyType<InframonitoringtypesPostableHostsDTO>;
|
||||
| BodyType<InframonitoringtypesPostableHostsDTO>
|
||||
| undefined;
|
||||
export type ListHostsMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -185,25 +186,23 @@ export const useListHosts = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listHosts>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableHostsDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableHostsDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof listHosts>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableHostsDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableHostsDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getListHostsMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getListHostsMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns a paginated list of Kubernetes namespaces with key aggregated pod metrics: CPU usage and memory working set (summed across pods in the group), plus per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown } from each pod's latest k8s.pod.phase value in the window). Each namespace includes metadata attributes (k8s.namespace.name, k8s.cluster.name). The response type is 'list' for the default k8s.namespace.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates pods in the group. Supports filtering via a filter expression, custom groupBy, ordering by cpu / memory, and pagination via offset/limit. Also reports missing required metrics and whether the requested time range falls before the data retention boundary. Numeric metric fields (namespaceCPU, namespaceMemory) return -1 as a sentinel when no data is available for that field.
|
||||
* @summary List Namespaces for Infra Monitoring
|
||||
*/
|
||||
export const listNamespaces = (
|
||||
inframonitoringtypesPostableNamespacesDTO: BodyType<InframonitoringtypesPostableNamespacesDTO>,
|
||||
inframonitoringtypesPostableNamespacesDTO?: BodyType<InframonitoringtypesPostableNamespacesDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListNamespaces200>({
|
||||
@@ -222,13 +221,13 @@ export const getListNamespacesMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listNamespaces>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableNamespacesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableNamespacesDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listNamespaces>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableNamespacesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableNamespacesDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['listNamespaces'];
|
||||
@@ -242,7 +241,7 @@ export const getListNamespacesMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof listNamespaces>>,
|
||||
{ data: BodyType<InframonitoringtypesPostableNamespacesDTO> }
|
||||
{ data?: BodyType<InframonitoringtypesPostableNamespacesDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -256,7 +255,8 @@ export type ListNamespacesMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listNamespaces>>
|
||||
>;
|
||||
export type ListNamespacesMutationBody =
|
||||
BodyType<InframonitoringtypesPostableNamespacesDTO>;
|
||||
| BodyType<InframonitoringtypesPostableNamespacesDTO>
|
||||
| undefined;
|
||||
export type ListNamespacesMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -269,25 +269,23 @@ export const useListNamespaces = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listNamespaces>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableNamespacesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableNamespacesDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof listNamespaces>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableNamespacesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableNamespacesDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getListNamespacesMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getListNamespacesMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns a paginated list of Kubernetes nodes with key metrics: CPU usage, CPU allocatable, memory working set, memory allocatable, per-group nodeCountsByReadiness ({ ready, notReady } from each node's latest k8s.node.condition_ready in the window) and per-group podCountsByPhase ({ pending, running, succeeded, failed, unknown } for pods scheduled on the listed nodes). Each node includes metadata attributes (k8s.node.uid, k8s.cluster.name). The response type is 'list' for the default k8s.node.name grouping (each row is one node with its current condition string: ready / not_ready / no_data) or 'grouped_list' for custom groupBy keys (each row aggregates nodes in the group; condition stays no_data). Supports filtering via a filter expression, custom groupBy, ordering by cpu / cpu_allocatable / memory / memory_allocatable, and pagination via offset/limit. Also reports missing required metrics and whether the requested time range falls before the data retention boundary. Numeric metric fields (nodeCPU, nodeCPUAllocatable, nodeMemory, nodeMemoryAllocatable) return -1 as a sentinel when no data is available for that field.
|
||||
* @summary List Nodes for Infra Monitoring
|
||||
*/
|
||||
export const listNodes = (
|
||||
inframonitoringtypesPostableNodesDTO: BodyType<InframonitoringtypesPostableNodesDTO>,
|
||||
inframonitoringtypesPostableNodesDTO?: BodyType<InframonitoringtypesPostableNodesDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListNodes200>({
|
||||
@@ -306,13 +304,13 @@ export const getListNodesMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listNodes>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableNodesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableNodesDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listNodes>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableNodesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableNodesDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['listNodes'];
|
||||
@@ -326,7 +324,7 @@ export const getListNodesMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof listNodes>>,
|
||||
{ data: BodyType<InframonitoringtypesPostableNodesDTO> }
|
||||
{ data?: BodyType<InframonitoringtypesPostableNodesDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -340,7 +338,8 @@ export type ListNodesMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listNodes>>
|
||||
>;
|
||||
export type ListNodesMutationBody =
|
||||
BodyType<InframonitoringtypesPostableNodesDTO>;
|
||||
| BodyType<InframonitoringtypesPostableNodesDTO>
|
||||
| undefined;
|
||||
export type ListNodesMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -353,25 +352,23 @@ export const useListNodes = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listNodes>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableNodesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableNodesDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof listNodes>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableNodesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableNodesDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getListNodesMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getListNodesMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns a paginated list of Kubernetes pods with key metrics: CPU usage, CPU request/limit utilization, memory working set, memory request/limit utilization, current pod phase (pending/running/succeeded/failed/unknown/no_data), and pod age (ms since start time). Each pod includes metadata attributes (namespace, node, workload owner such as deployment/statefulset/daemonset/job/cronjob, cluster). Supports filtering via a filter expression, custom groupBy to aggregate pods by any attribute, ordering by any of the six metrics (cpu, cpu_request, cpu_limit, memory, memory_request, memory_limit), and pagination via offset/limit. The response type is 'list' for the default k8s.pod.uid grouping (each row is one pod with its current phase) or 'grouped_list' for custom groupBy keys (each row aggregates pods in the group with per-phase counts under podCountsByPhase: { pending, running, succeeded, failed, unknown } derived from each pod's latest phase in the window). Also reports missing required metrics and whether the requested time range falls before the data retention boundary. Numeric metric fields (podCPU, podCPURequest, podCPULimit, podMemory, podMemoryRequest, podMemoryLimit, podAge) return -1 as a sentinel when no data is available for that field.
|
||||
* @summary List Pods for Infra Monitoring
|
||||
*/
|
||||
export const listPods = (
|
||||
inframonitoringtypesPostablePodsDTO: BodyType<InframonitoringtypesPostablePodsDTO>,
|
||||
inframonitoringtypesPostablePodsDTO?: BodyType<InframonitoringtypesPostablePodsDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListPods200>({
|
||||
@@ -390,13 +387,13 @@ export const getListPodsMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listPods>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostablePodsDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostablePodsDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listPods>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostablePodsDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostablePodsDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['listPods'];
|
||||
@@ -410,7 +407,7 @@ export const getListPodsMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof listPods>>,
|
||||
{ data: BodyType<InframonitoringtypesPostablePodsDTO> }
|
||||
{ data?: BodyType<InframonitoringtypesPostablePodsDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -424,7 +421,8 @@ export type ListPodsMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listPods>>
|
||||
>;
|
||||
export type ListPodsMutationBody =
|
||||
BodyType<InframonitoringtypesPostablePodsDTO>;
|
||||
| BodyType<InframonitoringtypesPostablePodsDTO>
|
||||
| undefined;
|
||||
export type ListPodsMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -437,25 +435,23 @@ export const useListPods = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listPods>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostablePodsDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostablePodsDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof listPods>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostablePodsDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostablePodsDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getListPodsMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getListPodsMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns a paginated list of Kubernetes persistent volume claims (PVCs) with key volume metrics: available bytes, capacity bytes, usage (capacity - available), inodes, free inodes, and used inodes. Each row also includes metadata attributes (k8s.persistentvolumeclaim.name, k8s.pod.uid, k8s.pod.name, k8s.namespace.name, k8s.node.name, k8s.statefulset.name, k8s.cluster.name). Supports filtering via a filter expression, custom groupBy to aggregate volumes by any attribute, ordering by any of the six metrics (available, capacity, usage, inodes, inodes_free, inodes_used), and pagination via offset/limit. The response type is 'list' for the default k8s.persistentvolumeclaim.name grouping or 'grouped_list' for custom groupBy keys; in both modes every row aggregates volumes in the group. Also reports missing required metrics and whether the requested time range falls before the data retention boundary. Numeric metric fields (volumeAvailable, volumeCapacity, volumeUsage, volumeInodes, volumeInodesFree, volumeInodesUsed) return -1 as a sentinel when no data is available for that field.
|
||||
* @summary List Volumes for Infra Monitoring
|
||||
*/
|
||||
export const listVolumes = (
|
||||
inframonitoringtypesPostableVolumesDTO: BodyType<InframonitoringtypesPostableVolumesDTO>,
|
||||
inframonitoringtypesPostableVolumesDTO?: BodyType<InframonitoringtypesPostableVolumesDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListVolumes200>({
|
||||
@@ -474,13 +470,13 @@ export const getListVolumesMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listVolumes>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableVolumesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableVolumesDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listVolumes>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableVolumesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableVolumesDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['listVolumes'];
|
||||
@@ -494,7 +490,7 @@ export const getListVolumesMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof listVolumes>>,
|
||||
{ data: BodyType<InframonitoringtypesPostableVolumesDTO> }
|
||||
{ data?: BodyType<InframonitoringtypesPostableVolumesDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -508,7 +504,8 @@ export type ListVolumesMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listVolumes>>
|
||||
>;
|
||||
export type ListVolumesMutationBody =
|
||||
BodyType<InframonitoringtypesPostableVolumesDTO>;
|
||||
| BodyType<InframonitoringtypesPostableVolumesDTO>
|
||||
| undefined;
|
||||
export type ListVolumesMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -521,16 +518,14 @@ export const useListVolumes = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof listVolumes>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableVolumesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableVolumesDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof listVolumes>>,
|
||||
TError,
|
||||
{ data: BodyType<InframonitoringtypesPostableVolumesDTO> },
|
||||
{ data?: BodyType<InframonitoringtypesPostableVolumesDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getListVolumesMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getListVolumesMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -109,9 +110,7 @@ export function useListLLMPricingRules<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,13 +134,15 @@ export const invalidateListLLMPricingRules = async (
|
||||
* @summary Create or update pricing rules
|
||||
*/
|
||||
export const createOrUpdateLLMPricingRules = (
|
||||
llmpricingruletypesUpdatableLLMPricingRulesDTO: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO>,
|
||||
llmpricingruletypesUpdatableLLMPricingRulesDTO?: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/llm_pricing_rules`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: llmpricingruletypesUpdatableLLMPricingRulesDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -152,13 +153,13 @@ export const getCreateOrUpdateLLMPricingRulesMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createOrUpdateLLMPricingRules>>,
|
||||
TError,
|
||||
{ data: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> },
|
||||
{ data?: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createOrUpdateLLMPricingRules>>,
|
||||
TError,
|
||||
{ data: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> },
|
||||
{ data?: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createOrUpdateLLMPricingRules'];
|
||||
@@ -172,7 +173,7 @@ export const getCreateOrUpdateLLMPricingRulesMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createOrUpdateLLMPricingRules>>,
|
||||
{ data: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> }
|
||||
{ data?: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -186,7 +187,8 @@ export type CreateOrUpdateLLMPricingRulesMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createOrUpdateLLMPricingRules>>
|
||||
>;
|
||||
export type CreateOrUpdateLLMPricingRulesMutationBody =
|
||||
BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO>;
|
||||
| BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO>
|
||||
| undefined;
|
||||
export type CreateOrUpdateLLMPricingRulesMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -200,30 +202,29 @@ export const useCreateOrUpdateLLMPricingRules = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createOrUpdateLLMPricingRules>>,
|
||||
TError,
|
||||
{ data: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> },
|
||||
{ data?: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createOrUpdateLLMPricingRules>>,
|
||||
TError,
|
||||
{ data: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> },
|
||||
{ data?: BodyType<LlmpricingruletypesUpdatableLLMPricingRulesDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions =
|
||||
getCreateOrUpdateLLMPricingRulesMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateOrUpdateLLMPricingRulesMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Hard-deletes a pricing rule. If auto-synced, it will be recreated on the next sync cycle.
|
||||
* @summary Delete a pricing rule
|
||||
*/
|
||||
export const deleteLLMPricingRule = ({
|
||||
id,
|
||||
}: DeleteLLMPricingRulePathParameters) => {
|
||||
export const deleteLLMPricingRule = (
|
||||
{ id }: DeleteLLMPricingRulePathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/llm_pricing_rules/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -290,9 +291,7 @@ export const useDeleteLLMPricingRule = <
|
||||
{ pathParams: DeleteLLMPricingRulePathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteLLMPricingRuleMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteLLMPricingRuleMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns a single LLM pricing rule by ID.
|
||||
@@ -377,9 +376,7 @@ export function useGetLLMPricingRule<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -33,7 +34,7 @@ import type { ErrorType, BodyType } from '../../../generatedAPIInstance';
|
||||
* @summary Export raw data
|
||||
*/
|
||||
export const handleExportRawDataPOST = (
|
||||
querybuildertypesv5QueryRangeRequestDTO: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
|
||||
querybuildertypesv5QueryRangeRequestDTO?: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
|
||||
params?: HandleExportRawDataPOSTParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
@@ -55,7 +56,7 @@ export const getHandleExportRawDataPOSTMutationOptions = <
|
||||
Awaited<ReturnType<typeof handleExportRawDataPOST>>,
|
||||
TError,
|
||||
{
|
||||
data: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
params?: HandleExportRawDataPOSTParams;
|
||||
},
|
||||
TContext
|
||||
@@ -64,7 +65,7 @@ export const getHandleExportRawDataPOSTMutationOptions = <
|
||||
Awaited<ReturnType<typeof handleExportRawDataPOST>>,
|
||||
TError,
|
||||
{
|
||||
data: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
params?: HandleExportRawDataPOSTParams;
|
||||
},
|
||||
TContext
|
||||
@@ -81,7 +82,7 @@ export const getHandleExportRawDataPOSTMutationOptions = <
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof handleExportRawDataPOST>>,
|
||||
{
|
||||
data: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
params?: HandleExportRawDataPOSTParams;
|
||||
}
|
||||
> = (props) => {
|
||||
@@ -97,7 +98,8 @@ export type HandleExportRawDataPOSTMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof handleExportRawDataPOST>>
|
||||
>;
|
||||
export type HandleExportRawDataPOSTMutationBody =
|
||||
BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
| BodyType<Querybuildertypesv5QueryRangeRequestDTO>
|
||||
| undefined;
|
||||
export type HandleExportRawDataPOSTMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -112,7 +114,7 @@ export const useHandleExportRawDataPOST = <
|
||||
Awaited<ReturnType<typeof handleExportRawDataPOST>>,
|
||||
TError,
|
||||
{
|
||||
data: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
params?: HandleExportRawDataPOSTParams;
|
||||
},
|
||||
TContext
|
||||
@@ -121,14 +123,12 @@ export const useHandleExportRawDataPOST = <
|
||||
Awaited<ReturnType<typeof handleExportRawDataPOST>>,
|
||||
TError,
|
||||
{
|
||||
data: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
params?: HandleExportRawDataPOSTParams;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getHandleExportRawDataPOSTMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getHandleExportRawDataPOSTMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoints promotes and indexes paths
|
||||
@@ -198,9 +198,7 @@ export function useListPromotedAndIndexedPaths<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,7 +221,7 @@ export const invalidateListPromotedAndIndexedPaths = async (
|
||||
* @summary Promote and index paths
|
||||
*/
|
||||
export const handlePromoteAndIndexPaths = (
|
||||
promotetypesPromotePathDTONull: BodyType<
|
||||
promotetypesPromotePathDTONull?: BodyType<
|
||||
PromotetypesPromotePathDTO[] | null
|
||||
> | null,
|
||||
signal?: AbortSignal,
|
||||
@@ -244,13 +242,13 @@ export const getHandlePromoteAndIndexPathsMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||
TError,
|
||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> },
|
||||
{ data?: BodyType<PromotetypesPromotePathDTO[] | null> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||
TError,
|
||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> },
|
||||
{ data?: BodyType<PromotetypesPromotePathDTO[] | null> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['handlePromoteAndIndexPaths'];
|
||||
@@ -264,7 +262,7 @@ export const getHandlePromoteAndIndexPathsMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> }
|
||||
{ data?: BodyType<PromotetypesPromotePathDTO[] | null> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -277,9 +275,9 @@ export const getHandlePromoteAndIndexPathsMutationOptions = <
|
||||
export type HandlePromoteAndIndexPathsMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>
|
||||
>;
|
||||
export type HandlePromoteAndIndexPathsMutationBody = BodyType<
|
||||
PromotetypesPromotePathDTO[] | null
|
||||
>;
|
||||
export type HandlePromoteAndIndexPathsMutationBody =
|
||||
| BodyType<PromotetypesPromotePathDTO[] | null>
|
||||
| undefined;
|
||||
export type HandlePromoteAndIndexPathsMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -293,16 +291,14 @@ export const useHandlePromoteAndIndexPaths = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||
TError,
|
||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> },
|
||||
{ data?: BodyType<PromotetypesPromotePathDTO[] | null> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof handlePromoteAndIndexPaths>>,
|
||||
TError,
|
||||
{ data: BodyType<PromotetypesPromotePathDTO[] | null> },
|
||||
{ data?: BodyType<PromotetypesPromotePathDTO[] | null> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getHandlePromoteAndIndexPathsMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getHandlePromoteAndIndexPathsMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -122,9 +123,7 @@ export function useListMetrics<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,9 +225,7 @@ export function useGetMetricAlerts<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -343,9 +340,7 @@ export function useGetMetricAttributes<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -451,9 +446,7 @@ export function useGetMetricDashboards<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -558,9 +551,7 @@ export function useGetMetricHighlights<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -662,9 +653,7 @@ export function useGetMetricMetadata<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -689,7 +678,7 @@ export const invalidateGetMetricMetadata = async (
|
||||
*/
|
||||
export const updateMetricMetadata = (
|
||||
{ metricName }: UpdateMetricMetadataPathParameters,
|
||||
metricsexplorertypesUpdateMetricMetadataRequestDTO: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>,
|
||||
metricsexplorertypesUpdateMetricMetadataRequestDTO?: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
@@ -710,7 +699,7 @@ export const getUpdateMetricMetadataMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateMetricMetadataPathParameters;
|
||||
data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
data?: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -719,7 +708,7 @@ export const getUpdateMetricMetadataMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateMetricMetadataPathParameters;
|
||||
data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
data?: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -736,7 +725,7 @@ export const getUpdateMetricMetadataMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateMetricMetadata>>,
|
||||
{
|
||||
pathParams: UpdateMetricMetadataPathParameters;
|
||||
data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
data?: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -751,7 +740,8 @@ export type UpdateMetricMetadataMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateMetricMetadata>>
|
||||
>;
|
||||
export type UpdateMetricMetadataMutationBody =
|
||||
BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
| BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>
|
||||
| undefined;
|
||||
export type UpdateMetricMetadataMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -767,7 +757,7 @@ export const useUpdateMetricMetadata = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateMetricMetadataPathParameters;
|
||||
data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
data?: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -776,20 +766,18 @@ export const useUpdateMetricMetadata = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateMetricMetadataPathParameters;
|
||||
data: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
data?: BodyType<MetricsexplorertypesUpdateMetricMetadataRequestDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateMetricMetadataMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateMetricMetadataMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns raw time series data points for a metric within a time range (max 30 minutes). Each series includes labels and timestamp/value pairs.
|
||||
* @summary Inspect raw metric data points
|
||||
*/
|
||||
export const inspectMetrics = (
|
||||
metricsexplorertypesInspectMetricsRequestDTO: BodyType<MetricsexplorertypesInspectMetricsRequestDTO>,
|
||||
metricsexplorertypesInspectMetricsRequestDTO?: BodyType<MetricsexplorertypesInspectMetricsRequestDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<InspectMetrics200>({
|
||||
@@ -808,13 +796,13 @@ export const getInspectMetricsMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof inspectMetrics>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof inspectMetrics>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['inspectMetrics'];
|
||||
@@ -828,7 +816,7 @@ export const getInspectMetricsMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof inspectMetrics>>,
|
||||
{ data: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> }
|
||||
{ data?: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -842,7 +830,8 @@ export type InspectMetricsMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof inspectMetrics>>
|
||||
>;
|
||||
export type InspectMetricsMutationBody =
|
||||
BodyType<MetricsexplorertypesInspectMetricsRequestDTO>;
|
||||
| BodyType<MetricsexplorertypesInspectMetricsRequestDTO>
|
||||
| undefined;
|
||||
export type InspectMetricsMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -855,18 +844,16 @@ export const useInspectMetrics = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof inspectMetrics>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof inspectMetrics>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesInspectMetricsRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getInspectMetricsMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getInspectMetricsMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Lightweight endpoint that checks if any non-SigNoz metrics have been ingested, used for onboarding status detection
|
||||
@@ -936,9 +923,7 @@ export function useGetMetricsOnboardingStatus<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -961,7 +946,7 @@ export const invalidateGetMetricsOnboardingStatus = async (
|
||||
* @summary Get metrics statistics
|
||||
*/
|
||||
export const getMetricsStats = (
|
||||
metricsexplorertypesStatsRequestDTO: BodyType<MetricsexplorertypesStatsRequestDTO>,
|
||||
metricsexplorertypesStatsRequestDTO?: BodyType<MetricsexplorertypesStatsRequestDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<GetMetricsStats200>({
|
||||
@@ -980,13 +965,13 @@ export const getGetMetricsStatsMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesStatsRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesStatsRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesStatsRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesStatsRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['getMetricsStats'];
|
||||
@@ -1000,7 +985,7 @@ export const getGetMetricsStatsMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||
{ data: BodyType<MetricsexplorertypesStatsRequestDTO> }
|
||||
{ data?: BodyType<MetricsexplorertypesStatsRequestDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -1014,7 +999,8 @@ export type GetMetricsStatsMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof getMetricsStats>>
|
||||
>;
|
||||
export type GetMetricsStatsMutationBody =
|
||||
BodyType<MetricsexplorertypesStatsRequestDTO>;
|
||||
| BodyType<MetricsexplorertypesStatsRequestDTO>
|
||||
| undefined;
|
||||
export type GetMetricsStatsMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -1027,25 +1013,23 @@ export const useGetMetricsStats = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesStatsRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesStatsRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof getMetricsStats>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesStatsRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesStatsRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getGetMetricsStatsMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getGetMetricsStatsMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns a treemap visualization showing the proportional distribution of metrics by sample count or time series count
|
||||
* @summary Get metrics treemap
|
||||
*/
|
||||
export const getMetricsTreemap = (
|
||||
metricsexplorertypesTreemapRequestDTO: BodyType<MetricsexplorertypesTreemapRequestDTO>,
|
||||
metricsexplorertypesTreemapRequestDTO?: BodyType<MetricsexplorertypesTreemapRequestDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<GetMetricsTreemap200>({
|
||||
@@ -1064,13 +1048,13 @@ export const getGetMetricsTreemapMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesTreemapRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesTreemapRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesTreemapRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesTreemapRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['getMetricsTreemap'];
|
||||
@@ -1084,7 +1068,7 @@ export const getGetMetricsTreemapMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||
{ data: BodyType<MetricsexplorertypesTreemapRequestDTO> }
|
||||
{ data?: BodyType<MetricsexplorertypesTreemapRequestDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -1098,7 +1082,8 @@ export type GetMetricsTreemapMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof getMetricsTreemap>>
|
||||
>;
|
||||
export type GetMetricsTreemapMutationBody =
|
||||
BodyType<MetricsexplorertypesTreemapRequestDTO>;
|
||||
| BodyType<MetricsexplorertypesTreemapRequestDTO>
|
||||
| undefined;
|
||||
export type GetMetricsTreemapMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -1111,16 +1096,14 @@ export const useGetMetricsTreemap = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesTreemapRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesTreemapRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof getMetricsTreemap>>,
|
||||
TError,
|
||||
{ data: BodyType<MetricsexplorertypesTreemapRequestDTO> },
|
||||
{ data?: BodyType<MetricsexplorertypesTreemapRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getGetMetricsTreemapMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getGetMetricsTreemapMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -92,9 +93,7 @@ export function useGetMyOrganization<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,13 +116,15 @@ export const invalidateGetMyOrganization = async (
|
||||
* @summary Update my organization
|
||||
*/
|
||||
export const updateMyOrganization = (
|
||||
typesOrganizationDTO: BodyType<TypesOrganizationDTO>,
|
||||
typesOrganizationDTO?: BodyType<TypesOrganizationDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/orgs/me`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: typesOrganizationDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -134,13 +135,13 @@ export const getUpdateMyOrganizationMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesOrganizationDTO> },
|
||||
{ data?: BodyType<TypesOrganizationDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesOrganizationDTO> },
|
||||
{ data?: BodyType<TypesOrganizationDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['updateMyOrganization'];
|
||||
@@ -154,7 +155,7 @@ export const getUpdateMyOrganizationMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||
{ data: BodyType<TypesOrganizationDTO> }
|
||||
{ data?: BodyType<TypesOrganizationDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -167,7 +168,9 @@ export const getUpdateMyOrganizationMutationOptions = <
|
||||
export type UpdateMyOrganizationMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateMyOrganization>>
|
||||
>;
|
||||
export type UpdateMyOrganizationMutationBody = BodyType<TypesOrganizationDTO>;
|
||||
export type UpdateMyOrganizationMutationBody =
|
||||
| BodyType<TypesOrganizationDTO>
|
||||
| undefined;
|
||||
export type UpdateMyOrganizationMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -181,16 +184,14 @@ export const useUpdateMyOrganization = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesOrganizationDTO> },
|
||||
{ data?: BodyType<TypesOrganizationDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof updateMyOrganization>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesOrganizationDTO> },
|
||||
{ data?: BodyType<TypesOrganizationDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateMyOrganizationMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateMyOrganizationMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -99,9 +100,7 @@ export function useListOrgPreferences<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,9 +201,7 @@ export function useGetOrgPreference<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,13 +226,15 @@ export const invalidateGetOrgPreference = async (
|
||||
*/
|
||||
export const updateOrgPreference = (
|
||||
{ name }: UpdateOrgPreferencePathParameters,
|
||||
preferencetypesUpdatablePreferenceDTO: BodyType<PreferencetypesUpdatablePreferenceDTO>,
|
||||
preferencetypesUpdatablePreferenceDTO?: BodyType<PreferencetypesUpdatablePreferenceDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/org/preferences/${name}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: preferencetypesUpdatablePreferenceDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -248,7 +247,7 @@ export const getUpdateOrgPreferenceMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateOrgPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -257,7 +256,7 @@ export const getUpdateOrgPreferenceMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateOrgPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -274,7 +273,7 @@ export const getUpdateOrgPreferenceMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateOrgPreference>>,
|
||||
{
|
||||
pathParams: UpdateOrgPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -289,7 +288,8 @@ export type UpdateOrgPreferenceMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateOrgPreference>>
|
||||
>;
|
||||
export type UpdateOrgPreferenceMutationBody =
|
||||
BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
| BodyType<PreferencetypesUpdatablePreferenceDTO>
|
||||
| undefined;
|
||||
export type UpdateOrgPreferenceMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -305,7 +305,7 @@ export const useUpdateOrgPreference = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateOrgPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -314,13 +314,11 @@ export const useUpdateOrgPreference = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateOrgPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateOrgPreferenceMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateOrgPreferenceMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint lists all user preferences
|
||||
@@ -388,9 +386,7 @@ export function useListUserPreferences<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -491,9 +487,7 @@ export function useGetUserPreference<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -518,13 +512,15 @@ export const invalidateGetUserPreference = async (
|
||||
*/
|
||||
export const updateUserPreference = (
|
||||
{ name }: UpdateUserPreferencePathParameters,
|
||||
preferencetypesUpdatablePreferenceDTO: BodyType<PreferencetypesUpdatablePreferenceDTO>,
|
||||
preferencetypesUpdatablePreferenceDTO?: BodyType<PreferencetypesUpdatablePreferenceDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/user/preferences/${name}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: preferencetypesUpdatablePreferenceDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -537,7 +533,7 @@ export const getUpdateUserPreferenceMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -546,7 +542,7 @@ export const getUpdateUserPreferenceMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -563,7 +559,7 @@ export const getUpdateUserPreferenceMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateUserPreference>>,
|
||||
{
|
||||
pathParams: UpdateUserPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -578,7 +574,8 @@ export type UpdateUserPreferenceMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateUserPreference>>
|
||||
>;
|
||||
export type UpdateUserPreferenceMutationBody =
|
||||
BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
| BodyType<PreferencetypesUpdatablePreferenceDTO>
|
||||
| undefined;
|
||||
export type UpdateUserPreferenceMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -594,7 +591,7 @@ export const useUpdateUserPreference = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -603,11 +600,9 @@ export const useUpdateUserPreference = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserPreferencePathParameters;
|
||||
data: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
data?: BodyType<PreferencetypesUpdatablePreferenceDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateUserPreferenceMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateUserPreferenceMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation } from 'react-query';
|
||||
import type {
|
||||
@@ -26,7 +27,7 @@ import type { ErrorType, BodyType } from '../../../generatedAPIInstance';
|
||||
* @summary Query range
|
||||
*/
|
||||
export const queryRangeV5 = (
|
||||
querybuildertypesv5QueryRangeRequestDTO: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
|
||||
querybuildertypesv5QueryRangeRequestDTO?: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<QueryRangeV5200>({
|
||||
@@ -45,13 +46,13 @@ export const getQueryRangeV5MutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
||||
TError,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
||||
TError,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['queryRangeV5'];
|
||||
@@ -65,7 +66,7 @@ export const getQueryRangeV5MutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> }
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -79,7 +80,8 @@ export type QueryRangeV5MutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof queryRangeV5>>
|
||||
>;
|
||||
export type QueryRangeV5MutationBody =
|
||||
BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
| BodyType<Querybuildertypesv5QueryRangeRequestDTO>
|
||||
| undefined;
|
||||
export type QueryRangeV5MutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -92,25 +94,23 @@ export const useQueryRangeV5 = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
||||
TError,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof queryRangeV5>>,
|
||||
TError,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getQueryRangeV5MutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getQueryRangeV5MutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Replace variables in a query
|
||||
* @summary Replace variables
|
||||
*/
|
||||
export const replaceVariables = (
|
||||
querybuildertypesv5QueryRangeRequestDTO: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
|
||||
querybuildertypesv5QueryRangeRequestDTO?: BodyType<Querybuildertypesv5QueryRangeRequestDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ReplaceVariables200>({
|
||||
@@ -129,13 +129,13 @@ export const getReplaceVariablesMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof replaceVariables>>,
|
||||
TError,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof replaceVariables>>,
|
||||
TError,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['replaceVariables'];
|
||||
@@ -149,7 +149,7 @@ export const getReplaceVariablesMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof replaceVariables>>,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> }
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -163,7 +163,8 @@ export type ReplaceVariablesMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof replaceVariables>>
|
||||
>;
|
||||
export type ReplaceVariablesMutationBody =
|
||||
BodyType<Querybuildertypesv5QueryRangeRequestDTO>;
|
||||
| BodyType<Querybuildertypesv5QueryRangeRequestDTO>
|
||||
| undefined;
|
||||
export type ReplaceVariablesMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -176,16 +177,14 @@ export const useReplaceVariables = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof replaceVariables>>,
|
||||
TError,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof replaceVariables>>,
|
||||
TError,
|
||||
{ data: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
{ data?: BodyType<Querybuildertypesv5QueryRangeRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getReplaceVariablesMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getReplaceVariablesMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -94,9 +95,7 @@ export function useListRoles<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +118,7 @@ export const invalidateListRoles = async (
|
||||
* @summary Create role
|
||||
*/
|
||||
export const createRole = (
|
||||
authtypesPostableRoleDTO: BodyType<AuthtypesPostableRoleDTO>,
|
||||
authtypesPostableRoleDTO?: BodyType<AuthtypesPostableRoleDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateRole201>({
|
||||
@@ -138,13 +137,13 @@ export const getCreateRoleMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createRole>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableRoleDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableRoleDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createRole>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableRoleDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableRoleDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createRole'];
|
||||
@@ -158,7 +157,7 @@ export const getCreateRoleMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createRole>>,
|
||||
{ data: BodyType<AuthtypesPostableRoleDTO> }
|
||||
{ data?: BodyType<AuthtypesPostableRoleDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -171,7 +170,9 @@ export const getCreateRoleMutationOptions = <
|
||||
export type CreateRoleMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createRole>>
|
||||
>;
|
||||
export type CreateRoleMutationBody = BodyType<AuthtypesPostableRoleDTO>;
|
||||
export type CreateRoleMutationBody =
|
||||
| BodyType<AuthtypesPostableRoleDTO>
|
||||
| undefined;
|
||||
export type CreateRoleMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -184,27 +185,29 @@ export const useCreateRole = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createRole>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableRoleDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableRoleDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createRole>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableRoleDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableRoleDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateRoleMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateRoleMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes a role
|
||||
* @summary Delete role
|
||||
*/
|
||||
export const deleteRole = ({ id }: DeleteRolePathParameters) => {
|
||||
export const deleteRole = (
|
||||
{ id }: DeleteRolePathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/roles/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -270,9 +273,7 @@ export const useDeleteRole = <
|
||||
{ pathParams: DeleteRolePathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteRoleMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteRoleMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint gets a role
|
||||
@@ -344,9 +345,7 @@ export function useGetRole<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -371,13 +370,15 @@ export const invalidateGetRole = async (
|
||||
*/
|
||||
export const patchRole = (
|
||||
{ id }: PatchRolePathParameters,
|
||||
authtypesPatchableRoleDTO: BodyType<AuthtypesPatchableRoleDTO>,
|
||||
authtypesPatchableRoleDTO?: BodyType<AuthtypesPatchableRoleDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/roles/${id}`,
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: authtypesPatchableRoleDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -390,7 +391,7 @@ export const getPatchRoleMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchRolePathParameters;
|
||||
data: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
data?: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -399,7 +400,7 @@ export const getPatchRoleMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchRolePathParameters;
|
||||
data: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
data?: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -416,7 +417,7 @@ export const getPatchRoleMutationOptions = <
|
||||
Awaited<ReturnType<typeof patchRole>>,
|
||||
{
|
||||
pathParams: PatchRolePathParameters;
|
||||
data: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
data?: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -430,7 +431,9 @@ export const getPatchRoleMutationOptions = <
|
||||
export type PatchRoleMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof patchRole>>
|
||||
>;
|
||||
export type PatchRoleMutationBody = BodyType<AuthtypesPatchableRoleDTO>;
|
||||
export type PatchRoleMutationBody =
|
||||
| BodyType<AuthtypesPatchableRoleDTO>
|
||||
| undefined;
|
||||
export type PatchRoleMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -445,7 +448,7 @@ export const usePatchRole = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchRolePathParameters;
|
||||
data: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
data?: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -454,13 +457,11 @@ export const usePatchRole = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchRolePathParameters;
|
||||
data: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
data?: BodyType<AuthtypesPatchableRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getPatchRoleMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getPatchRoleMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Gets all objects connected to the specified role via a given relation type
|
||||
@@ -544,9 +545,7 @@ export function useGetObjects<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -571,13 +570,15 @@ export const invalidateGetObjects = async (
|
||||
*/
|
||||
export const patchObjects = (
|
||||
{ id, relation }: PatchObjectsPathParameters,
|
||||
coretypesPatchableObjectsDTO: BodyType<CoretypesPatchableObjectsDTO>,
|
||||
coretypesPatchableObjectsDTO?: BodyType<CoretypesPatchableObjectsDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/roles/${id}/relations/${relation}/objects`,
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: coretypesPatchableObjectsDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -590,7 +591,7 @@ export const getPatchObjectsMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchObjectsPathParameters;
|
||||
data: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
data?: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -599,7 +600,7 @@ export const getPatchObjectsMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchObjectsPathParameters;
|
||||
data: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
data?: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -616,7 +617,7 @@ export const getPatchObjectsMutationOptions = <
|
||||
Awaited<ReturnType<typeof patchObjects>>,
|
||||
{
|
||||
pathParams: PatchObjectsPathParameters;
|
||||
data: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
data?: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -630,7 +631,9 @@ export const getPatchObjectsMutationOptions = <
|
||||
export type PatchObjectsMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof patchObjects>>
|
||||
>;
|
||||
export type PatchObjectsMutationBody = BodyType<CoretypesPatchableObjectsDTO>;
|
||||
export type PatchObjectsMutationBody =
|
||||
| BodyType<CoretypesPatchableObjectsDTO>
|
||||
| undefined;
|
||||
export type PatchObjectsMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -645,7 +648,7 @@ export const usePatchObjects = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchObjectsPathParameters;
|
||||
data: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
data?: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -654,11 +657,9 @@ export const usePatchObjects = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchObjectsPathParameters;
|
||||
data: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
data?: BodyType<CoretypesPatchableObjectsDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getPatchObjectsMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getPatchObjectsMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -98,9 +99,7 @@ export function useGetAllRoutePolicies<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +122,7 @@ export const invalidateGetAllRoutePolicies = async (
|
||||
* @summary Create route policy
|
||||
*/
|
||||
export const createRoutePolicy = (
|
||||
alertmanagertypesPostableRoutePolicyDTO: BodyType<AlertmanagertypesPostableRoutePolicyDTO>,
|
||||
alertmanagertypesPostableRoutePolicyDTO?: BodyType<AlertmanagertypesPostableRoutePolicyDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateRoutePolicy201>({
|
||||
@@ -142,13 +141,13 @@ export const getCreateRoutePolicyMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createRoutePolicy>>,
|
||||
TError,
|
||||
{ data: BodyType<AlertmanagertypesPostableRoutePolicyDTO> },
|
||||
{ data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createRoutePolicy>>,
|
||||
TError,
|
||||
{ data: BodyType<AlertmanagertypesPostableRoutePolicyDTO> },
|
||||
{ data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createRoutePolicy'];
|
||||
@@ -162,7 +161,7 @@ export const getCreateRoutePolicyMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createRoutePolicy>>,
|
||||
{ data: BodyType<AlertmanagertypesPostableRoutePolicyDTO> }
|
||||
{ data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -176,7 +175,8 @@ export type CreateRoutePolicyMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createRoutePolicy>>
|
||||
>;
|
||||
export type CreateRoutePolicyMutationBody =
|
||||
BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
| BodyType<AlertmanagertypesPostableRoutePolicyDTO>
|
||||
| undefined;
|
||||
export type CreateRoutePolicyMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -189,29 +189,29 @@ export const useCreateRoutePolicy = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createRoutePolicy>>,
|
||||
TError,
|
||||
{ data: BodyType<AlertmanagertypesPostableRoutePolicyDTO> },
|
||||
{ data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createRoutePolicy>>,
|
||||
TError,
|
||||
{ data: BodyType<AlertmanagertypesPostableRoutePolicyDTO> },
|
||||
{ data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateRoutePolicyMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateRoutePolicyMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes a route policy by ID
|
||||
* @summary Delete route policy
|
||||
*/
|
||||
export const deleteRoutePolicyByID = ({
|
||||
id,
|
||||
}: DeleteRoutePolicyByIDPathParameters) => {
|
||||
export const deleteRoutePolicyByID = (
|
||||
{ id }: DeleteRoutePolicyByIDPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/route_policies/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -278,9 +278,7 @@ export const useDeleteRoutePolicyByID = <
|
||||
{ pathParams: DeleteRoutePolicyByIDPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteRoutePolicyByIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteRoutePolicyByIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns a route policy by ID
|
||||
@@ -365,9 +363,7 @@ export function useGetRoutePolicyByID<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -392,13 +388,15 @@ export const invalidateGetRoutePolicyByID = async (
|
||||
*/
|
||||
export const updateRoutePolicy = (
|
||||
{ id }: UpdateRoutePolicyPathParameters,
|
||||
alertmanagertypesPostableRoutePolicyDTO: BodyType<AlertmanagertypesPostableRoutePolicyDTO>,
|
||||
alertmanagertypesPostableRoutePolicyDTO?: BodyType<AlertmanagertypesPostableRoutePolicyDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<UpdateRoutePolicy200>({
|
||||
url: `/api/v1/route_policies/${id}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: alertmanagertypesPostableRoutePolicyDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -411,7 +409,7 @@ export const getUpdateRoutePolicyMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateRoutePolicyPathParameters;
|
||||
data: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -420,7 +418,7 @@ export const getUpdateRoutePolicyMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateRoutePolicyPathParameters;
|
||||
data: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -437,7 +435,7 @@ export const getUpdateRoutePolicyMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateRoutePolicy>>,
|
||||
{
|
||||
pathParams: UpdateRoutePolicyPathParameters;
|
||||
data: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -452,7 +450,8 @@ export type UpdateRoutePolicyMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateRoutePolicy>>
|
||||
>;
|
||||
export type UpdateRoutePolicyMutationBody =
|
||||
BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
| BodyType<AlertmanagertypesPostableRoutePolicyDTO>
|
||||
| undefined;
|
||||
export type UpdateRoutePolicyMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -467,7 +466,7 @@ export const useUpdateRoutePolicy = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateRoutePolicyPathParameters;
|
||||
data: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -476,11 +475,9 @@ export const useUpdateRoutePolicy = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateRoutePolicyPathParameters;
|
||||
data: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
data?: BodyType<AlertmanagertypesPostableRoutePolicyDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateRoutePolicyMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateRoutePolicyMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -110,9 +111,7 @@ export function useListRules<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +134,7 @@ export const invalidateListRules = async (
|
||||
* @summary Create alert rule
|
||||
*/
|
||||
export const createRule = (
|
||||
ruletypesPostableRuleDTO: BodyType<RuletypesPostableRuleDTO>,
|
||||
ruletypesPostableRuleDTO?: BodyType<RuletypesPostableRuleDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateRule201>({
|
||||
@@ -154,13 +153,13 @@ export const getCreateRuleMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createRule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createRule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createRule'];
|
||||
@@ -174,7 +173,7 @@ export const getCreateRuleMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createRule>>,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> }
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -187,7 +186,9 @@ export const getCreateRuleMutationOptions = <
|
||||
export type CreateRuleMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createRule>>
|
||||
>;
|
||||
export type CreateRuleMutationBody = BodyType<RuletypesPostableRuleDTO>;
|
||||
export type CreateRuleMutationBody =
|
||||
| BodyType<RuletypesPostableRuleDTO>
|
||||
| undefined;
|
||||
export type CreateRuleMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -200,27 +201,29 @@ export const useCreateRule = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createRule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createRule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateRuleMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateRuleMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes an alert rule by ID
|
||||
* @summary Delete alert rule
|
||||
*/
|
||||
export const deleteRuleByID = ({ id }: DeleteRuleByIDPathParameters) => {
|
||||
export const deleteRuleByID = (
|
||||
{ id }: DeleteRuleByIDPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/rules/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -286,9 +289,7 @@ export const useDeleteRuleByID = <
|
||||
{ pathParams: DeleteRuleByIDPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteRuleByIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteRuleByIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns an alert rule by ID
|
||||
@@ -370,9 +371,7 @@ export function useGetRuleByID<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -397,13 +396,15 @@ export const invalidateGetRuleByID = async (
|
||||
*/
|
||||
export const patchRuleByID = (
|
||||
{ id }: PatchRuleByIDPathParameters,
|
||||
ruletypesPostableRuleDTO: BodyType<RuletypesPostableRuleDTO>,
|
||||
ruletypesPostableRuleDTO?: BodyType<RuletypesPostableRuleDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<PatchRuleByID200>({
|
||||
url: `/api/v2/rules/${id}`,
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: ruletypesPostableRuleDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -416,7 +417,7 @@ export const getPatchRuleByIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -425,7 +426,7 @@ export const getPatchRuleByIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -442,7 +443,7 @@ export const getPatchRuleByIDMutationOptions = <
|
||||
Awaited<ReturnType<typeof patchRuleByID>>,
|
||||
{
|
||||
pathParams: PatchRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -456,7 +457,9 @@ export const getPatchRuleByIDMutationOptions = <
|
||||
export type PatchRuleByIDMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof patchRuleByID>>
|
||||
>;
|
||||
export type PatchRuleByIDMutationBody = BodyType<RuletypesPostableRuleDTO>;
|
||||
export type PatchRuleByIDMutationBody =
|
||||
| BodyType<RuletypesPostableRuleDTO>
|
||||
| undefined;
|
||||
export type PatchRuleByIDMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -471,7 +474,7 @@ export const usePatchRuleByID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -480,13 +483,11 @@ export const usePatchRuleByID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: PatchRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getPatchRuleByIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getPatchRuleByIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint updates an alert rule by ID
|
||||
@@ -494,13 +495,15 @@ export const usePatchRuleByID = <
|
||||
*/
|
||||
export const updateRuleByID = (
|
||||
{ id }: UpdateRuleByIDPathParameters,
|
||||
ruletypesPostableRuleDTO: BodyType<RuletypesPostableRuleDTO>,
|
||||
ruletypesPostableRuleDTO?: BodyType<RuletypesPostableRuleDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/rules/${id}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: ruletypesPostableRuleDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -513,7 +516,7 @@ export const getUpdateRuleByIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -522,7 +525,7 @@ export const getUpdateRuleByIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -539,7 +542,7 @@ export const getUpdateRuleByIDMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateRuleByID>>,
|
||||
{
|
||||
pathParams: UpdateRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -553,7 +556,9 @@ export const getUpdateRuleByIDMutationOptions = <
|
||||
export type UpdateRuleByIDMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateRuleByID>>
|
||||
>;
|
||||
export type UpdateRuleByIDMutationBody = BodyType<RuletypesPostableRuleDTO>;
|
||||
export type UpdateRuleByIDMutationBody =
|
||||
| BodyType<RuletypesPostableRuleDTO>
|
||||
| undefined;
|
||||
export type UpdateRuleByIDMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -568,7 +573,7 @@ export const useUpdateRuleByID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -577,13 +582,11 @@ export const useUpdateRuleByID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateRuleByIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateRuleByIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns distinct label keys from rule history entries for the selected range.
|
||||
@@ -681,9 +684,7 @@ export function useGetRuleHistoryFilterKeys<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -800,9 +801,7 @@ export function useGetRuleHistoryFilterValues<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -919,9 +918,7 @@ export function useGetRuleHistoryOverallStatus<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1036,9 +1033,7 @@ export function useGetRuleHistoryStats<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1154,9 +1149,7 @@ export function useGetRuleHistoryTimeline<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1273,9 +1266,7 @@ export function useGetRuleHistoryTopContributors<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1300,7 +1291,7 @@ export const invalidateGetRuleHistoryTopContributors = async (
|
||||
* @summary Test alert rule
|
||||
*/
|
||||
export const testRule = (
|
||||
ruletypesPostableRuleDTO: BodyType<RuletypesPostableRuleDTO>,
|
||||
ruletypesPostableRuleDTO?: BodyType<RuletypesPostableRuleDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<TestRule200>({
|
||||
@@ -1319,13 +1310,13 @@ export const getTestRuleMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof testRule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof testRule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['testRule'];
|
||||
@@ -1339,7 +1330,7 @@ export const getTestRuleMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof testRule>>,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> }
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -1352,7 +1343,9 @@ export const getTestRuleMutationOptions = <
|
||||
export type TestRuleMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof testRule>>
|
||||
>;
|
||||
export type TestRuleMutationBody = BodyType<RuletypesPostableRuleDTO>;
|
||||
export type TestRuleMutationBody =
|
||||
| BodyType<RuletypesPostableRuleDTO>
|
||||
| undefined;
|
||||
export type TestRuleMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -1365,16 +1358,14 @@ export const useTestRule = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof testRule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof testRule>>,
|
||||
TError,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getTestRuleMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getTestRuleMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -112,9 +113,7 @@ export function useListServiceAccounts<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +136,7 @@ export const invalidateListServiceAccounts = async (
|
||||
* @summary Create service account
|
||||
*/
|
||||
export const createServiceAccount = (
|
||||
serviceaccounttypesPostableServiceAccountDTO: BodyType<ServiceaccounttypesPostableServiceAccountDTO>,
|
||||
serviceaccounttypesPostableServiceAccountDTO?: BodyType<ServiceaccounttypesPostableServiceAccountDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateServiceAccount201>({
|
||||
@@ -156,13 +155,13 @@ export const getCreateServiceAccountMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createServiceAccount>>,
|
||||
TError,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createServiceAccount>>,
|
||||
TError,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createServiceAccount'];
|
||||
@@ -176,7 +175,7 @@ export const getCreateServiceAccountMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createServiceAccount>>,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> }
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -190,7 +189,8 @@ export type CreateServiceAccountMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createServiceAccount>>
|
||||
>;
|
||||
export type CreateServiceAccountMutationBody =
|
||||
BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
| BodyType<ServiceaccounttypesPostableServiceAccountDTO>
|
||||
| undefined;
|
||||
export type CreateServiceAccountMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -204,29 +204,29 @@ export const useCreateServiceAccount = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createServiceAccount>>,
|
||||
TError,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createServiceAccount>>,
|
||||
TError,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateServiceAccountMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateServiceAccountMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes an existing service account
|
||||
* @summary Deletes a service account
|
||||
*/
|
||||
export const deleteServiceAccount = ({
|
||||
id,
|
||||
}: DeleteServiceAccountPathParameters) => {
|
||||
export const deleteServiceAccount = (
|
||||
{ id }: DeleteServiceAccountPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/service_accounts/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -293,9 +293,7 @@ export const useDeleteServiceAccount = <
|
||||
{ pathParams: DeleteServiceAccountPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteServiceAccountMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteServiceAccountMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint gets an existing service account
|
||||
@@ -380,9 +378,7 @@ export function useGetServiceAccount<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -407,13 +403,15 @@ export const invalidateGetServiceAccount = async (
|
||||
*/
|
||||
export const updateServiceAccount = (
|
||||
{ id }: UpdateServiceAccountPathParameters,
|
||||
serviceaccounttypesPostableServiceAccountDTO: BodyType<ServiceaccounttypesPostableServiceAccountDTO>,
|
||||
serviceaccounttypesPostableServiceAccountDTO?: BodyType<ServiceaccounttypesPostableServiceAccountDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/service_accounts/${id}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: serviceaccounttypesPostableServiceAccountDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -426,7 +424,7 @@ export const getUpdateServiceAccountMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServiceAccountPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -435,7 +433,7 @@ export const getUpdateServiceAccountMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServiceAccountPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -452,7 +450,7 @@ export const getUpdateServiceAccountMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateServiceAccount>>,
|
||||
{
|
||||
pathParams: UpdateServiceAccountPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -467,7 +465,8 @@ export type UpdateServiceAccountMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateServiceAccount>>
|
||||
>;
|
||||
export type UpdateServiceAccountMutationBody =
|
||||
BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
| BodyType<ServiceaccounttypesPostableServiceAccountDTO>
|
||||
| undefined;
|
||||
export type UpdateServiceAccountMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -483,7 +482,7 @@ export const useUpdateServiceAccount = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServiceAccountPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -492,13 +491,11 @@ export const useUpdateServiceAccount = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServiceAccountPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateServiceAccountMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateServiceAccountMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint lists the service account keys
|
||||
@@ -584,9 +581,7 @@ export function useListServiceAccountKeys<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -611,7 +606,7 @@ export const invalidateListServiceAccountKeys = async (
|
||||
*/
|
||||
export const createServiceAccountKey = (
|
||||
{ id }: CreateServiceAccountKeyPathParameters,
|
||||
serviceaccounttypesPostableFactorAPIKeyDTO: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>,
|
||||
serviceaccounttypesPostableFactorAPIKeyDTO?: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateServiceAccountKey201>({
|
||||
@@ -632,7 +627,7 @@ export const getCreateServiceAccountKeyMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -641,7 +636,7 @@ export const getCreateServiceAccountKeyMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -658,7 +653,7 @@ export const getCreateServiceAccountKeyMutationOptions = <
|
||||
Awaited<ReturnType<typeof createServiceAccountKey>>,
|
||||
{
|
||||
pathParams: CreateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -673,7 +668,8 @@ export type CreateServiceAccountKeyMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createServiceAccountKey>>
|
||||
>;
|
||||
export type CreateServiceAccountKeyMutationBody =
|
||||
BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
| BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>
|
||||
| undefined;
|
||||
export type CreateServiceAccountKeyMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -689,7 +685,7 @@ export const useCreateServiceAccountKey = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -698,25 +694,24 @@ export const useCreateServiceAccountKey = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableFactorAPIKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateServiceAccountKeyMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateServiceAccountKeyMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint revokes an existing service account key
|
||||
* @summary Revoke a service account key
|
||||
*/
|
||||
export const revokeServiceAccountKey = ({
|
||||
id,
|
||||
fid,
|
||||
}: RevokeServiceAccountKeyPathParameters) => {
|
||||
export const revokeServiceAccountKey = (
|
||||
{ id, fid }: RevokeServiceAccountKeyPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/service_accounts/${id}/keys/${fid}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -783,9 +778,7 @@ export const useRevokeServiceAccountKey = <
|
||||
{ pathParams: RevokeServiceAccountKeyPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getRevokeServiceAccountKeyMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getRevokeServiceAccountKeyMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint updates an existing service account key
|
||||
@@ -793,13 +786,15 @@ export const useRevokeServiceAccountKey = <
|
||||
*/
|
||||
export const updateServiceAccountKey = (
|
||||
{ id, fid }: UpdateServiceAccountKeyPathParameters,
|
||||
serviceaccounttypesUpdatableFactorAPIKeyDTO: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>,
|
||||
serviceaccounttypesUpdatableFactorAPIKeyDTO?: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/service_accounts/${id}/keys/${fid}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: serviceaccounttypesUpdatableFactorAPIKeyDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -812,7 +807,7 @@ export const getUpdateServiceAccountKeyMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -821,7 +816,7 @@ export const getUpdateServiceAccountKeyMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -838,7 +833,7 @@ export const getUpdateServiceAccountKeyMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateServiceAccountKey>>,
|
||||
{
|
||||
pathParams: UpdateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -853,7 +848,8 @@ export type UpdateServiceAccountKeyMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateServiceAccountKey>>
|
||||
>;
|
||||
export type UpdateServiceAccountKeyMutationBody =
|
||||
BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
| BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>
|
||||
| undefined;
|
||||
export type UpdateServiceAccountKeyMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -869,7 +865,7 @@ export const useUpdateServiceAccountKey = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -878,13 +874,11 @@ export const useUpdateServiceAccountKey = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateServiceAccountKeyPathParameters;
|
||||
data: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
data?: BodyType<ServiceaccounttypesUpdatableFactorAPIKeyDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateServiceAccountKeyMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateServiceAccountKeyMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint gets all the roles for the existing service account
|
||||
@@ -970,9 +964,7 @@ export function useGetServiceAccountRoles<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -997,7 +989,7 @@ export const invalidateGetServiceAccountRoles = async (
|
||||
*/
|
||||
export const createServiceAccountRole = (
|
||||
{ id }: CreateServiceAccountRolePathParameters,
|
||||
serviceaccounttypesPostableServiceAccountRoleDTO: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>,
|
||||
serviceaccounttypesPostableServiceAccountRoleDTO?: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateServiceAccountRole201>({
|
||||
@@ -1018,7 +1010,7 @@ export const getCreateServiceAccountRoleMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateServiceAccountRolePathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -1027,7 +1019,7 @@ export const getCreateServiceAccountRoleMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateServiceAccountRolePathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -1044,7 +1036,7 @@ export const getCreateServiceAccountRoleMutationOptions = <
|
||||
Awaited<ReturnType<typeof createServiceAccountRole>>,
|
||||
{
|
||||
pathParams: CreateServiceAccountRolePathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -1059,7 +1051,8 @@ export type CreateServiceAccountRoleMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createServiceAccountRole>>
|
||||
>;
|
||||
export type CreateServiceAccountRoleMutationBody =
|
||||
BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
| BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>
|
||||
| undefined;
|
||||
export type CreateServiceAccountRoleMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -1075,7 +1068,7 @@ export const useCreateServiceAccountRole = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateServiceAccountRolePathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -1084,25 +1077,24 @@ export const useCreateServiceAccountRole = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateServiceAccountRolePathParameters;
|
||||
data: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
data?: BodyType<ServiceaccounttypesPostableServiceAccountRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateServiceAccountRoleMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateServiceAccountRoleMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint revokes a role from service account
|
||||
* @summary Delete service account role
|
||||
*/
|
||||
export const deleteServiceAccountRole = ({
|
||||
id,
|
||||
rid,
|
||||
}: DeleteServiceAccountRolePathParameters) => {
|
||||
export const deleteServiceAccountRole = (
|
||||
{ id, rid }: DeleteServiceAccountRolePathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/service_accounts/${id}/roles/${rid}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1169,9 +1161,7 @@ export const useDeleteServiceAccountRole = <
|
||||
{ pathParams: DeleteServiceAccountRolePathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteServiceAccountRoleMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteServiceAccountRoleMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint gets my service account
|
||||
@@ -1239,9 +1229,7 @@ export function useGetMyServiceAccount<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1264,13 +1252,15 @@ export const invalidateGetMyServiceAccount = async (
|
||||
* @summary Updates my service account
|
||||
*/
|
||||
export const updateMyServiceAccount = (
|
||||
serviceaccounttypesPostableServiceAccountDTO: BodyType<ServiceaccounttypesPostableServiceAccountDTO>,
|
||||
serviceaccounttypesPostableServiceAccountDTO?: BodyType<ServiceaccounttypesPostableServiceAccountDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<string>({
|
||||
url: `/api/v1/service_accounts/me`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: serviceaccounttypesPostableServiceAccountDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1281,13 +1271,13 @@ export const getUpdateMyServiceAccountMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyServiceAccount>>,
|
||||
TError,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyServiceAccount>>,
|
||||
TError,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['updateMyServiceAccount'];
|
||||
@@ -1301,7 +1291,7 @@ export const getUpdateMyServiceAccountMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof updateMyServiceAccount>>,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> }
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -1315,7 +1305,8 @@ export type UpdateMyServiceAccountMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateMyServiceAccount>>
|
||||
>;
|
||||
export type UpdateMyServiceAccountMutationBody =
|
||||
BodyType<ServiceaccounttypesPostableServiceAccountDTO>;
|
||||
| BodyType<ServiceaccounttypesPostableServiceAccountDTO>
|
||||
| undefined;
|
||||
export type UpdateMyServiceAccountMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -1329,16 +1320,14 @@ export const useUpdateMyServiceAccount = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyServiceAccount>>,
|
||||
TError,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof updateMyServiceAccount>>,
|
||||
TError,
|
||||
{ data: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
{ data?: BodyType<ServiceaccounttypesPostableServiceAccountDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateMyServiceAccountMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateMyServiceAccountMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -103,9 +104,7 @@ export function useCreateSessionByGoogleCallback<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,9 +191,7 @@ export function useCreateSessionByOIDCCallback<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,18 +214,18 @@ export const invalidateCreateSessionByOIDCCallback = async (
|
||||
* @summary Create session by saml callback
|
||||
*/
|
||||
export const createSessionBySAMLCallback = (
|
||||
createSessionBySAMLCallbackBody: BodyType<CreateSessionBySAMLCallbackBody>,
|
||||
createSessionBySAMLCallbackBody?: BodyType<CreateSessionBySAMLCallbackBody>,
|
||||
params?: CreateSessionBySAMLCallbackParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
const formUrlEncoded = new URLSearchParams();
|
||||
if (createSessionBySAMLCallbackBody.RelayState !== undefined) {
|
||||
if (createSessionBySAMLCallbackBody?.RelayState !== undefined) {
|
||||
formUrlEncoded.append(
|
||||
`RelayState`,
|
||||
createSessionBySAMLCallbackBody.RelayState,
|
||||
);
|
||||
}
|
||||
if (createSessionBySAMLCallbackBody.SAMLResponse !== undefined) {
|
||||
if (createSessionBySAMLCallbackBody?.SAMLResponse !== undefined) {
|
||||
formUrlEncoded.append(
|
||||
`SAMLResponse`,
|
||||
createSessionBySAMLCallbackBody.SAMLResponse,
|
||||
@@ -253,7 +250,7 @@ export const getCreateSessionBySAMLCallbackMutationOptions = <
|
||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||
TError,
|
||||
{
|
||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
data?: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
params?: CreateSessionBySAMLCallbackParams;
|
||||
},
|
||||
TContext
|
||||
@@ -262,7 +259,7 @@ export const getCreateSessionBySAMLCallbackMutationOptions = <
|
||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||
TError,
|
||||
{
|
||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
data?: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
params?: CreateSessionBySAMLCallbackParams;
|
||||
},
|
||||
TContext
|
||||
@@ -279,7 +276,7 @@ export const getCreateSessionBySAMLCallbackMutationOptions = <
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||
{
|
||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
data?: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
params?: CreateSessionBySAMLCallbackParams;
|
||||
}
|
||||
> = (props) => {
|
||||
@@ -295,7 +292,8 @@ export type CreateSessionBySAMLCallbackMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>
|
||||
>;
|
||||
export type CreateSessionBySAMLCallbackMutationBody =
|
||||
BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
| BodyType<CreateSessionBySAMLCallbackBody>
|
||||
| undefined;
|
||||
export type CreateSessionBySAMLCallbackMutationError = ErrorType<
|
||||
CreateSessionBySAMLCallback303 | RenderErrorResponseDTO
|
||||
>;
|
||||
@@ -311,7 +309,7 @@ export const useCreateSessionBySAMLCallback = <
|
||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||
TError,
|
||||
{
|
||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
data?: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
params?: CreateSessionBySAMLCallbackParams;
|
||||
},
|
||||
TContext
|
||||
@@ -320,23 +318,22 @@ export const useCreateSessionBySAMLCallback = <
|
||||
Awaited<ReturnType<typeof createSessionBySAMLCallback>>,
|
||||
TError,
|
||||
{
|
||||
data: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
data?: BodyType<CreateSessionBySAMLCallbackBody>;
|
||||
params?: CreateSessionBySAMLCallbackParams;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateSessionBySAMLCallbackMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateSessionBySAMLCallbackMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint deletes the session
|
||||
* @summary Delete session
|
||||
*/
|
||||
export const deleteSession = () => {
|
||||
export const deleteSession = (signal?: AbortSignal) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/sessions`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -400,9 +397,7 @@ export const useDeleteSession = <
|
||||
void,
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteSessionMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteSessionMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns the context for the session
|
||||
@@ -470,9 +465,7 @@ export function useGetSessionContext<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -495,7 +488,7 @@ export const invalidateGetSessionContext = async (
|
||||
* @summary Create session by email and password
|
||||
*/
|
||||
export const createSessionByEmailPassword = (
|
||||
authtypesPostableEmailPasswordSessionDTO: BodyType<AuthtypesPostableEmailPasswordSessionDTO>,
|
||||
authtypesPostableEmailPasswordSessionDTO?: BodyType<AuthtypesPostableEmailPasswordSessionDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateSessionByEmailPassword200>({
|
||||
@@ -514,13 +507,13 @@ export const getCreateSessionByEmailPasswordMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createSessionByEmailPassword'];
|
||||
@@ -534,7 +527,7 @@ export const getCreateSessionByEmailPasswordMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> }
|
||||
{ data?: BodyType<AuthtypesPostableEmailPasswordSessionDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -548,7 +541,8 @@ export type CreateSessionByEmailPasswordMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>
|
||||
>;
|
||||
export type CreateSessionByEmailPasswordMutationBody =
|
||||
BodyType<AuthtypesPostableEmailPasswordSessionDTO>;
|
||||
| BodyType<AuthtypesPostableEmailPasswordSessionDTO>
|
||||
| undefined;
|
||||
export type CreateSessionByEmailPasswordMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -562,26 +556,23 @@ export const useCreateSessionByEmailPassword = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createSessionByEmailPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableEmailPasswordSessionDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions =
|
||||
getCreateSessionByEmailPasswordMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateSessionByEmailPasswordMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint rotates the session
|
||||
* @summary Rotate session
|
||||
*/
|
||||
export const rotateSession = (
|
||||
authtypesPostableRotateTokenDTO: BodyType<AuthtypesPostableRotateTokenDTO>,
|
||||
authtypesPostableRotateTokenDTO?: BodyType<AuthtypesPostableRotateTokenDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<RotateSession200>({
|
||||
@@ -600,13 +591,13 @@ export const getRotateSessionMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof rotateSession>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableRotateTokenDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof rotateSession>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableRotateTokenDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['rotateSession'];
|
||||
@@ -620,7 +611,7 @@ export const getRotateSessionMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof rotateSession>>,
|
||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> }
|
||||
{ data?: BodyType<AuthtypesPostableRotateTokenDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -634,7 +625,8 @@ export type RotateSessionMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof rotateSession>>
|
||||
>;
|
||||
export type RotateSessionMutationBody =
|
||||
BodyType<AuthtypesPostableRotateTokenDTO>;
|
||||
| BodyType<AuthtypesPostableRotateTokenDTO>
|
||||
| undefined;
|
||||
export type RotateSessionMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -647,16 +639,14 @@ export const useRotateSession = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof rotateSession>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableRotateTokenDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof rotateSession>>,
|
||||
TError,
|
||||
{ data: BodyType<AuthtypesPostableRotateTokenDTO> },
|
||||
{ data?: BodyType<AuthtypesPostableRotateTokenDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getRotateSessionMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getRotateSessionMutationOptions(options));
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -118,9 +119,7 @@ export function useListSpanMapperGroups<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,7 +143,7 @@ export const invalidateListSpanMapperGroups = async (
|
||||
* @summary Create a span attribute mapping group
|
||||
*/
|
||||
export const createSpanMapperGroup = (
|
||||
spantypesPostableSpanMapperGroupDTO: BodyType<SpantypesPostableSpanMapperGroupDTO>,
|
||||
spantypesPostableSpanMapperGroupDTO?: BodyType<SpantypesPostableSpanMapperGroupDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateSpanMapperGroup201>({
|
||||
@@ -163,13 +162,13 @@ export const getCreateSpanMapperGroupMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createSpanMapperGroup>>,
|
||||
TError,
|
||||
{ data: BodyType<SpantypesPostableSpanMapperGroupDTO> },
|
||||
{ data?: BodyType<SpantypesPostableSpanMapperGroupDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createSpanMapperGroup>>,
|
||||
TError,
|
||||
{ data: BodyType<SpantypesPostableSpanMapperGroupDTO> },
|
||||
{ data?: BodyType<SpantypesPostableSpanMapperGroupDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createSpanMapperGroup'];
|
||||
@@ -183,7 +182,7 @@ export const getCreateSpanMapperGroupMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createSpanMapperGroup>>,
|
||||
{ data: BodyType<SpantypesPostableSpanMapperGroupDTO> }
|
||||
{ data?: BodyType<SpantypesPostableSpanMapperGroupDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -197,7 +196,8 @@ export type CreateSpanMapperGroupMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createSpanMapperGroup>>
|
||||
>;
|
||||
export type CreateSpanMapperGroupMutationBody =
|
||||
BodyType<SpantypesPostableSpanMapperGroupDTO>;
|
||||
| BodyType<SpantypesPostableSpanMapperGroupDTO>
|
||||
| undefined;
|
||||
export type CreateSpanMapperGroupMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -211,29 +211,29 @@ export const useCreateSpanMapperGroup = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createSpanMapperGroup>>,
|
||||
TError,
|
||||
{ data: BodyType<SpantypesPostableSpanMapperGroupDTO> },
|
||||
{ data?: BodyType<SpantypesPostableSpanMapperGroupDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createSpanMapperGroup>>,
|
||||
TError,
|
||||
{ data: BodyType<SpantypesPostableSpanMapperGroupDTO> },
|
||||
{ data?: BodyType<SpantypesPostableSpanMapperGroupDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateSpanMapperGroupMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateSpanMapperGroupMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Hard-deletes a mapping group and cascades to all its mappers.
|
||||
* @summary Delete a span attribute mapping group
|
||||
*/
|
||||
export const deleteSpanMapperGroup = ({
|
||||
groupId,
|
||||
}: DeleteSpanMapperGroupPathParameters) => {
|
||||
export const deleteSpanMapperGroup = (
|
||||
{ groupId }: DeleteSpanMapperGroupPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/span_mapper_groups/${groupId}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -300,9 +300,7 @@ export const useDeleteSpanMapperGroup = <
|
||||
{ pathParams: DeleteSpanMapperGroupPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteSpanMapperGroupMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteSpanMapperGroupMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Partially updates an existing mapping group's name, condition, or enabled state.
|
||||
@@ -310,13 +308,15 @@ export const useDeleteSpanMapperGroup = <
|
||||
*/
|
||||
export const updateSpanMapperGroup = (
|
||||
{ groupId }: UpdateSpanMapperGroupPathParameters,
|
||||
spantypesUpdatableSpanMapperGroupDTO: BodyType<SpantypesUpdatableSpanMapperGroupDTO>,
|
||||
spantypesUpdatableSpanMapperGroupDTO?: BodyType<SpantypesUpdatableSpanMapperGroupDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/span_mapper_groups/${groupId}`,
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: spantypesUpdatableSpanMapperGroupDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -329,7 +329,7 @@ export const getUpdateSpanMapperGroupMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateSpanMapperGroupPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -338,7 +338,7 @@ export const getUpdateSpanMapperGroupMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateSpanMapperGroupPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -355,7 +355,7 @@ export const getUpdateSpanMapperGroupMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateSpanMapperGroup>>,
|
||||
{
|
||||
pathParams: UpdateSpanMapperGroupPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -370,7 +370,8 @@ export type UpdateSpanMapperGroupMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateSpanMapperGroup>>
|
||||
>;
|
||||
export type UpdateSpanMapperGroupMutationBody =
|
||||
BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
| BodyType<SpantypesUpdatableSpanMapperGroupDTO>
|
||||
| undefined;
|
||||
export type UpdateSpanMapperGroupMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -386,7 +387,7 @@ export const useUpdateSpanMapperGroup = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateSpanMapperGroupPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -395,13 +396,11 @@ export const useUpdateSpanMapperGroup = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateSpanMapperGroupPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperGroupDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateSpanMapperGroupMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateSpanMapperGroupMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns all mappers belonging to a mapping group.
|
||||
@@ -486,9 +485,7 @@ export function useListSpanMappers<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -513,7 +510,7 @@ export const invalidateListSpanMappers = async (
|
||||
*/
|
||||
export const createSpanMapper = (
|
||||
{ groupId }: CreateSpanMapperPathParameters,
|
||||
spantypesPostableSpanMapperDTO: BodyType<SpantypesPostableSpanMapperDTO>,
|
||||
spantypesPostableSpanMapperDTO?: BodyType<SpantypesPostableSpanMapperDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateSpanMapper201>({
|
||||
@@ -534,7 +531,7 @@ export const getCreateSpanMapperMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -543,7 +540,7 @@ export const getCreateSpanMapperMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -560,7 +557,7 @@ export const getCreateSpanMapperMutationOptions = <
|
||||
Awaited<ReturnType<typeof createSpanMapper>>,
|
||||
{
|
||||
pathParams: CreateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -575,7 +572,8 @@ export type CreateSpanMapperMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createSpanMapper>>
|
||||
>;
|
||||
export type CreateSpanMapperMutationBody =
|
||||
BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
| BodyType<SpantypesPostableSpanMapperDTO>
|
||||
| undefined;
|
||||
export type CreateSpanMapperMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -590,7 +588,7 @@ export const useCreateSpanMapper = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -599,25 +597,24 @@ export const useCreateSpanMapper = <
|
||||
TError,
|
||||
{
|
||||
pathParams: CreateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesPostableSpanMapperDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateSpanMapperMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateSpanMapperMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Hard-deletes a mapper from a mapping group.
|
||||
* @summary Delete a span mapper
|
||||
*/
|
||||
export const deleteSpanMapper = ({
|
||||
groupId,
|
||||
mapperId,
|
||||
}: DeleteSpanMapperPathParameters) => {
|
||||
export const deleteSpanMapper = (
|
||||
{ groupId, mapperId }: DeleteSpanMapperPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/span_mapper_groups/${groupId}/span_mappers/${mapperId}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -683,9 +680,7 @@ export const useDeleteSpanMapper = <
|
||||
{ pathParams: DeleteSpanMapperPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteSpanMapperMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteSpanMapperMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Partially updates an existing mapper's field context, config, or enabled state.
|
||||
@@ -693,13 +688,15 @@ export const useDeleteSpanMapper = <
|
||||
*/
|
||||
export const updateSpanMapper = (
|
||||
{ groupId, mapperId }: UpdateSpanMapperPathParameters,
|
||||
spantypesUpdatableSpanMapperDTO: BodyType<SpantypesUpdatableSpanMapperDTO>,
|
||||
spantypesUpdatableSpanMapperDTO?: BodyType<SpantypesUpdatableSpanMapperDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/span_mapper_groups/${groupId}/span_mappers/${mapperId}`,
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: spantypesUpdatableSpanMapperDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -712,7 +709,7 @@ export const getUpdateSpanMapperMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -721,7 +718,7 @@ export const getUpdateSpanMapperMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -738,7 +735,7 @@ export const getUpdateSpanMapperMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateSpanMapper>>,
|
||||
{
|
||||
pathParams: UpdateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -753,7 +750,8 @@ export type UpdateSpanMapperMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateSpanMapper>>
|
||||
>;
|
||||
export type UpdateSpanMapperMutationBody =
|
||||
BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
| BodyType<SpantypesUpdatableSpanMapperDTO>
|
||||
| undefined;
|
||||
export type UpdateSpanMapperMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -768,7 +766,7 @@ export const useUpdateSpanMapper = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -777,11 +775,9 @@ export const useUpdateSpanMapper = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateSpanMapperPathParameters;
|
||||
data: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
data?: BodyType<SpantypesUpdatableSpanMapperDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateSpanMapperMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateSpanMapperMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation } from 'react-query';
|
||||
import type {
|
||||
@@ -27,7 +28,7 @@ import type { ErrorType, BodyType } from '../../../generatedAPIInstance';
|
||||
*/
|
||||
export const getWaterfall = (
|
||||
{ traceID }: GetWaterfallPathParameters,
|
||||
tracedetailtypesPostableWaterfallDTO: BodyType<TracedetailtypesPostableWaterfallDTO>,
|
||||
tracedetailtypesPostableWaterfallDTO?: BodyType<TracedetailtypesPostableWaterfallDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<GetWaterfall200>({
|
||||
@@ -48,7 +49,7 @@ export const getGetWaterfallMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: GetWaterfallPathParameters;
|
||||
data: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
data?: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -57,7 +58,7 @@ export const getGetWaterfallMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: GetWaterfallPathParameters;
|
||||
data: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
data?: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -74,7 +75,7 @@ export const getGetWaterfallMutationOptions = <
|
||||
Awaited<ReturnType<typeof getWaterfall>>,
|
||||
{
|
||||
pathParams: GetWaterfallPathParameters;
|
||||
data: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
data?: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -89,7 +90,8 @@ export type GetWaterfallMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof getWaterfall>>
|
||||
>;
|
||||
export type GetWaterfallMutationBody =
|
||||
BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
| BodyType<TracedetailtypesPostableWaterfallDTO>
|
||||
| undefined;
|
||||
export type GetWaterfallMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -104,7 +106,7 @@ export const useGetWaterfall = <
|
||||
TError,
|
||||
{
|
||||
pathParams: GetWaterfallPathParameters;
|
||||
data: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
data?: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -113,11 +115,9 @@ export const useGetWaterfall = <
|
||||
TError,
|
||||
{
|
||||
pathParams: GetWaterfallPathParameters;
|
||||
data: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
data?: BodyType<TracedetailtypesPostableWaterfallDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getGetWaterfallMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getGetWaterfallMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -146,9 +147,7 @@ export function useGetResetPasswordTokenDeprecated<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,7 +172,7 @@ export const invalidateGetResetPasswordTokenDeprecated = async (
|
||||
* @summary Create invite
|
||||
*/
|
||||
export const createInvite = (
|
||||
typesPostableInviteDTO: BodyType<TypesPostableInviteDTO>,
|
||||
typesPostableInviteDTO?: BodyType<TypesPostableInviteDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateInvite201>({
|
||||
@@ -192,13 +191,13 @@ export const getCreateInviteMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createInvite>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableInviteDTO> },
|
||||
{ data?: BodyType<TypesPostableInviteDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createInvite>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableInviteDTO> },
|
||||
{ data?: BodyType<TypesPostableInviteDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createInvite'];
|
||||
@@ -212,7 +211,7 @@ export const getCreateInviteMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createInvite>>,
|
||||
{ data: BodyType<TypesPostableInviteDTO> }
|
||||
{ data?: BodyType<TypesPostableInviteDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -225,7 +224,9 @@ export const getCreateInviteMutationOptions = <
|
||||
export type CreateInviteMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createInvite>>
|
||||
>;
|
||||
export type CreateInviteMutationBody = BodyType<TypesPostableInviteDTO>;
|
||||
export type CreateInviteMutationBody =
|
||||
| BodyType<TypesPostableInviteDTO>
|
||||
| undefined;
|
||||
export type CreateInviteMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -238,25 +239,23 @@ export const useCreateInvite = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createInvite>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableInviteDTO> },
|
||||
{ data?: BodyType<TypesPostableInviteDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createInvite>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableInviteDTO> },
|
||||
{ data?: BodyType<TypesPostableInviteDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateInviteMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateInviteMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint creates a bulk invite for a user
|
||||
* @summary Create bulk invite
|
||||
*/
|
||||
export const createBulkInvite = (
|
||||
typesPostableBulkInviteRequestDTO: BodyType<TypesPostableBulkInviteRequestDTO>,
|
||||
typesPostableBulkInviteRequestDTO?: BodyType<TypesPostableBulkInviteRequestDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
@@ -275,13 +274,13 @@ export const getCreateBulkInviteMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableBulkInviteRequestDTO> },
|
||||
{ data?: BodyType<TypesPostableBulkInviteRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableBulkInviteRequestDTO> },
|
||||
{ data?: BodyType<TypesPostableBulkInviteRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['createBulkInvite'];
|
||||
@@ -295,7 +294,7 @@ export const getCreateBulkInviteMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||
{ data: BodyType<TypesPostableBulkInviteRequestDTO> }
|
||||
{ data?: BodyType<TypesPostableBulkInviteRequestDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -309,7 +308,8 @@ export type CreateBulkInviteMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createBulkInvite>>
|
||||
>;
|
||||
export type CreateBulkInviteMutationBody =
|
||||
BodyType<TypesPostableBulkInviteRequestDTO>;
|
||||
| BodyType<TypesPostableBulkInviteRequestDTO>
|
||||
| undefined;
|
||||
export type CreateBulkInviteMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -322,25 +322,23 @@ export const useCreateBulkInvite = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableBulkInviteRequestDTO> },
|
||||
{ data?: BodyType<TypesPostableBulkInviteRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createBulkInvite>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableBulkInviteRequestDTO> },
|
||||
{ data?: BodyType<TypesPostableBulkInviteRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateBulkInviteMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateBulkInviteMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint resets the password by token
|
||||
* @summary Reset password
|
||||
*/
|
||||
export const resetPassword = (
|
||||
typesPostableResetPasswordDTO: BodyType<TypesPostableResetPasswordDTO>,
|
||||
typesPostableResetPasswordDTO?: BodyType<TypesPostableResetPasswordDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
@@ -359,13 +357,13 @@ export const getResetPasswordMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof resetPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableResetPasswordDTO> },
|
||||
{ data?: BodyType<TypesPostableResetPasswordDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof resetPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableResetPasswordDTO> },
|
||||
{ data?: BodyType<TypesPostableResetPasswordDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['resetPassword'];
|
||||
@@ -379,7 +377,7 @@ export const getResetPasswordMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof resetPassword>>,
|
||||
{ data: BodyType<TypesPostableResetPasswordDTO> }
|
||||
{ data?: BodyType<TypesPostableResetPasswordDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -392,7 +390,9 @@ export const getResetPasswordMutationOptions = <
|
||||
export type ResetPasswordMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof resetPassword>>
|
||||
>;
|
||||
export type ResetPasswordMutationBody = BodyType<TypesPostableResetPasswordDTO>;
|
||||
export type ResetPasswordMutationBody =
|
||||
| BodyType<TypesPostableResetPasswordDTO>
|
||||
| undefined;
|
||||
export type ResetPasswordMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -405,18 +405,16 @@ export const useResetPassword = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof resetPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableResetPasswordDTO> },
|
||||
{ data?: BodyType<TypesPostableResetPasswordDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof resetPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableResetPasswordDTO> },
|
||||
{ data?: BodyType<TypesPostableResetPasswordDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getResetPasswordMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getResetPasswordMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint lists all users
|
||||
@@ -484,9 +482,7 @@ export function useListUsersDeprecated<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -508,10 +504,14 @@ export const invalidateListUsersDeprecated = async (
|
||||
* This endpoint deletes the user by id
|
||||
* @summary Delete user
|
||||
*/
|
||||
export const deleteUser = ({ id }: DeleteUserPathParameters) => {
|
||||
export const deleteUser = (
|
||||
{ id }: DeleteUserPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v1/user/${id}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -577,9 +577,7 @@ export const useDeleteUser = <
|
||||
{ pathParams: DeleteUserPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteUserMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getDeleteUserMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns the user by id
|
||||
@@ -664,9 +662,7 @@ export function useGetUserDeprecated<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -691,13 +687,15 @@ export const invalidateGetUserDeprecated = async (
|
||||
*/
|
||||
export const updateUserDeprecated = (
|
||||
{ id }: UpdateUserDeprecatedPathParameters,
|
||||
typesDeprecatedUserDTO: BodyType<TypesDeprecatedUserDTO>,
|
||||
typesDeprecatedUserDTO?: BodyType<TypesDeprecatedUserDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<UpdateUserDeprecated200>({
|
||||
url: `/api/v1/user/${id}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: typesDeprecatedUserDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -710,7 +708,7 @@ export const getUpdateUserDeprecatedMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserDeprecatedPathParameters;
|
||||
data: BodyType<TypesDeprecatedUserDTO>;
|
||||
data?: BodyType<TypesDeprecatedUserDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -719,7 +717,7 @@ export const getUpdateUserDeprecatedMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserDeprecatedPathParameters;
|
||||
data: BodyType<TypesDeprecatedUserDTO>;
|
||||
data?: BodyType<TypesDeprecatedUserDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -736,7 +734,7 @@ export const getUpdateUserDeprecatedMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateUserDeprecated>>,
|
||||
{
|
||||
pathParams: UpdateUserDeprecatedPathParameters;
|
||||
data: BodyType<TypesDeprecatedUserDTO>;
|
||||
data?: BodyType<TypesDeprecatedUserDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -750,7 +748,9 @@ export const getUpdateUserDeprecatedMutationOptions = <
|
||||
export type UpdateUserDeprecatedMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateUserDeprecated>>
|
||||
>;
|
||||
export type UpdateUserDeprecatedMutationBody = BodyType<TypesDeprecatedUserDTO>;
|
||||
export type UpdateUserDeprecatedMutationBody =
|
||||
| BodyType<TypesDeprecatedUserDTO>
|
||||
| undefined;
|
||||
export type UpdateUserDeprecatedMutationError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
@@ -766,7 +766,7 @@ export const useUpdateUserDeprecated = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserDeprecatedPathParameters;
|
||||
data: BodyType<TypesDeprecatedUserDTO>;
|
||||
data?: BodyType<TypesDeprecatedUserDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -775,13 +775,11 @@ export const useUpdateUserDeprecated = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserDeprecatedPathParameters;
|
||||
data: BodyType<TypesDeprecatedUserDTO>;
|
||||
data?: BodyType<TypesDeprecatedUserDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateUserDeprecatedMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateUserDeprecatedMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns the user I belong to
|
||||
@@ -849,9 +847,7 @@ export function useGetMyUserDeprecated<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -874,7 +870,7 @@ export const invalidateGetMyUserDeprecated = async (
|
||||
* @summary Forgot password
|
||||
*/
|
||||
export const forgotPassword = (
|
||||
typesPostableForgotPasswordDTO: BodyType<TypesPostableForgotPasswordDTO>,
|
||||
typesPostableForgotPasswordDTO?: BodyType<TypesPostableForgotPasswordDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
@@ -893,13 +889,13 @@ export const getForgotPasswordMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof forgotPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableForgotPasswordDTO> },
|
||||
{ data?: BodyType<TypesPostableForgotPasswordDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof forgotPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableForgotPasswordDTO> },
|
||||
{ data?: BodyType<TypesPostableForgotPasswordDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['forgotPassword'];
|
||||
@@ -913,7 +909,7 @@ export const getForgotPasswordMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof forgotPassword>>,
|
||||
{ data: BodyType<TypesPostableForgotPasswordDTO> }
|
||||
{ data?: BodyType<TypesPostableForgotPasswordDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -927,7 +923,8 @@ export type ForgotPasswordMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof forgotPassword>>
|
||||
>;
|
||||
export type ForgotPasswordMutationBody =
|
||||
BodyType<TypesPostableForgotPasswordDTO>;
|
||||
| BodyType<TypesPostableForgotPasswordDTO>
|
||||
| undefined;
|
||||
export type ForgotPasswordMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -940,18 +937,16 @@ export const useForgotPassword = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof forgotPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableForgotPasswordDTO> },
|
||||
{ data?: BodyType<TypesPostableForgotPasswordDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof forgotPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesPostableForgotPasswordDTO> },
|
||||
{ data?: BodyType<TypesPostableForgotPasswordDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getForgotPasswordMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getForgotPasswordMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns the users having the role by role id
|
||||
@@ -1035,9 +1030,7 @@ export function useGetUsersByRoleID<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1114,9 +1107,7 @@ export function useListUsers<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1204,9 +1195,7 @@ export function useGetUser<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1231,13 +1220,15 @@ export const invalidateGetUser = async (
|
||||
*/
|
||||
export const updateUser = (
|
||||
{ id }: UpdateUserPathParameters,
|
||||
typesUpdatableUserDTO: BodyType<TypesUpdatableUserDTO>,
|
||||
typesUpdatableUserDTO?: BodyType<TypesUpdatableUserDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/users/${id}`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: typesUpdatableUserDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1250,7 +1241,7 @@ export const getUpdateUserMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserPathParameters;
|
||||
data: BodyType<TypesUpdatableUserDTO>;
|
||||
data?: BodyType<TypesUpdatableUserDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -1259,7 +1250,7 @@ export const getUpdateUserMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserPathParameters;
|
||||
data: BodyType<TypesUpdatableUserDTO>;
|
||||
data?: BodyType<TypesUpdatableUserDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -1276,7 +1267,7 @@ export const getUpdateUserMutationOptions = <
|
||||
Awaited<ReturnType<typeof updateUser>>,
|
||||
{
|
||||
pathParams: UpdateUserPathParameters;
|
||||
data: BodyType<TypesUpdatableUserDTO>;
|
||||
data?: BodyType<TypesUpdatableUserDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -1290,7 +1281,9 @@ export const getUpdateUserMutationOptions = <
|
||||
export type UpdateUserMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateUser>>
|
||||
>;
|
||||
export type UpdateUserMutationBody = BodyType<TypesUpdatableUserDTO>;
|
||||
export type UpdateUserMutationBody =
|
||||
| BodyType<TypesUpdatableUserDTO>
|
||||
| undefined;
|
||||
export type UpdateUserMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -1305,7 +1298,7 @@ export const useUpdateUser = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserPathParameters;
|
||||
data: BodyType<TypesUpdatableUserDTO>;
|
||||
data?: BodyType<TypesUpdatableUserDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -1314,13 +1307,11 @@ export const useUpdateUser = <
|
||||
TError,
|
||||
{
|
||||
pathParams: UpdateUserPathParameters;
|
||||
data: BodyType<TypesUpdatableUserDTO>;
|
||||
data?: BodyType<TypesUpdatableUserDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateUserMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateUserMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns the existing reset password token for a user.
|
||||
@@ -1405,9 +1396,7 @@ export function useGetResetPasswordToken<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1430,12 +1419,14 @@ export const invalidateGetResetPasswordToken = async (
|
||||
* This endpoint creates or regenerates a reset password token for a user. If a valid token exists, it is returned. If expired, a new one is created.
|
||||
* @summary Create or regenerate reset password token for a user
|
||||
*/
|
||||
export const createResetPasswordToken = ({
|
||||
id,
|
||||
}: CreateResetPasswordTokenPathParameters) => {
|
||||
export const createResetPasswordToken = (
|
||||
{ id }: CreateResetPasswordTokenPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<CreateResetPasswordToken201>({
|
||||
url: `/api/v2/users/${id}/reset_password_tokens`,
|
||||
method: 'PUT',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1502,9 +1493,7 @@ export const useCreateResetPasswordToken = <
|
||||
{ pathParams: CreateResetPasswordTokenPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateResetPasswordTokenMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getCreateResetPasswordTokenMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns the user roles by user id
|
||||
@@ -1588,9 +1577,7 @@ export function useGetRolesByUserID<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1615,7 +1602,7 @@ export const invalidateGetRolesByUserID = async (
|
||||
*/
|
||||
export const setRoleByUserID = (
|
||||
{ id }: SetRoleByUserIDPathParameters,
|
||||
typesPostableRoleDTO: BodyType<TypesPostableRoleDTO>,
|
||||
typesPostableRoleDTO?: BodyType<TypesPostableRoleDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
@@ -1636,7 +1623,7 @@ export const getSetRoleByUserIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: SetRoleByUserIDPathParameters;
|
||||
data: BodyType<TypesPostableRoleDTO>;
|
||||
data?: BodyType<TypesPostableRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -1645,7 +1632,7 @@ export const getSetRoleByUserIDMutationOptions = <
|
||||
TError,
|
||||
{
|
||||
pathParams: SetRoleByUserIDPathParameters;
|
||||
data: BodyType<TypesPostableRoleDTO>;
|
||||
data?: BodyType<TypesPostableRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
@@ -1662,7 +1649,7 @@ export const getSetRoleByUserIDMutationOptions = <
|
||||
Awaited<ReturnType<typeof setRoleByUserID>>,
|
||||
{
|
||||
pathParams: SetRoleByUserIDPathParameters;
|
||||
data: BodyType<TypesPostableRoleDTO>;
|
||||
data?: BodyType<TypesPostableRoleDTO>;
|
||||
}
|
||||
> = (props) => {
|
||||
const { pathParams, data } = props ?? {};
|
||||
@@ -1676,7 +1663,9 @@ export const getSetRoleByUserIDMutationOptions = <
|
||||
export type SetRoleByUserIDMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof setRoleByUserID>>
|
||||
>;
|
||||
export type SetRoleByUserIDMutationBody = BodyType<TypesPostableRoleDTO>;
|
||||
export type SetRoleByUserIDMutationBody =
|
||||
| BodyType<TypesPostableRoleDTO>
|
||||
| undefined;
|
||||
export type SetRoleByUserIDMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -1691,7 +1680,7 @@ export const useSetRoleByUserID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: SetRoleByUserIDPathParameters;
|
||||
data: BodyType<TypesPostableRoleDTO>;
|
||||
data?: BodyType<TypesPostableRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
>;
|
||||
@@ -1700,25 +1689,24 @@ export const useSetRoleByUserID = <
|
||||
TError,
|
||||
{
|
||||
pathParams: SetRoleByUserIDPathParameters;
|
||||
data: BodyType<TypesPostableRoleDTO>;
|
||||
data?: BodyType<TypesPostableRoleDTO>;
|
||||
},
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getSetRoleByUserIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getSetRoleByUserIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint removes a role from the user by user id and role id
|
||||
* @summary Remove a role from user
|
||||
*/
|
||||
export const removeUserRoleByUserIDAndRoleID = ({
|
||||
id,
|
||||
roleId,
|
||||
}: RemoveUserRoleByUserIDAndRoleIDPathParameters) => {
|
||||
export const removeUserRoleByUserIDAndRoleID = (
|
||||
{ id, roleId }: RemoveUserRoleByUserIDAndRoleIDPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/users/${id}/roles/${roleId}`,
|
||||
method: 'DELETE',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1785,10 +1773,7 @@ export const useRemoveUserRoleByUserIDAndRoleID = <
|
||||
{ pathParams: RemoveUserRoleByUserIDAndRoleIDPathParameters },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions =
|
||||
getRemoveUserRoleByUserIDAndRoleIDMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getRemoveUserRoleByUserIDAndRoleIDMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint returns the user I belong to
|
||||
@@ -1848,9 +1833,7 @@ export function useGetMyUser<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1873,13 +1856,15 @@ export const invalidateGetMyUser = async (
|
||||
* @summary Update my user v2
|
||||
*/
|
||||
export const updateMyUserV2 = (
|
||||
typesUpdatableUserDTO: BodyType<TypesUpdatableUserDTO>,
|
||||
typesUpdatableUserDTO?: BodyType<TypesUpdatableUserDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/users/me`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: typesUpdatableUserDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1890,13 +1875,13 @@ export const getUpdateMyUserV2MutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyUserV2>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesUpdatableUserDTO> },
|
||||
{ data?: BodyType<TypesUpdatableUserDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyUserV2>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesUpdatableUserDTO> },
|
||||
{ data?: BodyType<TypesUpdatableUserDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['updateMyUserV2'];
|
||||
@@ -1910,7 +1895,7 @@ export const getUpdateMyUserV2MutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof updateMyUserV2>>,
|
||||
{ data: BodyType<TypesUpdatableUserDTO> }
|
||||
{ data?: BodyType<TypesUpdatableUserDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -1923,7 +1908,9 @@ export const getUpdateMyUserV2MutationOptions = <
|
||||
export type UpdateMyUserV2MutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateMyUserV2>>
|
||||
>;
|
||||
export type UpdateMyUserV2MutationBody = BodyType<TypesUpdatableUserDTO>;
|
||||
export type UpdateMyUserV2MutationBody =
|
||||
| BodyType<TypesUpdatableUserDTO>
|
||||
| undefined;
|
||||
export type UpdateMyUserV2MutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -1936,31 +1923,31 @@ export const useUpdateMyUserV2 = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyUserV2>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesUpdatableUserDTO> },
|
||||
{ data?: BodyType<TypesUpdatableUserDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof updateMyUserV2>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesUpdatableUserDTO> },
|
||||
{ data?: BodyType<TypesUpdatableUserDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateMyUserV2MutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateMyUserV2MutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint updates the password of the user I belong to
|
||||
* @summary Updates my password
|
||||
*/
|
||||
export const updateMyPassword = (
|
||||
typesChangePasswordRequestDTO: BodyType<TypesChangePasswordRequestDTO>,
|
||||
typesChangePasswordRequestDTO?: BodyType<TypesChangePasswordRequestDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/users/me/factor_password`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: typesChangePasswordRequestDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1971,13 +1958,13 @@ export const getUpdateMyPasswordMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesChangePasswordRequestDTO> },
|
||||
{ data?: BodyType<TypesChangePasswordRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesChangePasswordRequestDTO> },
|
||||
{ data?: BodyType<TypesChangePasswordRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['updateMyPassword'];
|
||||
@@ -1991,7 +1978,7 @@ export const getUpdateMyPasswordMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof updateMyPassword>>,
|
||||
{ data: BodyType<TypesChangePasswordRequestDTO> }
|
||||
{ data?: BodyType<TypesChangePasswordRequestDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -2005,7 +1992,8 @@ export type UpdateMyPasswordMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateMyPassword>>
|
||||
>;
|
||||
export type UpdateMyPasswordMutationBody =
|
||||
BodyType<TypesChangePasswordRequestDTO>;
|
||||
| BodyType<TypesChangePasswordRequestDTO>
|
||||
| undefined;
|
||||
export type UpdateMyPasswordMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -2018,16 +2006,14 @@ export const useUpdateMyPassword = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateMyPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesChangePasswordRequestDTO> },
|
||||
{ data?: BodyType<TypesChangePasswordRequestDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof updateMyPassword>>,
|
||||
TError,
|
||||
{ data: BodyType<TypesChangePasswordRequestDTO> },
|
||||
{ data?: BodyType<TypesChangePasswordRequestDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateMyPasswordMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getUpdateMyPasswordMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* * The file has been auto-generated using Orval for SigNoz
|
||||
* * regenerate with 'pnpm generate:api'
|
||||
* SigNoz
|
||||
* OpenAPI spec version: 0.0.1
|
||||
*/
|
||||
import { useMutation, useQuery } from 'react-query';
|
||||
import type {
|
||||
@@ -85,9 +86,7 @@ export function useGetHosts<
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
|
||||
return query;
|
||||
return { ...query, queryKey: queryOptions.queryKey };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,13 +109,15 @@ export const invalidateGetHosts = async (
|
||||
* @summary Put host in Zeus for a deployment.
|
||||
*/
|
||||
export const putHost = (
|
||||
zeustypesPostableHostDTO: BodyType<ZeustypesPostableHostDTO>,
|
||||
zeustypesPostableHostDTO?: BodyType<ZeustypesPostableHostDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/zeus/hosts`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: zeustypesPostableHostDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -127,13 +128,13 @@ export const getPutHostMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof putHost>>,
|
||||
TError,
|
||||
{ data: BodyType<ZeustypesPostableHostDTO> },
|
||||
{ data?: BodyType<ZeustypesPostableHostDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof putHost>>,
|
||||
TError,
|
||||
{ data: BodyType<ZeustypesPostableHostDTO> },
|
||||
{ data?: BodyType<ZeustypesPostableHostDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['putHost'];
|
||||
@@ -147,7 +148,7 @@ export const getPutHostMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof putHost>>,
|
||||
{ data: BodyType<ZeustypesPostableHostDTO> }
|
||||
{ data?: BodyType<ZeustypesPostableHostDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -160,7 +161,9 @@ export const getPutHostMutationOptions = <
|
||||
export type PutHostMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof putHost>>
|
||||
>;
|
||||
export type PutHostMutationBody = BodyType<ZeustypesPostableHostDTO>;
|
||||
export type PutHostMutationBody =
|
||||
| BodyType<ZeustypesPostableHostDTO>
|
||||
| undefined;
|
||||
export type PutHostMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -173,31 +176,31 @@ export const usePutHost = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof putHost>>,
|
||||
TError,
|
||||
{ data: BodyType<ZeustypesPostableHostDTO> },
|
||||
{ data?: BodyType<ZeustypesPostableHostDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof putHost>>,
|
||||
TError,
|
||||
{ data: BodyType<ZeustypesPostableHostDTO> },
|
||||
{ data?: BodyType<ZeustypesPostableHostDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getPutHostMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getPutHostMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* This endpoint saves the profile of a deployment to zeus.
|
||||
* @summary Put profile in Zeus for a deployment.
|
||||
*/
|
||||
export const putProfile = (
|
||||
zeustypesPostableProfileDTO: BodyType<ZeustypesPostableProfileDTO>,
|
||||
zeustypesPostableProfileDTO?: BodyType<ZeustypesPostableProfileDTO>,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<void>({
|
||||
url: `/api/v2/zeus/profiles`,
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: zeustypesPostableProfileDTO,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -208,13 +211,13 @@ export const getPutProfileMutationOptions = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof putProfile>>,
|
||||
TError,
|
||||
{ data: BodyType<ZeustypesPostableProfileDTO> },
|
||||
{ data?: BodyType<ZeustypesPostableProfileDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof putProfile>>,
|
||||
TError,
|
||||
{ data: BodyType<ZeustypesPostableProfileDTO> },
|
||||
{ data?: BodyType<ZeustypesPostableProfileDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ['putProfile'];
|
||||
@@ -228,7 +231,7 @@ export const getPutProfileMutationOptions = <
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof putProfile>>,
|
||||
{ data: BodyType<ZeustypesPostableProfileDTO> }
|
||||
{ data?: BodyType<ZeustypesPostableProfileDTO> }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
|
||||
@@ -241,7 +244,9 @@ export const getPutProfileMutationOptions = <
|
||||
export type PutProfileMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof putProfile>>
|
||||
>;
|
||||
export type PutProfileMutationBody = BodyType<ZeustypesPostableProfileDTO>;
|
||||
export type PutProfileMutationBody =
|
||||
| BodyType<ZeustypesPostableProfileDTO>
|
||||
| undefined;
|
||||
export type PutProfileMutationError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
@@ -254,16 +259,14 @@ export const usePutProfile = <
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof putProfile>>,
|
||||
TError,
|
||||
{ data: BodyType<ZeustypesPostableProfileDTO> },
|
||||
{ data?: BodyType<ZeustypesPostableProfileDTO> },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationResult<
|
||||
Awaited<ReturnType<typeof putProfile>>,
|
||||
TError,
|
||||
{ data: BodyType<ZeustypesPostableProfileDTO> },
|
||||
{ data?: BodyType<ZeustypesPostableProfileDTO> },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getPutProfileMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions);
|
||||
return useMutation(getPutProfileMutationOptions(options));
|
||||
};
|
||||
|
||||
@@ -40,7 +40,6 @@ const getTraceV3 = async (
|
||||
const spans: SpanV3[] = (rawPayload.spans || []).map((span: any) => ({
|
||||
...span,
|
||||
'service.name': span.resource?.['service.name'] || '',
|
||||
timestamp: span.time_unix,
|
||||
}));
|
||||
|
||||
// V3 API returns startTimestampMillis/endTimestampMillis as relative durations (ms from epoch offset),
|
||||
|
||||
@@ -44,11 +44,7 @@ function HttpStatusBadge({
|
||||
|
||||
const color = getStatusCodeColor(numericStatusCode);
|
||||
|
||||
return (
|
||||
<Badge color={color} variant="outline">
|
||||
{statusCode}
|
||||
</Badge>
|
||||
);
|
||||
return <Badge color={color}>{statusCode}</Badge>;
|
||||
}
|
||||
|
||||
export default HttpStatusBadge;
|
||||
|
||||
@@ -38,7 +38,6 @@ export enum LOCALSTORAGE {
|
||||
DISSMISSED_COST_METER_INFO = 'DISMISSED_COST_METER_INFO',
|
||||
DISMISSED_API_KEYS_DEPRECATION_BANNER = 'DISMISSED_API_KEYS_DEPRECATION_BANNER',
|
||||
TRACE_DETAILS_SPAN_DETAILS_POSITION = 'TRACE_DETAILS_SPAN_DETAILS_POSITION',
|
||||
TRACE_DETAILS_PREFER_OLD_VIEW = 'TRACE_DETAILS_PREFER_OLD_VIEW',
|
||||
LICENSE_KEY_CALLOUT_DISMISSED = 'LICENSE_KEY_CALLOUT_DISMISSED',
|
||||
DASHBOARD_PREFERENCES = 'DASHBOARD_PREFERENCES',
|
||||
}
|
||||
|
||||
@@ -3,7 +3,5 @@ export const USER_PREFERENCES = {
|
||||
NAV_SHORTCUTS: 'nav_shortcuts',
|
||||
LAST_SEEN_CHANGELOG_VERSION: 'last_seen_changelog_version',
|
||||
SPAN_DETAILS_PINNED_ATTRIBUTES: 'span_details_pinned_attributes',
|
||||
SPAN_DETAILS_PREVIEW_ATTRIBUTES: 'span_details_preview_attributes',
|
||||
SPAN_DETAILS_COLOR_BY_ATTRIBUTE: 'span_details_color_by_attribute',
|
||||
SPAN_PERCENTILE_RESOURCE_ATTRIBUTES: 'span_percentile_resource_attributes',
|
||||
};
|
||||
|
||||
@@ -28,15 +28,15 @@ export interface ICreateAlertContextProps {
|
||||
isCreatingAlertRule: boolean;
|
||||
createAlertRule: UseMutateFunction<
|
||||
CreateRule201,
|
||||
ErrorType<unknown>,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
ErrorType<RenderErrorResponseDTO>,
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
unknown
|
||||
>;
|
||||
isTestingAlertRule: boolean;
|
||||
testAlertRule: UseMutateFunction<
|
||||
TestRule200,
|
||||
ErrorType<unknown>,
|
||||
{ data: BodyType<RuletypesPostableRuleDTO> },
|
||||
ErrorType<RenderErrorResponseDTO>,
|
||||
{ data?: BodyType<RuletypesPostableRuleDTO> },
|
||||
unknown
|
||||
>;
|
||||
discardAlertRule: () => void;
|
||||
@@ -48,7 +48,7 @@ export interface ICreateAlertContextProps {
|
||||
ErrorType<RenderErrorResponseDTO>,
|
||||
{
|
||||
pathParams: UpdateRuleByIDPathParameters;
|
||||
data: BodyType<RuletypesPostableRuleDTO>;
|
||||
data?: BodyType<RuletypesPostableRuleDTO>;
|
||||
},
|
||||
unknown
|
||||
>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Button } from '@signozhq/ui';
|
||||
import { ChevronDown, ChevronRight } from '@signozhq/icons';
|
||||
import styles from './ExpandedButtonWrapper.module.scss';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
@@ -55,7 +55,7 @@ function DisplayName({ index, id: orgId }: DisplayNameProps): JSX.Element {
|
||||
toast.success(t('success', { ns: 'common' }), {
|
||||
position: 'top-right',
|
||||
});
|
||||
updateOrg(orgId, data.displayName ?? '');
|
||||
updateOrg(orgId, data?.displayName ?? '');
|
||||
},
|
||||
onError: (error) => {
|
||||
showErrorModal(
|
||||
|
||||
@@ -218,7 +218,7 @@ function SpanLogs({
|
||||
<Virtuoso
|
||||
className="span-logs-virtuoso"
|
||||
key="span-logs-virtuoso"
|
||||
style={{ height: '100%' }}
|
||||
style={logs.length <= 35 ? { height: `calc(${logs.length} * 22px)` } : {}}
|
||||
data={logs}
|
||||
totalCount={logs.length}
|
||||
itemContent={getItemContent}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
.span-logs {
|
||||
margin-inline: 16px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100% - 64px - 55px - 56px);
|
||||
|
||||
&-virtuoso {
|
||||
background: color-mix(in srgb, var(--bg-robin-200) 4%, transparent);
|
||||
}
|
||||
&-list-container {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
|
||||
.logs-loading-skeleton {
|
||||
height: 100%;
|
||||
|
||||
@@ -68,10 +68,6 @@
|
||||
border-left: unset;
|
||||
border-radius: 0px 4px 4px 0px;
|
||||
}
|
||||
|
||||
.new-view-btn {
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.second-row {
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useLocation, useRouteMatch } from 'react-router-dom';
|
||||
import { Skeleton, Tooltip } from 'antd';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Button, Skeleton, Tooltip } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import removeLocalStorageKey from 'api/browser/localstorage/remove';
|
||||
import { getYAxisFormattedValue } from 'components/Graph/yAxisConfig';
|
||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
import ROUTES from 'constants/routes';
|
||||
import dayjs from 'dayjs';
|
||||
import history from 'lib/history';
|
||||
@@ -64,51 +60,18 @@ function TraceMetadata(props: ITraceMetadataProps): JSX.Element {
|
||||
}
|
||||
};
|
||||
|
||||
const isOnOldRoute = !!useRouteMatch({
|
||||
path: ROUTES.TRACE_DETAIL_OLD,
|
||||
exact: true,
|
||||
});
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
const handleSwitchToNewView = (): void => {
|
||||
removeLocalStorageKey(LOCALSTORAGE.TRACE_DETAILS_PREFER_OLD_VIEW);
|
||||
history.replace({
|
||||
pathname: `/trace/${traceID}`,
|
||||
search: location.search,
|
||||
hash: location.hash,
|
||||
state: location.state,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="trace-metadata">
|
||||
<section className="metadata-info">
|
||||
<div className="first-row">
|
||||
<Button
|
||||
variant="solid"
|
||||
color="secondary"
|
||||
size="icon"
|
||||
className="previous-btn"
|
||||
prefix={<ArrowLeft size={14} />}
|
||||
onClick={handlePreviousBtnClick}
|
||||
/>
|
||||
<Button className="previous-btn" onClick={handlePreviousBtnClick}>
|
||||
<ArrowLeft size={14} />
|
||||
</Button>
|
||||
<div className="trace-name">
|
||||
<DraftingCompass size={14} className="drafting" />
|
||||
<Typography.Text className="trace-id">Trace ID</Typography.Text>
|
||||
</div>
|
||||
<Typography.Text className="trace-id-value">{traceID}</Typography.Text>
|
||||
{isOnOldRoute && (
|
||||
<Button
|
||||
variant="solid"
|
||||
color="primary"
|
||||
size="md"
|
||||
className="new-view-btn"
|
||||
onClick={handleSwitchToNewView}
|
||||
>
|
||||
New view
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{isDataLoading && (
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useMutation } from 'react-query';
|
||||
import setLocalStorageApi from 'api/browser/localstorage/set';
|
||||
import updateUserPreference from 'api/v1/user/preferences/name/update';
|
||||
import { AxiosError } from 'axios';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
import { USER_PREFERENCES } from 'constants/userPreferences';
|
||||
import { useNotifications } from 'hooks/useNotifications';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
import { UserPreference } from 'types/api/preferences/preference';
|
||||
import { showErrorNotification } from 'utils/error';
|
||||
|
||||
import { useLocalStorage } from '../useLocalStorage';
|
||||
|
||||
@@ -10,25 +19,59 @@ interface UsePinnedAttributesReturn {
|
||||
}
|
||||
|
||||
/**
|
||||
* V2 trace-details pinned-attributes hook. localStorage-only.
|
||||
* Hook for managing pinned span attributes with backend persistence.
|
||||
* Falls back to localStorage during initial load and handles migration.
|
||||
*
|
||||
* NOTE: V2 used to also persist to the user-pref API
|
||||
* (`span_details_pinned_attributes`) but V3 now owns that key with a different
|
||||
* (nested-path) format. V2 is isolated to localStorage so it doesn't fight V3
|
||||
* over the same backend value. See `useMigratePinnedAttributes` in V3.
|
||||
* @param availableAttributes - Object keys of the current span's flattened attributes
|
||||
* @returns Object with pinned state, toggle function, and check function
|
||||
*/
|
||||
export function usePinnedAttributes(
|
||||
availableAttributes: string[],
|
||||
): UsePinnedAttributesReturn {
|
||||
const [pinnedKeys, setPinnedKeys] = useLocalStorage<string[]>(
|
||||
const { userPreferences, updateUserPreferenceInContext } = useAppContext();
|
||||
const { notifications } = useNotifications();
|
||||
// API mutation for updating preferences
|
||||
const { mutate: updateUserPreferenceMutation } = useMutation(
|
||||
updateUserPreference,
|
||||
{
|
||||
onError: (error) => {
|
||||
showErrorNotification(notifications, error as AxiosError);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
// Local state for optimistic updates
|
||||
const [pinnedKeys, setPinnedKeys] = useState<string[]>([]);
|
||||
|
||||
// Get localStorage fallback for initial load
|
||||
const [localStoragePinnedKeys] = useLocalStorage<string[]>(
|
||||
LOCALSTORAGE.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
[],
|
||||
);
|
||||
|
||||
// Initialize from user preferences when loaded
|
||||
useEffect(() => {
|
||||
if (userPreferences !== null) {
|
||||
const preference = userPreferences.find(
|
||||
(pref) => pref.name === USER_PREFERENCES.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
);
|
||||
|
||||
if (preference?.value) {
|
||||
// use backend data
|
||||
setPinnedKeys(preference.value as string[]);
|
||||
} else if (localStoragePinnedKeys.length > 0) {
|
||||
// use local storage data
|
||||
setPinnedKeys(localStoragePinnedKeys);
|
||||
}
|
||||
}
|
||||
}, [userPreferences, localStoragePinnedKeys]);
|
||||
|
||||
// Create pinned attributes state from stored keys, filtering by available attributes
|
||||
const pinnedAttributes = useMemo(
|
||||
(): Record<string, boolean> =>
|
||||
pinnedKeys.reduce(
|
||||
(acc, key) => {
|
||||
// Only include if the attribute exists in the current span
|
||||
if (availableAttributes.includes(key)) {
|
||||
acc[key] = true;
|
||||
}
|
||||
@@ -39,17 +82,38 @@ export function usePinnedAttributes(
|
||||
[pinnedKeys, availableAttributes],
|
||||
);
|
||||
|
||||
// Toggle pin state for an attribute
|
||||
const togglePin = useCallback(
|
||||
(attributeKey: string): void => {
|
||||
setPinnedKeys((prev) =>
|
||||
prev.includes(attributeKey)
|
||||
? prev.filter((k) => k !== attributeKey)
|
||||
: [...prev, attributeKey],
|
||||
const currentlyPinned = pinnedKeys.includes(attributeKey);
|
||||
const newPinnedKeys = currentlyPinned
|
||||
? pinnedKeys.filter((key) => key !== attributeKey)
|
||||
: [...pinnedKeys, attributeKey];
|
||||
|
||||
// Optimistically update local state for instant UI feedback
|
||||
setPinnedKeys(newPinnedKeys);
|
||||
|
||||
updateUserPreferenceInContext({
|
||||
name: USER_PREFERENCES.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
value: newPinnedKeys,
|
||||
} as UserPreference);
|
||||
|
||||
// Save to localStorage immediately for offline resilience
|
||||
setLocalStorageApi(
|
||||
LOCALSTORAGE.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
JSON.stringify(newPinnedKeys),
|
||||
);
|
||||
|
||||
// Make the API call in the background
|
||||
updateUserPreferenceMutation({
|
||||
name: USER_PREFERENCES.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
value: newPinnedKeys,
|
||||
});
|
||||
},
|
||||
[setPinnedKeys],
|
||||
[pinnedKeys, updateUserPreferenceInContext, updateUserPreferenceMutation],
|
||||
);
|
||||
|
||||
// Check if an attribute is pinned
|
||||
const isPinned = useCallback(
|
||||
(attributeKey: string): boolean => pinnedAttributes[attributeKey] === true,
|
||||
[pinnedAttributes],
|
||||
|
||||
@@ -12,11 +12,8 @@ const useGetTraceFlamegraph = (
|
||||
): UseLicense =>
|
||||
useQuery({
|
||||
queryFn: () => getTraceFlamegraph(props),
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.GET_TRACE_V2_FLAMEGRAPH,
|
||||
props.traceId,
|
||||
props.selectFields,
|
||||
],
|
||||
// if any of the props changes then we need to trigger an API call as the older data will be obsolete
|
||||
queryKey: [REACT_QUERY_KEY.GET_TRACE_V2_FLAMEGRAPH, props.traceId],
|
||||
enabled: !!props.traceId,
|
||||
keepPreviousData: true,
|
||||
refetchOnWindowFocus: false,
|
||||
|
||||
@@ -15,7 +15,6 @@ const useGetTraceV3 = (props: GetTraceV3PayloadProps): UseTraceV3 =>
|
||||
props.traceId,
|
||||
props.selectedSpanId,
|
||||
props.isSelectedSpanIDUnCollapsed,
|
||||
props.aggregations,
|
||||
],
|
||||
enabled: !!props.traceId,
|
||||
keepPreviousData: true,
|
||||
|
||||
@@ -1,25 +1,5 @@
|
||||
import { Redirect, useParams } from 'react-router-dom';
|
||||
import getLocalStorageKey from 'api/browser/localstorage/get';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
import { TraceDetailV2URLProps } from 'types/api/trace/getTraceV2';
|
||||
|
||||
import TraceDetailsV3 from '../TraceDetailsV3';
|
||||
|
||||
export default function TraceDetailV3Page(): JSX.Element {
|
||||
const { id } = useParams<TraceDetailV2URLProps>();
|
||||
const preferOld =
|
||||
getLocalStorageKey(LOCALSTORAGE.TRACE_DETAILS_PREFER_OLD_VIEW) === 'true';
|
||||
|
||||
if (preferOld) {
|
||||
return (
|
||||
<Redirect
|
||||
to={{
|
||||
pathname: `/trace-old/${id}`,
|
||||
search: window.location.search,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return <TraceDetailsV3 />;
|
||||
}
|
||||
|
||||
@@ -10,14 +10,16 @@ import { themeColors } from 'constants/theme';
|
||||
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
|
||||
import { FloatingPanel } from 'periscope/components/FloatingPanel';
|
||||
|
||||
import { useTraceContext } from '../../contexts/TraceContext';
|
||||
import { AGGREGATIONS } from '../../utils/aggregations';
|
||||
|
||||
import './AnalyticsPanel.styles.scss';
|
||||
|
||||
interface AnalyticsPanelProps {
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
serviceExecTime?: Record<string, number>;
|
||||
traceStartTime?: number;
|
||||
traceEndTime?: number;
|
||||
// TODO: Re-enable when backend provides per-service span counts
|
||||
// spans?: Span[];
|
||||
}
|
||||
|
||||
const PANEL_WIDTH = 350;
|
||||
@@ -28,46 +30,41 @@ const PANEL_MARGIN_BOTTOM = 50;
|
||||
function AnalyticsPanel({
|
||||
isOpen,
|
||||
onClose,
|
||||
serviceExecTime = {},
|
||||
traceStartTime = 0,
|
||||
traceEndTime = 0,
|
||||
}: AnalyticsPanelProps): JSX.Element | null {
|
||||
const { getAggregationMap } = useTraceContext();
|
||||
|
||||
const execTimePct = useMemo(
|
||||
() => getAggregationMap(AGGREGATIONS.EXEC_TIME_PCT),
|
||||
[getAggregationMap],
|
||||
);
|
||||
|
||||
const spanCounts = useMemo(
|
||||
() => getAggregationMap(AGGREGATIONS.SPAN_COUNT),
|
||||
[getAggregationMap],
|
||||
);
|
||||
const spread = traceEndTime - traceStartTime;
|
||||
|
||||
const execTimeRows = useMemo(() => {
|
||||
if (!execTimePct) {
|
||||
if (spread <= 0) {
|
||||
return [];
|
||||
}
|
||||
return Object.entries(execTimePct)
|
||||
.map(([group, percentage]) => ({
|
||||
group,
|
||||
percentage,
|
||||
color: generateColor(group, themeColors.traceDetailColorsV3),
|
||||
return Object.entries(serviceExecTime)
|
||||
.map(([service, duration]) => ({
|
||||
service,
|
||||
percentage: (duration * 100) / spread,
|
||||
color: generateColor(service, themeColors.traceDetailColorsV3),
|
||||
}))
|
||||
.sort((a, b) => b.percentage - a.percentage);
|
||||
}, [execTimePct]);
|
||||
}, [serviceExecTime, spread]);
|
||||
|
||||
const spanCountRows = useMemo(() => {
|
||||
if (!spanCounts) {
|
||||
return [];
|
||||
}
|
||||
const max = Math.max(...Object.values(spanCounts), 1);
|
||||
return Object.entries(spanCounts)
|
||||
.map(([group, count]) => ({
|
||||
group,
|
||||
count,
|
||||
max,
|
||||
color: generateColor(group, themeColors.traceDetailColorsV3),
|
||||
}))
|
||||
.sort((a, b) => b.count - a.count);
|
||||
}, [spanCounts]);
|
||||
// const spanCountRows = useMemo(() => {
|
||||
// const counts: Record<string, number> = {};
|
||||
// for (const span of spans) {
|
||||
// const name = span.serviceName || 'unknown';
|
||||
// counts[name] = (counts[name] || 0) + 1;
|
||||
// }
|
||||
// return Object.entries(counts)
|
||||
// .map(([service, count]) => ({
|
||||
// service,
|
||||
// count,
|
||||
// color: generateColor(service, themeColors.traceDetailColorsV3),
|
||||
// }))
|
||||
// .sort((a, b) => b.count - a.count);
|
||||
// }, [spans]);
|
||||
|
||||
// const maxSpanCount = spanCountRows[0]?.count || 1;
|
||||
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
@@ -106,9 +103,11 @@ function AnalyticsPanel({
|
||||
<TabsTrigger value="exec-time" variant="secondary">
|
||||
% exec time
|
||||
</TabsTrigger>
|
||||
{/* TODO: Enable when backend provides per-service span counts
|
||||
<TabsTrigger value="spans" variant="secondary">
|
||||
Spans
|
||||
</TabsTrigger>
|
||||
*/}
|
||||
</TabsList>
|
||||
|
||||
<div className="analytics-panel__tabs-scroll">
|
||||
@@ -117,17 +116,17 @@ function AnalyticsPanel({
|
||||
{execTimeRows.map((row) => (
|
||||
<>
|
||||
<div
|
||||
key={`${row.group}-dot`}
|
||||
key={`${row.service}-dot`}
|
||||
className="analytics-panel__dot"
|
||||
style={{ backgroundColor: row.color }}
|
||||
/>
|
||||
<span
|
||||
key={`${row.group}-name`}
|
||||
key={`${row.service}-name`}
|
||||
className="analytics-panel__service-name"
|
||||
>
|
||||
{row.group}
|
||||
{row.service}
|
||||
</span>
|
||||
<div key={`${row.group}-bar`} className="analytics-panel__bar-cell">
|
||||
<div key={`${row.service}-bar`} className="analytics-panel__bar-cell">
|
||||
<div className="analytics-panel__bar">
|
||||
<div
|
||||
className="analytics-panel__bar-fill"
|
||||
@@ -146,27 +145,28 @@ function AnalyticsPanel({
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
{/* TODO: Enable when backend provides per-service span counts
|
||||
<TabsContent value="spans">
|
||||
<div className="analytics-panel__list">
|
||||
{spanCountRows.map((row) => (
|
||||
<>
|
||||
<div
|
||||
key={`${row.group}-dot`}
|
||||
key={`${row.service}-dot`}
|
||||
className="analytics-panel__dot"
|
||||
style={{ backgroundColor: row.color }}
|
||||
/>
|
||||
<span
|
||||
key={`${row.group}-name`}
|
||||
key={`${row.service}-name`}
|
||||
className="analytics-panel__service-name"
|
||||
>
|
||||
{row.group}
|
||||
{row.service}
|
||||
</span>
|
||||
<div key={`${row.group}-bar`} className="analytics-panel__bar-cell">
|
||||
<div key={`${row.service}-bar`} className="analytics-panel__bar-cell">
|
||||
<div className="analytics-panel__bar">
|
||||
<div
|
||||
className="analytics-panel__bar-fill"
|
||||
style={{
|
||||
width: `${(row.count / row.max) * 100}%`,
|
||||
width: `${(row.count / maxSpanCount) * 100}%`,
|
||||
backgroundColor: row.color,
|
||||
}}
|
||||
/>
|
||||
@@ -179,6 +179,7 @@ function AnalyticsPanel({
|
||||
))}
|
||||
</div>
|
||||
</TabsContent>
|
||||
*/}
|
||||
</div>
|
||||
</TabsRoot>
|
||||
</div>
|
||||
|
||||
@@ -64,13 +64,9 @@
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
scrollbar-width: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
[role='tabpanel'] {
|
||||
padding: 0;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,8 +112,7 @@
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent-forest);
|
||||
flex-shrink: 0;
|
||||
background: var(--success-500);
|
||||
}
|
||||
|
||||
&__trace-id {
|
||||
@@ -128,17 +123,6 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
&__trace-id-copy {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
height: auto;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
&__key-attributes {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -41,12 +41,7 @@ import Events from 'container/SpanDetailsDrawer/Events/Events';
|
||||
import SpanLogs from 'container/SpanDetailsDrawer/SpanLogs/SpanLogs';
|
||||
import { useSpanContextLogs } from 'container/SpanDetailsDrawer/SpanLogs/useSpanContextLogs';
|
||||
import dayjs from 'dayjs';
|
||||
import { useMigratePinnedAttributes } from 'pages/TraceDetailsV3/hooks/useMigratePinnedAttributes';
|
||||
import {
|
||||
getSpanAttribute,
|
||||
getSpanDisplayData,
|
||||
hasInfraMetadata,
|
||||
} from 'pages/TraceDetailsV3/utils';
|
||||
import { getSpanAttribute, hasInfraMetadata } from 'pages/TraceDetailsV3/utils';
|
||||
import { DataViewer } from 'periscope/components/DataViewer';
|
||||
import { FloatingPanel } from 'periscope/components/FloatingPanel';
|
||||
import KeyValueLabel from 'periscope/components/KeyValueLabel';
|
||||
@@ -64,7 +59,6 @@ import {
|
||||
VISIBLE_ACTIONS,
|
||||
} from './constants';
|
||||
import { useSpanAttributeActions } from './hooks/useSpanAttributeActions';
|
||||
import { useTracePinnedFields } from './hooks/useTracePinnedFields';
|
||||
import {
|
||||
LinkedSpansPanel,
|
||||
LinkedSpansToggle,
|
||||
@@ -83,6 +77,7 @@ interface SpanDetailsPanelProps {
|
||||
onVariantChange?: (variant: SpanDetailVariant) => void;
|
||||
traceStartTime?: number;
|
||||
traceEndTime?: number;
|
||||
serviceExecTime?: Record<string, number>;
|
||||
}
|
||||
|
||||
function SpanDetailsContent({
|
||||
@@ -99,17 +94,6 @@ function SpanDetailsContent({
|
||||
const percentile = useSpanPercentile(selectedSpan);
|
||||
const linkedSpans = useLinkedSpans((selectedSpan as any).references);
|
||||
|
||||
// One-time conversion of any V2-format value still living in the
|
||||
// `span_details_pinned_attributes` user pref into V3 nested-path format.
|
||||
useMigratePinnedAttributes(selectedSpan);
|
||||
const { value: pinnedFieldsValue, onChange: onPinnedFieldsChange } =
|
||||
useTracePinnedFields();
|
||||
|
||||
const spanDisplayData = useMemo(
|
||||
() => getSpanDisplayData(selectedSpan),
|
||||
[selectedSpan],
|
||||
);
|
||||
|
||||
// Map span attribute actions to PrettyView actions format.
|
||||
// Use the last key in fieldKeyPath (the actual attribute key), not the full display path.
|
||||
const prettyViewCustomActions = useMemo(
|
||||
@@ -407,14 +391,12 @@ function SpanDetailsContent({
|
||||
<div className="span-details-panel__tabs-scroll">
|
||||
<TabsContent value="overview">
|
||||
<DataViewer
|
||||
data={spanDisplayData}
|
||||
data={selectedSpan}
|
||||
drawerKey="trace-details"
|
||||
prettyViewProps={{
|
||||
showPinned: true,
|
||||
actions: prettyViewCustomActions,
|
||||
visibleActions: VISIBLE_ACTIONS,
|
||||
pinnedFieldsValue,
|
||||
onPinnedFieldsChange,
|
||||
}}
|
||||
/>
|
||||
</TabsContent>
|
||||
@@ -469,6 +451,7 @@ function SpanDetailsPanel({
|
||||
onVariantChange,
|
||||
traceStartTime,
|
||||
traceEndTime,
|
||||
serviceExecTime,
|
||||
}: SpanDetailsPanelProps): JSX.Element {
|
||||
const [isAnalyticsOpen, setIsAnalyticsOpen] = useState(false);
|
||||
|
||||
@@ -575,6 +558,9 @@ function SpanDetailsPanel({
|
||||
<AnalyticsPanel
|
||||
isOpen={isAnalyticsOpen}
|
||||
onClose={(): void => setIsAnalyticsOpen(false)}
|
||||
serviceExecTime={serviceExecTime}
|
||||
traceStartTime={traceStartTime}
|
||||
traceEndTime={traceEndTime}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -608,7 +594,6 @@ function SpanDetailsPanel({
|
||||
isOpen={panelState.isOpen}
|
||||
className="span-details-panel"
|
||||
width={PANEL_WIDTH}
|
||||
minWidth={480}
|
||||
height={window.innerHeight - PANEL_MARGIN_TOP - PANEL_MARGIN_BOTTOM}
|
||||
defaultPosition={{
|
||||
x: window.innerWidth - PANEL_WIDTH - PANEL_MARGIN_RIGHT,
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
import { Link, useRouteMatch } from 'react-router-dom';
|
||||
import { useCopyToClipboard } from 'react-use';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { toast } from '@signozhq/ui/sonner';
|
||||
import ROUTES from 'constants/routes';
|
||||
import { SpanV3 } from 'types/api/trace/getTraceV3';
|
||||
|
||||
interface TraceIdFieldProps {
|
||||
span: SpanV3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a span's trace id. When the user is already on the trace detail
|
||||
* page for this trace, clicking the id copies it to the clipboard (the
|
||||
* "navigate" affordance would be a no-op). Otherwise, falls back to the
|
||||
* existing link to the trace detail page.
|
||||
*/
|
||||
export function TraceIdField({ span }: TraceIdFieldProps): JSX.Element {
|
||||
const match = useRouteMatch<{ id: string }>({
|
||||
path: ROUTES.TRACE_DETAIL,
|
||||
exact: true,
|
||||
});
|
||||
const [, setCopy] = useCopyToClipboard();
|
||||
|
||||
const isCurrentTrace = match?.params.id === span.trace_id;
|
||||
|
||||
if (isCurrentTrace) {
|
||||
const handleCopy = (): void => {
|
||||
setCopy(span.trace_id);
|
||||
toast.success('Trace ID copied to clipboard', {
|
||||
position: 'top-right',
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="link"
|
||||
color="secondary"
|
||||
className="span-details-panel__trace-id-copy"
|
||||
onClick={handleCopy}
|
||||
title="Click to copy trace ID"
|
||||
>
|
||||
{span.trace_id}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Link
|
||||
to={{
|
||||
pathname: `/trace/${span.trace_id}`,
|
||||
search: window.location.search,
|
||||
}}
|
||||
className="span-details-panel__trace-id"
|
||||
>
|
||||
{span.trace_id}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Badge } from '@signozhq/ui/badge';
|
||||
import { SpanV3 } from 'types/api/trace/getTraceV3';
|
||||
|
||||
import { TraceIdField } from './TraceIdField';
|
||||
|
||||
interface HighlightedOption {
|
||||
key: string;
|
||||
label: string;
|
||||
@@ -34,7 +33,17 @@ export const HIGHLIGHTED_OPTIONS: HighlightedOption[] = [
|
||||
key: 'traceId',
|
||||
label: 'TRACE ID',
|
||||
render: (span): ReactNode | null =>
|
||||
span.trace_id ? <TraceIdField span={span} /> : null,
|
||||
span.trace_id ? (
|
||||
<Link
|
||||
to={{
|
||||
pathname: `/trace/${span.trace_id}`,
|
||||
search: window.location.search,
|
||||
}}
|
||||
className="span-details-panel__trace-id"
|
||||
>
|
||||
{span.trace_id}
|
||||
</Link>
|
||||
) : null,
|
||||
},
|
||||
{
|
||||
key: 'spanKind',
|
||||
@@ -42,12 +51,4 @@ export const HIGHLIGHTED_OPTIONS: HighlightedOption[] = [
|
||||
render: (span): ReactNode | null =>
|
||||
span.kind_string ? <Badge color="vanilla">{span.kind_string}</Badge> : null,
|
||||
},
|
||||
{
|
||||
key: 'statusMessage',
|
||||
label: 'STATUS MESSAGE',
|
||||
render: (span): ReactNode | null =>
|
||||
span.status_message ? (
|
||||
<Badge color="vanilla">{span.status_message}</Badge>
|
||||
) : null,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useMutation } from 'react-query';
|
||||
import updateUserPreferenceAPI from 'api/v1/user/preferences/name/update';
|
||||
import { USER_PREFERENCES } from 'constants/userPreferences';
|
||||
import { isV3PinnedAttribute } from 'pages/TraceDetailsV3/utils';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
|
||||
interface UseTracePinnedFieldsReturn {
|
||||
value: string[];
|
||||
onChange: (next: string[]) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads/writes V3 trace-details pinned attributes from the user-preference
|
||||
* `span_details_pinned_attributes` (cross-device sync). Drops legacy V2-format
|
||||
* entries from the rendered set so PrettyView never tries to render an
|
||||
* un-parseable path while the migration is in flight.
|
||||
*
|
||||
* Migration of V2 → V3 format is handled separately by
|
||||
* `useMigratePinnedAttributes`.
|
||||
*/
|
||||
export function useTracePinnedFields(): UseTracePinnedFieldsReturn {
|
||||
const { userPreferences, updateUserPreferenceInContext } = useAppContext();
|
||||
const { mutate } = useMutation(updateUserPreferenceAPI);
|
||||
|
||||
const value = useMemo<string[]>(() => {
|
||||
const pref = userPreferences?.find(
|
||||
(p) => p.name === USER_PREFERENCES.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
);
|
||||
const arr = (pref?.value as string[] | undefined) ?? [];
|
||||
return arr.filter(isV3PinnedAttribute);
|
||||
}, [userPreferences]);
|
||||
|
||||
const onChange = useCallback(
|
||||
(next: string[]) => {
|
||||
const existing = userPreferences?.find(
|
||||
(p) => p.name === USER_PREFERENCES.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
);
|
||||
if (existing) {
|
||||
updateUserPreferenceInContext({ ...existing, value: next });
|
||||
}
|
||||
mutate({
|
||||
name: USER_PREFERENCES.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
value: next,
|
||||
});
|
||||
},
|
||||
[userPreferences, updateUserPreferenceInContext, mutate],
|
||||
);
|
||||
|
||||
return { value, onChange };
|
||||
}
|
||||
@@ -29,7 +29,7 @@ export function EventTooltipContent({
|
||||
{eventName}
|
||||
</div>
|
||||
<div className="event-tooltip-content__time">
|
||||
{toFixed(time, 2)} {timeUnitName} since span start
|
||||
{toFixed(time, 2)} {timeUnitName} from start
|
||||
</div>
|
||||
{Object.keys(attributeMap).length > 0 && (
|
||||
<>
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
// Invisible 1 px anchor mounted inside the scrollable waterfall body. Its
|
||||
// `top` is updated by the parent to track the hovered row's Y; its `left`
|
||||
// is the sidebar/timeline boundary so the popover always opens at the same
|
||||
// X regardless of which row is hovered.
|
||||
.span-hover-card-anchor {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
pointer-events: none;
|
||||
.span-hover-card-wrapper {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.span-hover-card-popover {
|
||||
// Hover card may be rendered while the SpanDetailsPanel is docked as
|
||||
// a FloatingPanel (z-index 999); bump above the default tooltip z-index.
|
||||
// Event-dot tooltip is rendered while the SpanDetailsPanel may be docked as
|
||||
// a FloatingPanel (z-index 999); bump above the default tooltip z-index 50.
|
||||
--tooltip-z-index: 1000;
|
||||
background-color: var(--l1-background);
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
border: 1px solid var(--l2-border);
|
||||
color: var(--l1-foreground);
|
||||
|
||||
.ant-popover-inner {
|
||||
background-color: var(--l1-background);
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
border: 1px solid var(--l2-border);
|
||||
}
|
||||
|
||||
.ant-popover-inner-content {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Flamegraph tooltip — rendered as a portal, uses same semantic tokens.
|
||||
|
||||
@@ -1,33 +1,16 @@
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from '@signozhq/ui/tooltip';
|
||||
import { memo, ReactNode, useCallback, useRef, useState } from 'react';
|
||||
import { Popover } from 'antd';
|
||||
import { themeColors } from 'constants/theme';
|
||||
import { convertTimeToRelevantUnit } from 'container/TraceDetail/utils';
|
||||
import { useTraceContext } from 'pages/TraceDetailsV3/contexts/TraceContext';
|
||||
import { getSpanAttribute } from 'pages/TraceDetailsV3/utils';
|
||||
import { useMemo } from 'react';
|
||||
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
|
||||
import { SpanV3 } from 'types/api/trace/getTraceV3';
|
||||
import { toFixed } from 'utils/toFixed';
|
||||
|
||||
import './SpanHoverCard.styles.scss';
|
||||
|
||||
/**
|
||||
* Span-level fields that the tooltip always shows (as the colored title or
|
||||
* one of the status/start/duration rows). Preview rows for these keys are
|
||||
* filtered out to avoid duplication.
|
||||
*/
|
||||
export const RESERVED_PREVIEW_KEYS: ReadonlySet<string> = new Set([
|
||||
'name',
|
||||
'has_error',
|
||||
'timestamp',
|
||||
'duration_nano',
|
||||
]);
|
||||
|
||||
export interface SpanPreviewRow {
|
||||
key: string;
|
||||
value: string;
|
||||
interface ITraceMetadata {
|
||||
startTime: number;
|
||||
endTime: number;
|
||||
}
|
||||
|
||||
export interface SpanTooltipContentProps {
|
||||
@@ -36,7 +19,6 @@ export interface SpanTooltipContentProps {
|
||||
hasError: boolean;
|
||||
relativeStartMs: number;
|
||||
durationMs: number;
|
||||
previewRows?: SpanPreviewRow[];
|
||||
}
|
||||
|
||||
export function SpanTooltipContent({
|
||||
@@ -45,7 +27,6 @@ export function SpanTooltipContent({
|
||||
hasError,
|
||||
relativeStartMs,
|
||||
durationMs,
|
||||
previewRows,
|
||||
}: SpanTooltipContentProps): JSX.Element {
|
||||
const { time: formattedDuration, timeUnitName } =
|
||||
convertTimeToRelevantUnit(durationMs);
|
||||
@@ -56,118 +37,104 @@ export function SpanTooltipContent({
|
||||
{spanName}
|
||||
</div>
|
||||
<div className="span-hover-card-content__row">
|
||||
status: {hasError ? 'error' : 'ok'}
|
||||
Status: {hasError ? 'error' : 'ok'}
|
||||
</div>
|
||||
<div className="span-hover-card-content__row">
|
||||
start: {toFixed(relativeStartMs, 2)} ms
|
||||
Start: {toFixed(relativeStartMs, 2)} ms
|
||||
</div>
|
||||
<div className="span-hover-card-content__row">
|
||||
duration: {toFixed(formattedDuration, 2)} {timeUnitName}
|
||||
Duration: {toFixed(formattedDuration, 2)} {timeUnitName}
|
||||
</div>
|
||||
{previewRows && previewRows.length > 0 && (
|
||||
<div className="span-hover-card-content__preview">
|
||||
{previewRows.map((row) => (
|
||||
<div key={row.key} className="span-hover-card-content__row">
|
||||
<span className="span-hover-card-content__preview-key">{row.key}:</span>{' '}
|
||||
<span className="span-hover-card-content__preview-value">
|
||||
{row.value}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Single hover card anchored at a fixed X (sidebar/timeline boundary). The
|
||||
* Y of the anchor is derived from the hovered span's index in the list,
|
||||
* so the card slides vertically in place rather than jumping with the cursor.
|
||||
*
|
||||
* Mount this inside the scrollable waterfall body so `anchorTop` is in
|
||||
* content coordinates — Radix portals the content layer out automatically.
|
||||
*/
|
||||
export interface SpanHoverCardProps {
|
||||
hoveredSpanId: string | null;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
anchorLeft: number;
|
||||
rowHeight: number;
|
||||
spans: SpanV3[];
|
||||
traceStartTime: number;
|
||||
interface SpanHoverCardProps {
|
||||
span: SpanV3;
|
||||
traceMetadata: ITraceMetadata;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export function SpanHoverCard({
|
||||
hoveredSpanId,
|
||||
onOpenChange,
|
||||
anchorLeft,
|
||||
rowHeight,
|
||||
spans,
|
||||
traceStartTime,
|
||||
/**
|
||||
* Lazy hover card — only mounts the expensive antd Popover when the user
|
||||
* actually hovers over the element (after a short delay). During fast scrolling,
|
||||
* rows mount and unmount without ever creating a Popover instance, avoiding
|
||||
* expensive DOM/effect overhead from antd Tooltip/Trigger internals.
|
||||
*/
|
||||
const SpanHoverCard = memo(function SpanHoverCard({
|
||||
span,
|
||||
traceMetadata,
|
||||
children,
|
||||
}: SpanHoverCardProps): JSX.Element {
|
||||
const { previewFields, resolveSpanColor } = useTraceContext();
|
||||
const [showPopover, setShowPopover] = useState(false);
|
||||
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const hoverCardData = useMemo(() => {
|
||||
if (!hoveredSpanId) {
|
||||
return null;
|
||||
}
|
||||
const idx = spans.findIndex((s) => s.span_id === hoveredSpanId);
|
||||
if (idx === -1) {
|
||||
return null;
|
||||
}
|
||||
const span = spans[idx];
|
||||
const previewRows: SpanPreviewRow[] = previewFields
|
||||
.filter((f) => !RESERVED_PREVIEW_KEYS.has(f.key))
|
||||
.map((f) => {
|
||||
const value = getSpanAttribute(span, f.key);
|
||||
return value !== undefined && value !== ''
|
||||
? { key: f.key, value: String(value) }
|
||||
: null;
|
||||
})
|
||||
.filter((r): r is SpanPreviewRow => r !== null);
|
||||
const handleMouseEnter = useCallback((): void => {
|
||||
timerRef.current = setTimeout(() => {
|
||||
setShowPopover(true);
|
||||
}, 200);
|
||||
}, []);
|
||||
|
||||
return {
|
||||
anchorTop: idx * rowHeight,
|
||||
tooltip: {
|
||||
spanName: span.name,
|
||||
color: resolveSpanColor(span),
|
||||
hasError: span.has_error,
|
||||
relativeStartMs: span.timestamp - traceStartTime,
|
||||
durationMs: span.duration_nano / 1e6,
|
||||
previewRows,
|
||||
},
|
||||
};
|
||||
}, [
|
||||
hoveredSpanId,
|
||||
spans,
|
||||
previewFields,
|
||||
resolveSpanColor,
|
||||
rowHeight,
|
||||
traceStartTime,
|
||||
]);
|
||||
const handleMouseLeave = useCallback((): void => {
|
||||
if (timerRef.current) {
|
||||
clearTimeout(timerRef.current);
|
||||
timerRef.current = null;
|
||||
}
|
||||
setShowPopover(false);
|
||||
}, []);
|
||||
|
||||
if (!showPopover) {
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
||||
<span
|
||||
className="span-hover-card-wrapper"
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
const durationMs = span.duration_nano / 1e6;
|
||||
const relativeStartMs = span.timestamp - traceMetadata.startTime;
|
||||
|
||||
let color = generateColor(
|
||||
span['service.name'],
|
||||
themeColors.traceDetailColorsV3,
|
||||
);
|
||||
if (span.has_error) {
|
||||
color = 'var(--bg-cherry-500)';
|
||||
}
|
||||
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<Tooltip open={hoverCardData !== null} onOpenChange={onOpenChange}>
|
||||
<TooltipTrigger asChild>
|
||||
<div
|
||||
className="span-hover-card-anchor"
|
||||
style={{
|
||||
top: hoverCardData?.anchorTop ?? 0,
|
||||
left: anchorLeft,
|
||||
height: rowHeight,
|
||||
}}
|
||||
/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent
|
||||
side="right"
|
||||
align="start"
|
||||
sideOffset={8}
|
||||
className="span-hover-card-popover"
|
||||
>
|
||||
{hoverCardData && <SpanTooltipContent {...hoverCardData.tooltip} />}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
<Popover
|
||||
open
|
||||
content={
|
||||
<SpanTooltipContent
|
||||
spanName={span.name}
|
||||
color={color}
|
||||
hasError={span.has_error}
|
||||
relativeStartMs={relativeStartMs}
|
||||
durationMs={durationMs}
|
||||
/>
|
||||
}
|
||||
trigger="hover"
|
||||
rootClassName="span-hover-card-popover"
|
||||
autoAdjustOverflow
|
||||
arrow={false}
|
||||
onOpenChange={(open): void => {
|
||||
if (!open) {
|
||||
setShowPopover(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{/* eslint-disable-next-line jsx-a11y/mouse-events-have-key-events */}
|
||||
<span className="span-hover-card-wrapper" onMouseLeave={handleMouseLeave}>
|
||||
{children}
|
||||
</span>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default SpanHoverCard;
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
.trace-details-header-wrapper {
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.trace-details-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -21,53 +16,13 @@
|
||||
&.trace-v3-filter-row {
|
||||
padding: 0;
|
||||
}
|
||||
max-width: 850px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
&:not(&--expanded) {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
&--expanded {
|
||||
max-width: none;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&__old-view-btn {
|
||||
margin-left: auto;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&__sub-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 4px 16px 8px;
|
||||
font-size: 13px;
|
||||
color: var(--l2-foreground);
|
||||
}
|
||||
|
||||
&__sub-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__separator {
|
||||
color: var(--l2-foreground);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
&__entry-point-badge {
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--l2-border);
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
&__skeleton .ant-skeleton-input {
|
||||
width: 160px !important;
|
||||
min-height: 20px !important;
|
||||
height: 20px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useCallback } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Skeleton } from 'antd';
|
||||
import setLocalStorageKey from 'api/browser/localstorage/set';
|
||||
import HttpStatusBadge from 'components/HttpStatusBadge/HttpStatusBadge';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
import ROUTES from 'constants/routes';
|
||||
import { convertTimeToRelevantUnit } from 'container/TraceDetail/utils';
|
||||
import dayjs from 'dayjs';
|
||||
import history from 'lib/history';
|
||||
import { ArrowLeft, CalendarClock, Server, Timer } from '@signozhq/icons';
|
||||
import { FloatingPanel } from 'periscope/components/FloatingPanel';
|
||||
import { ArrowLeft } from '@signozhq/icons';
|
||||
import KeyValueLabel from 'periscope/components/KeyValueLabel';
|
||||
import { TraceDetailV2URLProps } from 'types/api/trace/getTraceV2';
|
||||
import { DataSource } from 'types/common/queryBuilder';
|
||||
|
||||
import FieldsSettings from '../components/FieldsSettings/FieldsSettings';
|
||||
import { useTraceContext } from '../contexts/TraceContext';
|
||||
import Filters from '../TraceWaterfall/TraceWaterfallStates/Success/Filters/Filters';
|
||||
import TraceOptionsMenu from './TraceOptionsMenu';
|
||||
|
||||
import './TraceDetailsHeader.styles.scss';
|
||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||
|
||||
interface FilterMetadata {
|
||||
startTime: number;
|
||||
@@ -29,53 +17,20 @@ interface FilterMetadata {
|
||||
traceId: string;
|
||||
}
|
||||
|
||||
export interface TraceMetadataForHeader {
|
||||
startTimestampMillis: number;
|
||||
endTimestampMillis: number;
|
||||
rootServiceName: string;
|
||||
rootServiceEntryPoint: string;
|
||||
rootSpanStatusCode: string;
|
||||
}
|
||||
|
||||
interface TraceDetailsHeaderProps {
|
||||
filterMetadata: FilterMetadata;
|
||||
onFilteredSpansChange: (spanIds: string[], isFilterActive: boolean) => void;
|
||||
isDataLoaded?: boolean;
|
||||
traceMetadata?: TraceMetadataForHeader;
|
||||
}
|
||||
|
||||
const SKELETON_COUNT = 3;
|
||||
|
||||
function DetailsLoader(): JSX.Element {
|
||||
return (
|
||||
<>
|
||||
{Array.from({ length: SKELETON_COUNT }).map((_, i) => (
|
||||
<Skeleton.Input
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key={i}
|
||||
active
|
||||
size="small"
|
||||
className="trace-details-header__skeleton"
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
noData?: boolean;
|
||||
}
|
||||
|
||||
function TraceDetailsHeader({
|
||||
filterMetadata,
|
||||
onFilteredSpansChange,
|
||||
isDataLoaded,
|
||||
traceMetadata,
|
||||
noData,
|
||||
}: TraceDetailsHeaderProps): JSX.Element {
|
||||
const { id: traceID } = useParams<TraceDetailV2URLProps>();
|
||||
const [showTraceDetails, setShowTraceDetails] = useState(true);
|
||||
const [isFilterExpanded, setIsFilterExpanded] = useState(false);
|
||||
const [isPreviewFieldsOpen, setIsPreviewFieldsOpen] = useState(false);
|
||||
const { previewFields, setPreviewFields } = useTraceContext();
|
||||
|
||||
const handleSwitchToOldView = useCallback((): void => {
|
||||
setLocalStorageKey(LOCALSTORAGE.TRACE_DETAILS_PREFER_OLD_VIEW, 'true');
|
||||
const oldUrl = `/trace-old/${traceID}${window.location.search}`;
|
||||
history.replace(oldUrl);
|
||||
}, [traceID]);
|
||||
@@ -94,127 +49,42 @@ function TraceDetailsHeader({
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleToggleTraceDetails = useCallback((): void => {
|
||||
setShowTraceDetails((prev) => !prev);
|
||||
}, []);
|
||||
|
||||
const durationMs = traceMetadata
|
||||
? traceMetadata.endTimestampMillis - traceMetadata.startTimestampMillis
|
||||
: 0;
|
||||
const { time: formattedDuration, timeUnitName } =
|
||||
convertTimeToRelevantUnit(durationMs);
|
||||
|
||||
return (
|
||||
<div className="trace-details-header-wrapper">
|
||||
<div className="trace-details-header">
|
||||
{!isFilterExpanded && (
|
||||
<>
|
||||
<Button
|
||||
variant="solid"
|
||||
color="secondary"
|
||||
size="md"
|
||||
className="trace-details-header__back-btn"
|
||||
onClick={handlePreviousBtnClick}
|
||||
>
|
||||
<ArrowLeft size={14} />
|
||||
</Button>
|
||||
<KeyValueLabel
|
||||
badgeKey="Trace ID"
|
||||
badgeValue={traceID || ''}
|
||||
maxCharacters={100}
|
||||
<div className="trace-details-header">
|
||||
<Button
|
||||
variant="solid"
|
||||
color="secondary"
|
||||
size="sm"
|
||||
className="trace-details-header__back-btn"
|
||||
onClick={handlePreviousBtnClick}
|
||||
>
|
||||
<ArrowLeft size={14} />
|
||||
</Button>
|
||||
<KeyValueLabel
|
||||
badgeKey="Trace ID"
|
||||
badgeValue={traceID || ''}
|
||||
maxCharacters={100}
|
||||
/>
|
||||
{!noData && (
|
||||
<>
|
||||
<div className="trace-details-header__filter">
|
||||
<Filters
|
||||
startTime={filterMetadata.startTime}
|
||||
endTime={filterMetadata.endTime}
|
||||
traceID={filterMetadata.traceId}
|
||||
onFilteredSpansChange={onFilteredSpansChange}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{isDataLoaded && (
|
||||
<>
|
||||
<div
|
||||
className={`trace-details-header__filter${
|
||||
isFilterExpanded ? ' trace-details-header__filter--expanded' : ''
|
||||
}`}
|
||||
>
|
||||
<Filters
|
||||
startTime={filterMetadata.startTime}
|
||||
endTime={filterMetadata.endTime}
|
||||
traceID={filterMetadata.traceId}
|
||||
onFilteredSpansChange={onFilteredSpansChange}
|
||||
isExpanded={isFilterExpanded}
|
||||
onExpand={(): void => setIsFilterExpanded(true)}
|
||||
onCollapse={(): void => setIsFilterExpanded(false)}
|
||||
/>
|
||||
</div>
|
||||
{!isFilterExpanded && (
|
||||
<>
|
||||
<Button
|
||||
variant="solid"
|
||||
color="secondary"
|
||||
size="sm"
|
||||
className="trace-details-header__old-view-btn"
|
||||
onClick={handleSwitchToOldView}
|
||||
>
|
||||
Old View
|
||||
</Button>
|
||||
<TraceOptionsMenu
|
||||
showTraceDetails={showTraceDetails}
|
||||
onToggleTraceDetails={handleToggleTraceDetails}
|
||||
onOpenPreviewFields={(): void => setIsPreviewFieldsOpen(true)}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{showTraceDetails && (
|
||||
<div className="trace-details-header__sub-header">
|
||||
{traceMetadata ? (
|
||||
<>
|
||||
<span className="trace-details-header__sub-item">
|
||||
<Server size={13} />
|
||||
{traceMetadata.rootServiceName}
|
||||
<span className="trace-details-header__separator">—</span>
|
||||
<span className="trace-details-header__entry-point-badge">
|
||||
{traceMetadata.rootServiceEntryPoint}
|
||||
</span>
|
||||
</span>
|
||||
<span className="trace-details-header__sub-item">
|
||||
<Timer size={13} />
|
||||
{parseFloat(formattedDuration.toFixed(2))} {timeUnitName}
|
||||
</span>
|
||||
<span className="trace-details-header__sub-item">
|
||||
<CalendarClock size={13} />
|
||||
{dayjs(traceMetadata.startTimestampMillis).format(
|
||||
DATE_TIME_FORMATS.DD_MMM_YYYY_HH_MM_SS,
|
||||
)}
|
||||
</span>
|
||||
{traceMetadata.rootSpanStatusCode && (
|
||||
<HttpStatusBadge statusCode={traceMetadata.rootSpanStatusCode} />
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<DetailsLoader />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isPreviewFieldsOpen && (
|
||||
<FloatingPanel
|
||||
isOpen
|
||||
width={350}
|
||||
height={window.innerHeight - 100}
|
||||
defaultPosition={{
|
||||
x: window.innerWidth - 350 - 100,
|
||||
y: 50,
|
||||
}}
|
||||
enableResizing={false}
|
||||
>
|
||||
<FieldsSettings
|
||||
title="Preview fields"
|
||||
fields={previewFields}
|
||||
onFieldsChange={setPreviewFields}
|
||||
onClose={(): void => setIsPreviewFieldsOpen(false)}
|
||||
dataSource={DataSource.TRACES}
|
||||
/>
|
||||
</FloatingPanel>
|
||||
</div>
|
||||
<Button
|
||||
variant="solid"
|
||||
color="secondary"
|
||||
size="sm"
|
||||
className="trace-details-header__old-view-btn"
|
||||
onClick={handleSwitchToOldView}
|
||||
>
|
||||
Old View
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
import { useMemo } from 'react';
|
||||
import type { MenuItem } from '@signozhq/ui/dropdown-menu';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { DropdownMenuSimple as Dropdown } from '@signozhq/ui/dropdown-menu';
|
||||
import { Ellipsis } from '@signozhq/icons';
|
||||
|
||||
import { useTraceContext } from '../contexts/TraceContext';
|
||||
|
||||
interface TraceOptionsMenuProps {
|
||||
showTraceDetails: boolean;
|
||||
onToggleTraceDetails: () => void;
|
||||
onOpenPreviewFields: () => void;
|
||||
}
|
||||
|
||||
function TraceOptionsMenu({
|
||||
showTraceDetails,
|
||||
onToggleTraceDetails,
|
||||
onOpenPreviewFields,
|
||||
}: TraceOptionsMenuProps): JSX.Element {
|
||||
const { colorByField, setColorByField, availableColorByOptions } =
|
||||
useTraceContext();
|
||||
|
||||
const menuItems: MenuItem[] = useMemo(() => {
|
||||
const items: MenuItem[] = [
|
||||
{
|
||||
key: 'toggle-trace-details',
|
||||
label: showTraceDetails ? 'Hide trace details' : 'Show trace details',
|
||||
onClick: onToggleTraceDetails,
|
||||
},
|
||||
{
|
||||
key: 'preview-fields',
|
||||
label: 'Preview fields',
|
||||
onClick: onOpenPreviewFields,
|
||||
},
|
||||
];
|
||||
|
||||
// Only show the "Colour by" submenu if there's an actual choice to make.
|
||||
if (availableColorByOptions.length > 1) {
|
||||
items.push({
|
||||
key: 'colour-by',
|
||||
label: 'Colour by',
|
||||
children: [
|
||||
{
|
||||
type: 'group',
|
||||
label: 'COLOUR BY',
|
||||
children: [
|
||||
{
|
||||
type: 'radio-group',
|
||||
value: colorByField.name,
|
||||
onChange: (name: string): void => {
|
||||
const next = availableColorByOptions.find(
|
||||
(o) => o.field.name === name,
|
||||
);
|
||||
if (next) {
|
||||
setColorByField(next.field);
|
||||
}
|
||||
},
|
||||
children: availableColorByOptions.map((opt) => ({
|
||||
type: 'radio',
|
||||
key: opt.field.name,
|
||||
label: opt.label,
|
||||
value: opt.field.name,
|
||||
})),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
return items;
|
||||
}, [
|
||||
showTraceDetails,
|
||||
onToggleTraceDetails,
|
||||
onOpenPreviewFields,
|
||||
colorByField.name,
|
||||
setColorByField,
|
||||
availableColorByOptions,
|
||||
]);
|
||||
|
||||
return (
|
||||
<Dropdown menu={{ items: menuItems }}>
|
||||
<Button
|
||||
variant="solid"
|
||||
color="secondary"
|
||||
size="sm"
|
||||
prefix={<Ellipsis size={14} />}
|
||||
/>
|
||||
</Dropdown>
|
||||
);
|
||||
}
|
||||
|
||||
export default TraceOptionsMenu;
|
||||
@@ -48,10 +48,6 @@
|
||||
color: var(--l2-foreground);
|
||||
}
|
||||
|
||||
&__collapse-count-errors {
|
||||
color: var(--destructive);
|
||||
}
|
||||
|
||||
&__flame-collapse {
|
||||
flex-shrink: 0;
|
||||
|
||||
|
||||
@@ -214,7 +214,6 @@ function FlamegraphCanvas(props: FlamegraphCanvasProps): JSX.Element {
|
||||
hasError={tooltipContent.status === 'error'}
|
||||
relativeStartMs={tooltipContent.startMs}
|
||||
durationMs={tooltipContent.durationMs}
|
||||
previewRows={tooltipContent.previewRows}
|
||||
/>
|
||||
)}
|
||||
</div>,
|
||||
|
||||
@@ -5,13 +5,7 @@ import useGetTraceFlamegraph from 'hooks/trace/useGetTraceFlamegraph';
|
||||
import useUrlQuery from 'hooks/useUrlQuery';
|
||||
import { TraceDetailFlamegraphURLProps } from 'types/api/trace/getTraceFlamegraph';
|
||||
|
||||
import { COLOR_BY_FIELDS } from '../constants';
|
||||
import { useTraceContext } from '../contexts/TraceContext';
|
||||
import Error from '../TraceWaterfall/TraceWaterfallStates/Error/Error';
|
||||
import {
|
||||
mergeTelemetryFieldKeys,
|
||||
toTelemetryFieldKey,
|
||||
} from '../utils/previewFields';
|
||||
import { FLAMEGRAPH_SPAN_LIMIT } from './constants';
|
||||
import FlamegraphCanvas from './FlamegraphCanvas';
|
||||
import { useVisualLayoutWorker } from './hooks/useVisualLayoutWorker';
|
||||
@@ -50,19 +44,6 @@ function TraceFlamegraph({
|
||||
[history, search],
|
||||
);
|
||||
|
||||
const { previewFields } = useTraceContext();
|
||||
|
||||
// Color-by fields baseline + user-picked preview fields. De-duped by `name`,
|
||||
// color-by entries first so their canonical metadata wins on collision.
|
||||
const flamegraphSelectFields = useMemo(
|
||||
() =>
|
||||
mergeTelemetryFieldKeys(
|
||||
COLOR_BY_FIELDS,
|
||||
previewFields.map(toTelemetryFieldKey),
|
||||
),
|
||||
[previewFields],
|
||||
);
|
||||
|
||||
const {
|
||||
data,
|
||||
isFetching,
|
||||
@@ -71,7 +52,6 @@ function TraceFlamegraph({
|
||||
traceId,
|
||||
// selectedSpanId: firstSpanAtFetchLevel,
|
||||
limit: FLAMEGRAPH_SPAN_LIMIT,
|
||||
selectFields: flamegraphSelectFields,
|
||||
});
|
||||
|
||||
const spans = useMemo(
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
import React from 'react';
|
||||
import type React from 'react';
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import { AllTheProviders } from 'tests/test-utils';
|
||||
|
||||
import { TraceProvider } from '../../contexts/TraceContext';
|
||||
import { useFlamegraphHover } from '../hooks/useFlamegraphHover';
|
||||
import type { SpanRect } from '../types';
|
||||
import { MOCK_SPAN, MOCK_TRACE_METADATA } from './testUtils';
|
||||
|
||||
function wrapper({ children }: { children: React.ReactNode }): JSX.Element {
|
||||
return (
|
||||
<AllTheProviders>
|
||||
<TraceProvider aggregations={undefined}>{children}</TraceProvider>
|
||||
</AllTheProviders>
|
||||
);
|
||||
}
|
||||
|
||||
function createMockCanvas(): HTMLCanvasElement {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 800;
|
||||
canvas.height = 400;
|
||||
jest.spyOn(canvas, 'getBoundingClientRect').mockImplementation(
|
||||
canvas.getBoundingClientRect = jest.fn(
|
||||
(): DOMRect =>
|
||||
({
|
||||
left: 0,
|
||||
@@ -69,9 +59,7 @@ describe('useFlamegraphHover', () => {
|
||||
});
|
||||
|
||||
it('sets hoveredSpanId and tooltipContent when hovering on span', () => {
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs), {
|
||||
wrapper,
|
||||
});
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs));
|
||||
|
||||
act(() => {
|
||||
result.current.handleHoverMouseMove({
|
||||
@@ -88,9 +76,7 @@ describe('useFlamegraphHover', () => {
|
||||
});
|
||||
|
||||
it('clears hover when moving to empty area', () => {
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs), {
|
||||
wrapper,
|
||||
});
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs));
|
||||
|
||||
act(() => {
|
||||
result.current.handleHoverMouseMove({
|
||||
@@ -113,9 +99,7 @@ describe('useFlamegraphHover', () => {
|
||||
});
|
||||
|
||||
it('clears hover on mouse leave', () => {
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs), {
|
||||
wrapper,
|
||||
});
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs));
|
||||
|
||||
act(() => {
|
||||
result.current.handleHoverMouseMove({
|
||||
@@ -133,9 +117,7 @@ describe('useFlamegraphHover', () => {
|
||||
});
|
||||
|
||||
it('suppresses click when drag distance exceeds threshold', () => {
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs), {
|
||||
wrapper,
|
||||
});
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs));
|
||||
|
||||
act(() => {
|
||||
result.current.handleMouseDownForClick({
|
||||
@@ -155,9 +137,7 @@ describe('useFlamegraphHover', () => {
|
||||
});
|
||||
|
||||
it('calls onSpanClick when clicking on span', () => {
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs), {
|
||||
wrapper,
|
||||
});
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs));
|
||||
|
||||
act(() => {
|
||||
result.current.handleClick({
|
||||
@@ -170,9 +150,7 @@ describe('useFlamegraphHover', () => {
|
||||
});
|
||||
|
||||
it('uses clientX/clientY for tooltip positioning', () => {
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs), {
|
||||
wrapper,
|
||||
});
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs));
|
||||
|
||||
act(() => {
|
||||
result.current.handleHoverMouseMove({
|
||||
@@ -186,9 +164,7 @@ describe('useFlamegraphHover', () => {
|
||||
});
|
||||
|
||||
it('does not update hover during drag', () => {
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs), {
|
||||
wrapper,
|
||||
});
|
||||
const { result } = renderHook(() => useFlamegraphHover(defaultArgs));
|
||||
defaultArgs.isDraggingRef.current = true;
|
||||
|
||||
act(() => {
|
||||
@@ -1,6 +1,4 @@
|
||||
import { TelemetryFieldKey } from 'types/api/v5/queryRange';
|
||||
|
||||
import { getFlamegraphSpanGroupValue, getSpanColor } from '../utils';
|
||||
import { getSpanColor } from '../utils';
|
||||
import { MOCK_SPAN } from './testUtils';
|
||||
|
||||
const mockGenerateColor = jest.fn();
|
||||
@@ -10,17 +8,6 @@ jest.mock('lib/uPlotLib/utils/generateColor', () => ({
|
||||
mockGenerateColor(key, colorMap),
|
||||
}));
|
||||
|
||||
const SERVICE_FIELD: TelemetryFieldKey = {
|
||||
name: 'service.name',
|
||||
fieldContext: 'resource',
|
||||
fieldDataType: 'string',
|
||||
};
|
||||
const HOST_FIELD: TelemetryFieldKey = {
|
||||
name: 'host.name',
|
||||
fieldContext: 'resource',
|
||||
fieldDataType: 'string',
|
||||
};
|
||||
|
||||
describe('Presentation / Styling Utils', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
@@ -28,17 +15,16 @@ describe('Presentation / Styling Utils', () => {
|
||||
});
|
||||
|
||||
describe('getSpanColor', () => {
|
||||
it('uses generated colour from groupValue for normal span', () => {
|
||||
it('uses generated service color for normal span', () => {
|
||||
mockGenerateColor.mockReturnValue('#1890ff');
|
||||
|
||||
const color = getSpanColor({
|
||||
span: { ...MOCK_SPAN, hasError: false },
|
||||
isDarkMode: false,
|
||||
groupValue: 'my-bucket',
|
||||
});
|
||||
|
||||
expect(mockGenerateColor).toHaveBeenCalledWith(
|
||||
'my-bucket',
|
||||
MOCK_SPAN.serviceName,
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(color).toBe('#1890ff');
|
||||
@@ -50,7 +36,6 @@ describe('Presentation / Styling Utils', () => {
|
||||
const color = getSpanColor({
|
||||
span: { ...MOCK_SPAN, hasError: true },
|
||||
isDarkMode: false,
|
||||
groupValue: 'my-bucket',
|
||||
});
|
||||
|
||||
expect(color).toBe('rgb(220, 38, 38)');
|
||||
@@ -62,50 +47,21 @@ describe('Presentation / Styling Utils', () => {
|
||||
const color = getSpanColor({
|
||||
span: { ...MOCK_SPAN, hasError: true },
|
||||
isDarkMode: true,
|
||||
groupValue: 'my-bucket',
|
||||
});
|
||||
|
||||
expect(color).toBe('rgb(239, 68, 68)');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getFlamegraphSpanGroupValue', () => {
|
||||
it('returns resource[field.name] when present', () => {
|
||||
const value = getFlamegraphSpanGroupValue(
|
||||
{
|
||||
serviceName: 'legacy',
|
||||
resource: { 'service.name': 'svc-from-resource' },
|
||||
},
|
||||
SERVICE_FIELD,
|
||||
);
|
||||
expect(value).toBe('svc-from-resource');
|
||||
});
|
||||
it('passes serviceName to generateColor', () => {
|
||||
getSpanColor({
|
||||
span: { ...MOCK_SPAN, serviceName: 'my-service' },
|
||||
isDarkMode: false,
|
||||
});
|
||||
|
||||
it('falls back to top-level serviceName for service.name when resource is empty', () => {
|
||||
const value = getFlamegraphSpanGroupValue(
|
||||
{ serviceName: 'svc-legacy', resource: {} },
|
||||
SERVICE_FIELD,
|
||||
expect(mockGenerateColor).toHaveBeenCalledWith(
|
||||
'my-service',
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(value).toBe('svc-legacy');
|
||||
});
|
||||
|
||||
it('returns "unknown" for non-service fields when resource is missing', () => {
|
||||
const value = getFlamegraphSpanGroupValue(
|
||||
{ serviceName: 'svc', resource: {} },
|
||||
HOST_FIELD,
|
||||
);
|
||||
expect(value).toBe('unknown');
|
||||
});
|
||||
|
||||
it('reads host.name from resource when present', () => {
|
||||
const value = getFlamegraphSpanGroupValue(
|
||||
{
|
||||
serviceName: 'svc',
|
||||
resource: { 'host.name': 'host-1' },
|
||||
},
|
||||
HOST_FIELD,
|
||||
);
|
||||
expect(value).toBe('host-1');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,9 +6,6 @@ export interface ConnectorLine {
|
||||
childRow: number;
|
||||
timestampMs: number;
|
||||
serviceName: string;
|
||||
// Snapshot of the child span's resource so draw-time can resolve the
|
||||
// `colorByField` group value without crossing the worker boundary.
|
||||
resource?: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface VisualLayout {
|
||||
@@ -360,7 +357,6 @@ export function computeVisualLayout(spans: FlamegraphSpan[][]): VisualLayout {
|
||||
childRow,
|
||||
timestampMs: child.timestamp,
|
||||
serviceName: child.serviceName,
|
||||
resource: child.resource,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import React, { RefObject, useCallback, useMemo, useRef } from 'react';
|
||||
import { themeColors } from 'constants/theme';
|
||||
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
|
||||
import { useTraceContext } from 'pages/TraceDetailsV3/contexts/TraceContext';
|
||||
import { FlamegraphSpan } from 'types/api/trace/getTraceFlamegraph';
|
||||
import { TelemetryFieldKey } from 'types/api/v5/queryRange';
|
||||
|
||||
import { ConnectorLine } from '../computeVisualLayout';
|
||||
import { EventRect, SpanRect } from '../types';
|
||||
@@ -12,7 +10,6 @@ import {
|
||||
drawSpanBar,
|
||||
FlamegraphRowMetrics,
|
||||
getFlamegraphRowMetrics,
|
||||
getFlamegraphSpanGroupValue,
|
||||
getSpanColor,
|
||||
} from '../utils';
|
||||
|
||||
@@ -54,7 +51,6 @@ interface DrawLevelArgs {
|
||||
selectedSpanId: string | undefined;
|
||||
hoveredSpanId: string;
|
||||
isDarkMode: boolean;
|
||||
colorByField: TelemetryFieldKey;
|
||||
spanRectsArray: SpanRect[];
|
||||
eventRectsArray: EventRect[];
|
||||
metrics: FlamegraphRowMetrics;
|
||||
@@ -75,7 +71,6 @@ function drawLevel(args: DrawLevelArgs): void {
|
||||
selectedSpanId,
|
||||
hoveredSpanId,
|
||||
isDarkMode,
|
||||
colorByField,
|
||||
spanRectsArray,
|
||||
eventRectsArray,
|
||||
metrics,
|
||||
@@ -117,8 +112,7 @@ function drawLevel(args: DrawLevelArgs): void {
|
||||
// Minimum 1px width so tiny spans remain visible
|
||||
width = clamp(width, 1, Infinity);
|
||||
|
||||
const groupValue = getFlamegraphSpanGroupValue(span, colorByField);
|
||||
const color = getSpanColor({ span, isDarkMode, groupValue });
|
||||
const color = getSpanColor({ span, isDarkMode });
|
||||
|
||||
const isDimmedByFilter =
|
||||
!!isFilterActiveInLevel &&
|
||||
@@ -154,7 +148,6 @@ interface DrawConnectorLinesArgs {
|
||||
cssWidth: number;
|
||||
viewportHeight: number;
|
||||
metrics: FlamegraphRowMetrics;
|
||||
colorByField: TelemetryFieldKey;
|
||||
}
|
||||
|
||||
function drawConnectorLines(args: DrawConnectorLinesArgs): void {
|
||||
@@ -167,7 +160,6 @@ function drawConnectorLines(args: DrawConnectorLinesArgs): void {
|
||||
cssWidth,
|
||||
viewportHeight,
|
||||
metrics,
|
||||
colorByField,
|
||||
} = args;
|
||||
|
||||
ctx.save();
|
||||
@@ -193,11 +185,10 @@ function drawConnectorLines(args: DrawConnectorLinesArgs): void {
|
||||
continue;
|
||||
}
|
||||
|
||||
const groupValue = getFlamegraphSpanGroupValue(
|
||||
{ serviceName: conn.serviceName, resource: conn.resource },
|
||||
colorByField,
|
||||
const color = generateColor(
|
||||
conn.serviceName,
|
||||
themeColors.traceDetailColorsV3,
|
||||
);
|
||||
const color = generateColor(groupValue, themeColors.traceDetailColorsV3);
|
||||
ctx.strokeStyle = color;
|
||||
|
||||
const x = clamp(xFrac * cssWidth, 0, cssWidth);
|
||||
@@ -237,10 +228,11 @@ export function useFlamegraphDraw(
|
||||
const eventRectsRefInternal = useRef<EventRect[]>([]);
|
||||
const eventRectsRef = eventRectsRefProp ?? eventRectsRefInternal;
|
||||
|
||||
const { colorByField } = useTraceContext();
|
||||
|
||||
const filteredSpanIdsSet = useMemo(
|
||||
() => (isFilterActive && filteredSpanIds ? new Set(filteredSpanIds) : null),
|
||||
() =>
|
||||
isFilterActive && filteredSpanIds && filteredSpanIds.length > 0
|
||||
? new Set(filteredSpanIds)
|
||||
: null,
|
||||
[filteredSpanIds, isFilterActive],
|
||||
);
|
||||
|
||||
@@ -293,7 +285,6 @@ export function useFlamegraphDraw(
|
||||
cssWidth,
|
||||
viewportHeight,
|
||||
metrics,
|
||||
colorByField,
|
||||
});
|
||||
|
||||
const spanRectsArray: SpanRect[] = [];
|
||||
@@ -318,7 +309,6 @@ export function useFlamegraphDraw(
|
||||
selectedSpanId,
|
||||
hoveredSpanId,
|
||||
isDarkMode,
|
||||
colorByField,
|
||||
spanRectsArray,
|
||||
eventRectsArray,
|
||||
metrics,
|
||||
@@ -345,7 +335,6 @@ export function useFlamegraphDraw(
|
||||
hoveredSpanId,
|
||||
hoveredEventKey,
|
||||
isDarkMode,
|
||||
colorByField,
|
||||
filteredSpanIdsSet,
|
||||
isFilterActive,
|
||||
]);
|
||||
|
||||
@@ -8,18 +8,11 @@ import {
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { useTraceContext } from 'pages/TraceDetailsV3/contexts/TraceContext';
|
||||
import { RESERVED_PREVIEW_KEYS } from 'pages/TraceDetailsV3/SpanHoverCard/SpanHoverCard';
|
||||
import { getSpanAttribute } from 'pages/TraceDetailsV3/utils';
|
||||
import { FlamegraphSpan } from 'types/api/trace/getTraceFlamegraph';
|
||||
|
||||
import { EventRect, SpanRect } from '../types';
|
||||
import { ITraceMetadata } from '../types';
|
||||
import {
|
||||
getFlamegraphServiceName,
|
||||
getFlamegraphSpanGroupValue,
|
||||
getSpanColor,
|
||||
} from '../utils';
|
||||
import { getSpanColor } from '../utils';
|
||||
|
||||
function getCanvasPointer(
|
||||
canvas: HTMLCanvasElement,
|
||||
@@ -76,11 +69,6 @@ export interface EventTooltipData {
|
||||
attributeMap: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface SpanPreviewRowData {
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface TooltipContent {
|
||||
serviceName: string;
|
||||
spanName: string;
|
||||
@@ -90,7 +78,6 @@ export interface TooltipContent {
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
spanColor: string;
|
||||
previewRows?: SpanPreviewRowData[];
|
||||
event?: EventTooltipData;
|
||||
}
|
||||
|
||||
@@ -138,25 +125,6 @@ export function useFlamegraphHover(
|
||||
null,
|
||||
);
|
||||
|
||||
const { colorByField, previewFields } = useTraceContext();
|
||||
|
||||
const buildPreviewRows = useCallback(
|
||||
(span: FlamegraphSpan): SpanPreviewRowData[] =>
|
||||
previewFields
|
||||
.filter((field) => !RESERVED_PREVIEW_KEYS.has(field.key))
|
||||
.map((field) => {
|
||||
const value = getSpanAttribute(
|
||||
{ resource: span.resource, attributes: span.attributes },
|
||||
field.key,
|
||||
);
|
||||
return value !== undefined && value !== ''
|
||||
? { key: field.key, value: String(value) }
|
||||
: null;
|
||||
})
|
||||
.filter((r): r is SpanPreviewRowData => r !== null),
|
||||
[previewFields],
|
||||
);
|
||||
|
||||
const isZoomed =
|
||||
viewStartTs !== traceMetadata.startTime ||
|
||||
viewEndTs !== traceMetadata.endTime;
|
||||
@@ -203,18 +171,14 @@ export function useFlamegraphHover(
|
||||
setHoveredEventKey(`${span.spanId}-${event.name}-${event.timeUnixNano}`);
|
||||
setHoveredSpanId(span.spanId);
|
||||
setTooltipContent({
|
||||
serviceName: getFlamegraphServiceName(span),
|
||||
serviceName: span.serviceName || '',
|
||||
spanName: span.name || 'unknown',
|
||||
status: span.hasError ? 'error' : 'ok',
|
||||
startMs: span.timestamp - traceMetadata.startTime,
|
||||
durationMs: span.durationNano / 1e6,
|
||||
clientX: e.clientX,
|
||||
clientY: e.clientY,
|
||||
spanColor: getSpanColor({
|
||||
span,
|
||||
isDarkMode,
|
||||
groupValue: getFlamegraphSpanGroupValue(span, colorByField),
|
||||
}),
|
||||
spanColor: getSpanColor({ span, isDarkMode }),
|
||||
event: {
|
||||
name: event.name,
|
||||
timeOffsetMs: eventTimeMs - span.timestamp,
|
||||
@@ -236,19 +200,14 @@ export function useFlamegraphHover(
|
||||
setHoveredEventKey(null);
|
||||
setHoveredSpanId(span.spanId);
|
||||
setTooltipContent({
|
||||
serviceName: getFlamegraphServiceName(span),
|
||||
serviceName: span.serviceName || '',
|
||||
spanName: span.name || 'unknown',
|
||||
status: span.hasError ? 'error' : 'ok',
|
||||
startMs: span.timestamp - traceMetadata.startTime,
|
||||
durationMs: span.durationNano / 1e6,
|
||||
clientX: e.clientX,
|
||||
clientY: e.clientY,
|
||||
spanColor: getSpanColor({
|
||||
span,
|
||||
isDarkMode,
|
||||
groupValue: getFlamegraphSpanGroupValue(span, colorByField),
|
||||
}),
|
||||
previewRows: buildPreviewRows(span),
|
||||
spanColor: getSpanColor({ span, isDarkMode }),
|
||||
});
|
||||
updateCursor(canvas, span);
|
||||
} else {
|
||||
@@ -266,8 +225,6 @@ export function useFlamegraphHover(
|
||||
isDraggingRef,
|
||||
updateCursor,
|
||||
isDarkMode,
|
||||
colorByField,
|
||||
buildPreviewRows,
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
import { themeColors } from 'constants/theme';
|
||||
import { convertTimeToRelevantUnit } from 'container/TraceDetail/utils';
|
||||
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
|
||||
import { getSpanAttribute } from 'pages/TraceDetailsV3/utils';
|
||||
import { FlamegraphSpan } from 'types/api/trace/getTraceFlamegraph';
|
||||
import { TelemetryFieldKey } from 'types/api/v5/queryRange';
|
||||
|
||||
import {
|
||||
DASHED_BORDER_LINE_DASH,
|
||||
@@ -68,47 +66,14 @@ export function getFlamegraphRowMetrics(
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the displayed service.name for a flamegraph span. Used by tooltips
|
||||
* (service identity, independent of the active colour-by field). Prefers
|
||||
* `resource['service.name']` with legacy top-level `serviceName` fallback.
|
||||
*/
|
||||
export function getFlamegraphServiceName(
|
||||
span: Pick<FlamegraphSpan, 'serviceName' | 'resource' | 'attributes'>,
|
||||
): string {
|
||||
return getSpanAttribute(span, 'service.name') || span.serviceName || '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the value used to bucket a flamegraph span by colour for the given
|
||||
* field. Prefers `resource[field.name]` (new contract from `selectFields`).
|
||||
* For `service.name`, falls back to the legacy top-level `serviceName` when
|
||||
* resource is empty (backward-compat with backends that haven't shipped
|
||||
* `selectFields` yet). For other fields, falls back to `'unknown'`.
|
||||
*/
|
||||
export function getFlamegraphSpanGroupValue(
|
||||
span: Pick<FlamegraphSpan, 'serviceName' | 'resource' | 'attributes'>,
|
||||
field: TelemetryFieldKey,
|
||||
): string {
|
||||
const fromAttribute = getSpanAttribute(span, field.name);
|
||||
if (fromAttribute) {
|
||||
return fromAttribute;
|
||||
}
|
||||
if (field.name === 'service.name') {
|
||||
return span.serviceName || 'unknown';
|
||||
}
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
interface GetSpanColorArgs {
|
||||
span: FlamegraphSpan;
|
||||
isDarkMode: boolean;
|
||||
groupValue: string;
|
||||
}
|
||||
|
||||
export function getSpanColor(args: GetSpanColorArgs): string {
|
||||
const { span, isDarkMode, groupValue } = args;
|
||||
let color = generateColor(groupValue, themeColors.traceDetailColorsV3);
|
||||
const { span, isDarkMode } = args;
|
||||
let color = generateColor(span.serviceName, themeColors.traceDetailColorsV3);
|
||||
|
||||
if (span.hasError) {
|
||||
color = isDarkMode ? 'rgb(239, 68, 68)' : 'rgb(220, 38, 38)';
|
||||
@@ -246,7 +211,7 @@ export function drawSpanBar(args: DrawSpanBarArgs): void {
|
||||
// Alpha is applied to bar + events only; label is drawn after restoring alpha to 1
|
||||
// so text stays readable against the faded bar.
|
||||
if (shouldDim) {
|
||||
ctx.globalAlpha = 0.15;
|
||||
ctx.globalAlpha = 0.4;
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
|
||||
@@ -11,10 +11,14 @@ import NoData from './TraceWaterfallStates/NoData/NoData';
|
||||
import Success from './TraceWaterfallStates/Success/Success';
|
||||
import { getVisibleSpans } from './utils';
|
||||
|
||||
import { IInterestedSpan } from './types';
|
||||
|
||||
import './TraceWaterfall.styles.scss';
|
||||
|
||||
export interface IInterestedSpan {
|
||||
spanId: string;
|
||||
isUncollapsed: boolean;
|
||||
scrollToSpan?: boolean;
|
||||
}
|
||||
|
||||
interface ITraceWaterfallProps {
|
||||
traceId: string;
|
||||
uncollapsedNodes: string[];
|
||||
|
||||
@@ -3,114 +3,18 @@
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
|
||||
&.expanded {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.filter-search-container {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.query-builder-search-v2 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// --- Collapsed pill ---
|
||||
.filter-pill {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 10px;
|
||||
border: 1px solid var(--l1-border);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
max-width: 220px;
|
||||
min-width: 120px;
|
||||
height: 32px;
|
||||
background: var(--l1-background);
|
||||
|
||||
&:hover {
|
||||
border-color: var(--l3-border);
|
||||
}
|
||||
|
||||
&__text {
|
||||
font-size: 12px;
|
||||
color: var(--l2-foreground);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__indicator {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--primary-background);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Collapsed pill popover ---
|
||||
.filter-pill-popover {
|
||||
max-width: 400px;
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&__expression {
|
||||
font-family: 'Geist Mono', 'Fira Code', monospace;
|
||||
font-size: 12px;
|
||||
color: var(--l1-foreground);
|
||||
word-break: break-all;
|
||||
padding: 6px 8px;
|
||||
background: var(--l2-background);
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
// --- ToggleGroup override: size to content, don't stretch items ---
|
||||
[class*='toggle-group'] {
|
||||
flex-shrink: 0;
|
||||
|
||||
[class*='toggle-group-item'] {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Collapse button ---
|
||||
.filter-collapse-btn {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
// --- Highlight errors toggle ---
|
||||
.highlight-errors-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
// --- Prev/next navigation ---
|
||||
.pre-next-toggle {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
gap: 12px;
|
||||
|
||||
&__count {
|
||||
.ant-typography {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: auto;
|
||||
color: var(--l2-foreground);
|
||||
font-family: 'Geist Mono';
|
||||
font-size: 12px;
|
||||
@@ -126,20 +30,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
.filter-status {
|
||||
.no-results {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-shrink: 0;
|
||||
color: var(--l2-foreground);
|
||||
font-family: 'Geist Mono';
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 18px;
|
||||
|
||||
&--error {
|
||||
color: var(--destructive);
|
||||
cursor: help;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,19 @@
|
||||
import { useCallback, useRef, useState } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
import { useCopyToClipboard } from 'react-use';
|
||||
import {
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
Copy,
|
||||
Info,
|
||||
Loader,
|
||||
Search,
|
||||
X,
|
||||
} from '@signozhq/icons';
|
||||
import { Switch } from '@signozhq/ui/switch';
|
||||
import { ToggleGroup, ToggleGroupItem } from '@signozhq/ui/toggle-group';
|
||||
import { toast } from '@signozhq/ui/sonner';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from '@signozhq/ui/tooltip';
|
||||
import { Button, Spin, Tooltip } from 'antd';
|
||||
import { Typography } from '@signozhq/ui/typography';
|
||||
import { AxiosError } from 'axios';
|
||||
import QuerySearch from 'components/QueryBuilderV2/QueryV2/QuerySearch/QuerySearch';
|
||||
import { convertExpressionToFilters } from 'components/QueryBuilderV2/utils';
|
||||
import { DEFAULT_ENTITY_VERSION } from 'constants/app';
|
||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import QueryBuilderSearchV2 from 'container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2';
|
||||
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
|
||||
import { uniqBy } from 'lodash-es';
|
||||
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
import { Query, TagFilter } from 'types/api/queryBuilder/queryBuilderData';
|
||||
import {
|
||||
DataSource,
|
||||
TracesAggregatorOperator,
|
||||
} from 'types/common/queryBuilder';
|
||||
import { TracesAggregatorOperator } from 'types/common/queryBuilder';
|
||||
import { LoaderCircle, Info, ChevronDown, ChevronUp } from '@signozhq/icons';
|
||||
|
||||
import { BASE_FILTER_QUERY } from './constants';
|
||||
import { useHighlightErrors } from './hooks/useHighlightErrors';
|
||||
import {
|
||||
SpanCategory,
|
||||
useSpanCategoryFilter,
|
||||
} from './hooks/useSpanCategoryFilter';
|
||||
|
||||
import './Filters.styles.scss';
|
||||
|
||||
@@ -71,7 +44,6 @@ function prepareQuery(filters: TagFilter, traceID: string): Query {
|
||||
},
|
||||
],
|
||||
},
|
||||
selectColumns: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -83,87 +55,31 @@ function Filters({
|
||||
endTime,
|
||||
traceID,
|
||||
onFilteredSpansChange = (): void => {},
|
||||
isExpanded,
|
||||
onExpand,
|
||||
onCollapse,
|
||||
}: {
|
||||
startTime: number;
|
||||
endTime: number;
|
||||
traceID: string;
|
||||
onFilteredSpansChange?: (spanIds: string[], isFilterActive: boolean) => void;
|
||||
isExpanded: boolean;
|
||||
onExpand: () => void;
|
||||
onCollapse: () => void;
|
||||
}): JSX.Element {
|
||||
const [, setCopy] = useCopyToClipboard();
|
||||
const [filters, setFilters] = useState<TagFilter>(
|
||||
BASE_FILTER_QUERY.filters || { items: [], op: 'AND' },
|
||||
);
|
||||
const [expression, setExpression] = useState<string>('');
|
||||
const [noData, setNoData] = useState<boolean>(false);
|
||||
const [filteredSpanIds, setFilteredSpanIds] = useState<string[]>([]);
|
||||
const [currentSearchedIndex, setCurrentSearchedIndex] = useState<number>(0);
|
||||
const expressionRef = useRef<string>('');
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const runQuery = useCallback(
|
||||
(value: string): void => {
|
||||
const items = convertExpressionToFilters(value);
|
||||
setFilters({ items, op: 'AND' });
|
||||
// Clear results when expression produces no filters
|
||||
if (items.length === 0) {
|
||||
const handleFilterChange = useCallback(
|
||||
(value: TagFilter): void => {
|
||||
if (value.items.length === 0) {
|
||||
setFilteredSpanIds([]);
|
||||
onFilteredSpansChange?.([], false);
|
||||
setCurrentSearchedIndex(0);
|
||||
setNoData(false);
|
||||
}
|
||||
setFilters(value);
|
||||
},
|
||||
[onFilteredSpansChange],
|
||||
);
|
||||
|
||||
// onChange fires on every keystroke — only store the expression, don't trigger API
|
||||
const handleExpressionChange = useCallback(
|
||||
(value: string): void => {
|
||||
setExpression(value);
|
||||
expressionRef.current = value;
|
||||
// Clear results when expression is emptied
|
||||
if (!value.trim()) {
|
||||
setFilters({ items: [], op: 'AND' });
|
||||
setFilteredSpanIds([]);
|
||||
onFilteredSpansChange?.([], false);
|
||||
setCurrentSearchedIndex(0);
|
||||
setNoData(false);
|
||||
}
|
||||
},
|
||||
[onFilteredSpansChange],
|
||||
);
|
||||
|
||||
// onRun fires on Ctrl+Enter
|
||||
const handleRunQuery = useCallback(
|
||||
(value: string): void => {
|
||||
runQuery(value);
|
||||
},
|
||||
[runQuery],
|
||||
);
|
||||
|
||||
// Run query on blur (click outside the filter input)
|
||||
const handleBlur = useCallback((): void => {
|
||||
runQuery(expressionRef.current);
|
||||
}, [runQuery]);
|
||||
|
||||
// Expression-based filter hooks
|
||||
const filterProps = {
|
||||
expression,
|
||||
filters,
|
||||
setExpression,
|
||||
expressionRef,
|
||||
runQuery,
|
||||
};
|
||||
const { isHighlightErrors, handleToggle: handleToggleHighlightErrors } =
|
||||
useHighlightErrors(filterProps);
|
||||
const { selectedCategory, categories, handleCategoryChange } =
|
||||
useSpanCategoryFilter(filterProps);
|
||||
|
||||
const { search } = useLocation();
|
||||
const history = useHistory();
|
||||
|
||||
@@ -194,14 +110,14 @@ function Filters({
|
||||
tableParams: {
|
||||
pagination: {
|
||||
offset: 0,
|
||||
limit: 10000,
|
||||
limit: 200,
|
||||
},
|
||||
selectColumns: [
|
||||
{
|
||||
key: 'spanID',
|
||||
key: 'name',
|
||||
dataType: 'string',
|
||||
type: 'tag',
|
||||
id: 'spanId--string--tag--true',
|
||||
id: 'name--string--tag--true',
|
||||
isIndexed: false,
|
||||
},
|
||||
],
|
||||
@@ -231,187 +147,58 @@ function Filters({
|
||||
setCurrentSearchedIndex(0);
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
const isFilterActive = filters.items.length > 0;
|
||||
setNoData(false);
|
||||
setFilteredSpanIds([]);
|
||||
onFilteredSpansChange?.([], isFilterActive);
|
||||
setCurrentSearchedIndex(0);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const highlightErrorsToggle = (
|
||||
<div className="highlight-errors-toggle">
|
||||
<Typography.Text>Highlight errors</Typography.Text>
|
||||
<Switch
|
||||
color="cherry"
|
||||
value={isHighlightErrors}
|
||||
onChange={handleToggleHighlightErrors}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
const statusIndicators = (
|
||||
<>
|
||||
{isFetching && <Loader className="animate-spin" />}
|
||||
{error && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="filter-status filter-status--error">
|
||||
<Info />
|
||||
API error
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
{(error as AxiosError)?.message || 'Something went wrong'}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
{!error && noData && (
|
||||
<Typography.Text className="filter-status">
|
||||
No results found
|
||||
</Typography.Text>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
// --- COLLAPSED VIEW ---
|
||||
if (!isExpanded) {
|
||||
const pill = (
|
||||
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
|
||||
<div className="filter-pill" onClick={onExpand}>
|
||||
<Search size={12} />
|
||||
<span className="filter-pill__text">{expression || 'Search...'}</span>
|
||||
{expression && <span className="filter-pill__indicator" />}
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<div className="trace-v3-filter-row collapsed">
|
||||
{expression ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>{pill}</TooltipTrigger>
|
||||
<TooltipContent side="bottom" align="start">
|
||||
<div className="filter-pill-popover">
|
||||
<div className="filter-pill-popover__header">
|
||||
<Typography.Text>Search query</Typography.Text>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
color="secondary"
|
||||
onClick={(): void => {
|
||||
setCopy(expression);
|
||||
toast.success('Copied to clipboard', {
|
||||
richColors: false,
|
||||
position: 'top-right',
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Copy size={12} />
|
||||
</Button>
|
||||
</div>
|
||||
<div className="filter-pill-popover__expression">{expression}</div>
|
||||
</div>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
) : (
|
||||
pill
|
||||
)}
|
||||
{highlightErrorsToggle}
|
||||
{statusIndicators}
|
||||
</div>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
|
||||
// --- EXPANDED VIEW ---
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<div className="trace-v3-filter-row expanded">
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
value={selectedCategory}
|
||||
onChange={(value): void => {
|
||||
if (value) {
|
||||
handleCategoryChange(value as SpanCategory);
|
||||
}
|
||||
}}
|
||||
size="sm"
|
||||
>
|
||||
{categories.map((category) => (
|
||||
<ToggleGroupItem key={category} value={category}>
|
||||
{category}
|
||||
</ToggleGroupItem>
|
||||
))}
|
||||
</ToggleGroup>
|
||||
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
|
||||
<div
|
||||
className="filter-search-container"
|
||||
ref={containerRef}
|
||||
onBlur={(e): void => {
|
||||
if (!containerRef.current?.contains(e.relatedTarget as Node)) {
|
||||
handleBlur();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<QuerySearch
|
||||
queryData={{
|
||||
...BASE_FILTER_QUERY,
|
||||
filters,
|
||||
filter: { expression },
|
||||
<div className="trace-v3-filter-row">
|
||||
<QueryBuilderSearchV2
|
||||
query={{
|
||||
...BASE_FILTER_QUERY,
|
||||
filters,
|
||||
}}
|
||||
onChange={handleFilterChange}
|
||||
hideSpanScopeSelector={false}
|
||||
skipQueryBuilderRedirect
|
||||
selectProps={{ listHeight: 125 }}
|
||||
/>
|
||||
{filteredSpanIds.length > 0 && (
|
||||
<div className="pre-next-toggle">
|
||||
<Typography.Text>
|
||||
{currentSearchedIndex + 1} / {filteredSpanIds.length}
|
||||
</Typography.Text>
|
||||
<Button
|
||||
icon={<ChevronUp size={14} />}
|
||||
disabled={currentSearchedIndex === 0}
|
||||
type="text"
|
||||
onClick={(): void => {
|
||||
handlePrevNext(currentSearchedIndex - 1);
|
||||
setCurrentSearchedIndex((prev) => prev - 1);
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
icon={<ChevronDown size={14} />}
|
||||
type="text"
|
||||
disabled={currentSearchedIndex === filteredSpanIds.length - 1}
|
||||
onClick={(): void => {
|
||||
handlePrevNext(currentSearchedIndex + 1);
|
||||
setCurrentSearchedIndex((prev) => prev + 1);
|
||||
}}
|
||||
onChange={handleExpressionChange}
|
||||
onRun={handleRunQuery}
|
||||
dataSource={DataSource.TRACES}
|
||||
placeholder="Enter your filter query (e.g., http.status_code >= 500 AND service.name = 'frontend')"
|
||||
/>
|
||||
</div>
|
||||
{filteredSpanIds.length > 0 && (
|
||||
<div className="pre-next-toggle">
|
||||
<Typography.Text className="pre-next-toggle__count">
|
||||
{currentSearchedIndex + 1} / {filteredSpanIds.length}
|
||||
</Typography.Text>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
color="secondary"
|
||||
disabled={currentSearchedIndex === 0}
|
||||
onClick={(): void => {
|
||||
handlePrevNext(currentSearchedIndex - 1);
|
||||
setCurrentSearchedIndex((prev) => prev - 1);
|
||||
}}
|
||||
>
|
||||
<ChevronUp size={14} />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
color="secondary"
|
||||
disabled={currentSearchedIndex === filteredSpanIds.length - 1}
|
||||
onClick={(): void => {
|
||||
handlePrevNext(currentSearchedIndex + 1);
|
||||
setCurrentSearchedIndex((prev) => prev + 1);
|
||||
}}
|
||||
>
|
||||
<ChevronDown size={14} />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
color="secondary"
|
||||
className="filter-collapse-btn"
|
||||
onClick={onCollapse}
|
||||
>
|
||||
<X size={14} />
|
||||
</Button>
|
||||
{highlightErrorsToggle}
|
||||
{statusIndicators}
|
||||
</div>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
{isFetching && (
|
||||
<Spin indicator={<LoaderCircle className="animate-spin" />} size="small" />
|
||||
)}
|
||||
{error && (
|
||||
<Tooltip title={(error as AxiosError)?.message || 'Something went wrong'}>
|
||||
<Info size={14} />
|
||||
</Tooltip>
|
||||
)}
|
||||
{noData && (
|
||||
<Typography.Text className="no-results">No results found</Typography.Text>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { MutableRefObject } from 'react';
|
||||
import { TagFilter } from 'types/api/queryBuilder/queryBuilderData';
|
||||
|
||||
/**
|
||||
* Shared props for expression-based filter hooks.
|
||||
* Each hook reads the current expression + derived filters,
|
||||
* and manipulates the expression via remove/add pattern.
|
||||
*/
|
||||
export interface ExpressionFilterProps {
|
||||
expression: string;
|
||||
filters: TagFilter;
|
||||
setExpression: (expr: string) => void;
|
||||
expressionRef: MutableRefObject<string>;
|
||||
runQuery: (expr: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper: update expression state, ref, and trigger query.
|
||||
*/
|
||||
export function applyExpression(
|
||||
newExpression: string,
|
||||
props: Pick<
|
||||
ExpressionFilterProps,
|
||||
'setExpression' | 'expressionRef' | 'runQuery'
|
||||
>,
|
||||
): void {
|
||||
props.setExpression(newExpression);
|
||||
props.expressionRef.current = newExpression;
|
||||
props.runQuery(newExpression);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { removeKeysFromExpression } from 'components/QueryBuilderV2/utils';
|
||||
|
||||
import { applyExpression, ExpressionFilterProps } from './types';
|
||||
|
||||
interface UseHighlightErrorsReturn {
|
||||
isHighlightErrors: boolean;
|
||||
handleToggle: (checked: boolean) => void;
|
||||
}
|
||||
|
||||
const ERROR_KEY = 'has_error';
|
||||
|
||||
export function useHighlightErrors(
|
||||
props: ExpressionFilterProps,
|
||||
): UseHighlightErrorsReturn {
|
||||
const { expression, filters, setExpression, expressionRef, runQuery } = props;
|
||||
|
||||
// Derive from filters (only updates after runQuery, not on every keystroke)
|
||||
const isHighlightErrors = useMemo(
|
||||
() =>
|
||||
filters.items.some(
|
||||
(item) =>
|
||||
item.key?.key === ERROR_KEY &&
|
||||
(item.value === true || item.value === 'true'),
|
||||
),
|
||||
[filters],
|
||||
);
|
||||
|
||||
const handleToggle = useCallback(
|
||||
(checked: boolean): void => {
|
||||
// Always remove existing has_error first (whatever its value)
|
||||
let newExpr = removeKeysFromExpression(expression, [ERROR_KEY]);
|
||||
// Add back if turning ON
|
||||
if (checked) {
|
||||
newExpr = newExpr.trim()
|
||||
? `${newExpr.trim()} AND has_error = true`
|
||||
: `has_error = true`;
|
||||
}
|
||||
applyExpression(newExpr, { setExpression, expressionRef, runQuery });
|
||||
},
|
||||
[expression, setExpression, expressionRef, runQuery],
|
||||
);
|
||||
|
||||
return { isHighlightErrors, handleToggle };
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { removeKeysFromExpression } from 'components/QueryBuilderV2/utils';
|
||||
|
||||
import { applyExpression, ExpressionFilterProps } from './types';
|
||||
|
||||
export type SpanCategory =
|
||||
| 'All'
|
||||
| 'Database'
|
||||
| 'Functions'
|
||||
| 'HTTP'
|
||||
| 'Jobs'
|
||||
| 'LLM';
|
||||
|
||||
export const SPAN_CATEGORIES: readonly SpanCategory[] = [
|
||||
'All',
|
||||
'Database',
|
||||
'Functions',
|
||||
'HTTP',
|
||||
'Jobs',
|
||||
'LLM',
|
||||
];
|
||||
|
||||
// Map each category to the attribute key it filters on
|
||||
const CATEGORY_KEYS: Record<Exclude<SpanCategory, 'All'>, string> = {
|
||||
Database: 'db.system',
|
||||
HTTP: 'http.method',
|
||||
Functions: 'kind_string',
|
||||
Jobs: 'messaging.system',
|
||||
LLM: 'gen_ai.request.model',
|
||||
};
|
||||
|
||||
// All category keys — used for bulk removal when switching categories
|
||||
const ALL_CATEGORY_KEYS = Object.values(CATEGORY_KEYS);
|
||||
|
||||
// The expression clause to add for each category
|
||||
const CATEGORY_EXPRESSIONS: Record<Exclude<SpanCategory, 'All'>, string> = {
|
||||
Database: 'db.system exists',
|
||||
HTTP: 'http.method exists',
|
||||
Functions: "kind_string = 'Internal'",
|
||||
Jobs: 'messaging.system exists',
|
||||
LLM: 'gen_ai.request.model exists',
|
||||
};
|
||||
|
||||
interface UseSpanCategoryFilterReturn {
|
||||
selectedCategory: SpanCategory;
|
||||
categories: readonly SpanCategory[];
|
||||
handleCategoryChange: (category: SpanCategory) => void;
|
||||
}
|
||||
|
||||
export function useSpanCategoryFilter(
|
||||
props: ExpressionFilterProps,
|
||||
): UseSpanCategoryFilterReturn {
|
||||
const { expression, filters, setExpression, expressionRef, runQuery } = props;
|
||||
|
||||
// Derive active category from filters (only updates after runQuery)
|
||||
const selectedCategory = useMemo((): SpanCategory => {
|
||||
for (const [category, key] of Object.entries(CATEGORY_KEYS)) {
|
||||
if (filters.items.some((item) => item.key?.key === key)) {
|
||||
return category as SpanCategory;
|
||||
}
|
||||
}
|
||||
return 'All';
|
||||
}, [filters]);
|
||||
|
||||
const handleCategoryChange = useCallback(
|
||||
(category: SpanCategory): void => {
|
||||
// Remove ALL category keys first
|
||||
let newExpr = removeKeysFromExpression(expression, ALL_CATEGORY_KEYS);
|
||||
// Add the selected category clause (unless "All")
|
||||
if (category !== 'All') {
|
||||
const clause = CATEGORY_EXPRESSIONS[category];
|
||||
newExpr = newExpr.trim() ? `${newExpr.trim()} AND ${clause}` : clause;
|
||||
}
|
||||
applyExpression(newExpr, { setExpression, expressionRef, runQuery });
|
||||
},
|
||||
[expression, setExpression, expressionRef, runQuery],
|
||||
);
|
||||
|
||||
return {
|
||||
selectedCategory,
|
||||
categories: SPAN_CATEGORIES,
|
||||
handleCategoryChange,
|
||||
};
|
||||
}
|
||||
@@ -131,24 +131,6 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// Invisible IntersectionObserver targets pinned at the top and bottom of
|
||||
// the virtualized content. See `useBoundaryPagination`.
|
||||
.waterfall-load-more-sentinel {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
pointer-events: none;
|
||||
|
||||
&--top {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
&--bottom {
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.waterfall-sidebar {
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
@@ -261,7 +243,7 @@
|
||||
}
|
||||
|
||||
&.dimmed-span {
|
||||
opacity: 0.15;
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,7 +315,7 @@
|
||||
|
||||
.tree-connector {
|
||||
position: absolute;
|
||||
width: 14px;
|
||||
width: 11px;
|
||||
height: 50%;
|
||||
border-left: 1px solid var(--l2-border);
|
||||
border-bottom: 1px solid var(--l2-border);
|
||||
@@ -341,16 +323,6 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
// Reserved horizontal space for the chevron — present on every row,
|
||||
// filled only when the span has children. Keeps sibling icons aligned.
|
||||
.tree-arrow-slot {
|
||||
width: 18px;
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.tree-arrow {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -367,18 +339,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Reserved horizontal space for the subtree-count badge — same reason.
|
||||
// Right-aligns the badge inside so single-digit counts don't push the
|
||||
// icon left of where multi-digit counts would put it.
|
||||
.subtree-count-slot {
|
||||
min-width: 20px;
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.subtree-count {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -579,7 +539,7 @@
|
||||
}
|
||||
|
||||
.dimmed-span {
|
||||
opacity: 0.15;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.highlighted-span {
|
||||
opacity: 1;
|
||||
|
||||
@@ -27,11 +27,12 @@ import { useVirtualizer, Virtualizer } from '@tanstack/react-virtual';
|
||||
import cx from 'classnames';
|
||||
import HttpStatusBadge from 'components/HttpStatusBadge/HttpStatusBadge';
|
||||
import TimelineV3 from 'components/TimelineV3/TimelineV3';
|
||||
import { themeColors } from 'constants/theme';
|
||||
import { convertTimeToRelevantUnit } from 'container/TraceDetail/utils';
|
||||
import { useCopySpanLink } from 'hooks/trace/useCopySpanLink';
|
||||
import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
||||
import useUrlQuery from 'hooks/useUrlQuery';
|
||||
import { colorToRgb } from 'lib/uPlotLib/utils/generateColor';
|
||||
import { colorToRgb, generateColor } from 'lib/uPlotLib/utils/generateColor';
|
||||
import {
|
||||
ArrowUpRight,
|
||||
ChevronDown,
|
||||
@@ -40,17 +41,15 @@ import {
|
||||
Link,
|
||||
ListPlus,
|
||||
} from '@signozhq/icons';
|
||||
import { useTraceContext } from 'pages/TraceDetailsV3/contexts/TraceContext';
|
||||
import { useBoundaryPagination } from 'pages/TraceDetailsV3/TraceWaterfall/hooks/useBoundaryPagination';
|
||||
import { useCrosshair } from 'pages/TraceDetailsV3/hooks/useCrosshair';
|
||||
import { ResizableBox } from 'periscope/components/ResizableBox';
|
||||
import { EventV3, SpanV3 } from 'types/api/trace/getTraceV3';
|
||||
import { toFixed } from 'utils/toFixed';
|
||||
|
||||
import { EventTooltipContent } from '../../../SpanHoverCard/EventTooltipContent';
|
||||
import { SpanHoverCard } from '../../../SpanHoverCard/SpanHoverCard';
|
||||
import SpanHoverCard from '../../../SpanHoverCard/SpanHoverCard';
|
||||
import AddSpanToFunnelModal from '../../AddSpanToFunnelModal/AddSpanToFunnelModal';
|
||||
import { IInterestedSpan } from '../../types';
|
||||
import { IInterestedSpan } from '../../TraceWaterfall';
|
||||
|
||||
import './Success.styles.scss';
|
||||
|
||||
@@ -77,7 +76,7 @@ const LazyEventDotPopover = memo(function LazyEventDotPopover({
|
||||
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const handleMouseEnter = useCallback((): void => {
|
||||
timerRef.current = setTimeout(() => setShowPopover(true), 200);
|
||||
timerRef.current = setTimeout(() => setShowPopover(true), 150);
|
||||
}, []);
|
||||
|
||||
const handleMouseLeave = useCallback((): void => {
|
||||
@@ -134,7 +133,7 @@ const LazyEventDotPopover = memo(function LazyEventDotPopover({
|
||||
});
|
||||
|
||||
// css config
|
||||
const CONNECTOR_WIDTH = 30;
|
||||
const CONNECTOR_WIDTH = 20;
|
||||
const VERTICAL_CONNECTOR_WIDTH = 1;
|
||||
|
||||
interface SpanStateClasses {
|
||||
@@ -195,9 +194,8 @@ const SpanOverview = memo(function SpanOverview({
|
||||
selectedSpan,
|
||||
filteredSpanIds,
|
||||
isFilterActive,
|
||||
traceMetadata,
|
||||
onAddSpanToFunnel,
|
||||
onHoverEnter,
|
||||
onHoverLeave,
|
||||
}: {
|
||||
span: SpanV3;
|
||||
isSpanCollapsed: boolean;
|
||||
@@ -206,15 +204,19 @@ const SpanOverview = memo(function SpanOverview({
|
||||
handleSpanClick: (span: SpanV3) => void;
|
||||
filteredSpanIds: string[];
|
||||
isFilterActive: boolean;
|
||||
traceMetadata: ITraceMetadata;
|
||||
onAddSpanToFunnel: (span: SpanV3) => void;
|
||||
onHoverEnter: (spanId: string) => void;
|
||||
onHoverLeave: () => void;
|
||||
}): JSX.Element {
|
||||
const isRootSpan = span.level === 0;
|
||||
const { onSpanCopy } = useCopySpanLink(span);
|
||||
const { resolveSpanColor } = useTraceContext();
|
||||
|
||||
const color = resolveSpanColor(span);
|
||||
let color = generateColor(
|
||||
span['service.name'],
|
||||
themeColors.traceDetailColorsV3,
|
||||
);
|
||||
if (span.has_error) {
|
||||
color = `var(--bg-cherry-500)`;
|
||||
}
|
||||
|
||||
// Smart highlighting logic
|
||||
const {
|
||||
@@ -230,9 +232,6 @@ const SpanOverview = memo(function SpanOverview({
|
||||
isFilterActive,
|
||||
);
|
||||
|
||||
// All siblings at the same level share the same indent so the "same X =
|
||||
// same level" visual rule holds. Parent/child distinction is conveyed by
|
||||
// the chevron and the L-connector, not by an icon-X offset.
|
||||
const indentWidth = isRootSpan ? 0 : span.level * CONNECTOR_WIDTH;
|
||||
|
||||
const handleFunnelClick = (e: React.MouseEvent<HTMLButtonElement>): void => {
|
||||
@@ -241,128 +240,126 @@ const SpanOverview = memo(function SpanOverview({
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cx('span-overview', {
|
||||
'interested-span': isSelected && (!isFilterActive || isMatching),
|
||||
'highlighted-span': isHighlighted,
|
||||
'selected-non-matching-span': isSelectedNonMatching,
|
||||
'dimmed-span': isDimmed,
|
||||
})}
|
||||
onClick={(): void => handleSpanClick(span)}
|
||||
onMouseEnter={(): void => onHoverEnter(span.span_id)}
|
||||
onMouseLeave={(): void => onHoverLeave()}
|
||||
>
|
||||
{/* Tree connector lines — always draw vertical lines at all ancestor levels + L-connector */}
|
||||
{!isRootSpan &&
|
||||
Array.from({ length: span.level }, (_, i) => {
|
||||
const lvl = i + 1;
|
||||
const xPos = (lvl - 1) * CONNECTOR_WIDTH + 9;
|
||||
if (lvl < span.level) {
|
||||
// Stop the line at 50% for the last child's parent level
|
||||
const isLastChildParentLine = !span.has_sibling && lvl === span.level - 1;
|
||||
return (
|
||||
<div
|
||||
key={lvl}
|
||||
className="tree-line"
|
||||
style={{
|
||||
left: xPos,
|
||||
top: 0,
|
||||
width: 1,
|
||||
height: isLastChildParentLine ? '50%' : '100%',
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div key={lvl}>
|
||||
<div
|
||||
className="tree-line"
|
||||
style={{ left: xPos, top: 0, width: 1, height: '50%' }}
|
||||
/>
|
||||
<div className="tree-connector" style={{ left: xPos, top: 0 }} />
|
||||
</div>
|
||||
);
|
||||
<SpanHoverCard span={span} traceMetadata={traceMetadata}>
|
||||
<div
|
||||
className={cx('span-overview', {
|
||||
'interested-span': isSelected && (!isFilterActive || isMatching),
|
||||
'highlighted-span': isHighlighted,
|
||||
'selected-non-matching-span': isSelectedNonMatching,
|
||||
'dimmed-span': isDimmed,
|
||||
})}
|
||||
onClick={(): void => handleSpanClick(span)}
|
||||
>
|
||||
{/* Tree connector lines — always draw vertical lines at all ancestor levels + L-connector */}
|
||||
{!isRootSpan &&
|
||||
Array.from({ length: span.level }, (_, i) => {
|
||||
const lvl = i + 1;
|
||||
const xPos = (lvl - 1) * CONNECTOR_WIDTH + 9;
|
||||
if (lvl < span.level) {
|
||||
// Stop the line at 50% for the last child's parent level
|
||||
const isLastChildParentLine =
|
||||
!span.has_sibling && lvl === span.level - 1;
|
||||
return (
|
||||
<div
|
||||
key={lvl}
|
||||
className="tree-line"
|
||||
style={{
|
||||
left: xPos,
|
||||
top: 0,
|
||||
width: 1,
|
||||
height: isLastChildParentLine ? '50%' : '100%',
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div key={lvl}>
|
||||
<div
|
||||
className="tree-line"
|
||||
style={{ left: xPos, top: 0, width: 1, height: '50%' }}
|
||||
/>
|
||||
<div className="tree-connector" style={{ left: xPos, top: 0 }} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
{/* Indent spacer */}
|
||||
<span className="tree-indent" style={{ width: `${indentWidth}px` }} />
|
||||
{/* Indent spacer */}
|
||||
<span className="tree-indent" style={{ width: `${indentWidth}px` }} />
|
||||
|
||||
{/* Expand/collapse arrow + child count slots — always render the
|
||||
slots, fill them only when the span has children. Reserving the
|
||||
horizontal space on leaf rows aligns sibling icons regardless
|
||||
of whether each sibling is a parent or a leaf. */}
|
||||
<span className="tree-arrow-slot">
|
||||
{/* Expand/collapse arrow + child count (only for spans with children) */}
|
||||
{span.has_children && (
|
||||
<span
|
||||
className={cx('tree-arrow', { expanded: !isSpanCollapsed })}
|
||||
onClick={(event): void => {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
handleCollapseUncollapse(span.span_id, !isSpanCollapsed);
|
||||
}}
|
||||
>
|
||||
{isSpanCollapsed ? <ChevronRight size={14} /> : <ChevronDown size={14} />}
|
||||
</span>
|
||||
<>
|
||||
<span
|
||||
className={cx('tree-arrow', { expanded: !isSpanCollapsed })}
|
||||
onClick={(event): void => {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
handleCollapseUncollapse(span.span_id, !isSpanCollapsed);
|
||||
}}
|
||||
>
|
||||
{isSpanCollapsed ? (
|
||||
<ChevronRight size={14} />
|
||||
) : (
|
||||
<ChevronDown size={14} />
|
||||
)}
|
||||
</span>
|
||||
<span className="subtree-count">
|
||||
<Badge color="vanilla">{span.sub_tree_node_count}</Badge>
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
<span className="subtree-count-slot">
|
||||
{span.has_children && (
|
||||
<span className="subtree-count">
|
||||
<Badge color="vanilla">{span.sub_tree_node_count}</Badge>
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
{/* Colored service dot */}
|
||||
<span
|
||||
className={cx('tree-icon', { 'is-error': span.has_error })}
|
||||
style={{ backgroundColor: color }}
|
||||
/>
|
||||
{/* Colored service dot */}
|
||||
<span
|
||||
className={cx('tree-icon', { 'is-error': span.has_error })}
|
||||
style={{ backgroundColor: color }}
|
||||
/>
|
||||
|
||||
{/* Span name + service name */}
|
||||
<span className="tree-label">
|
||||
{span.name}
|
||||
<span className="tree-service-name">{span['service.name']}</span>
|
||||
</span>
|
||||
{/* Span name + service name */}
|
||||
<span className="tree-label">
|
||||
{span.name}
|
||||
<span className="tree-service-name">{span['service.name']}</span>
|
||||
</span>
|
||||
|
||||
{/* Action buttons — shown on hover via CSS, right-aligned */}
|
||||
<span className="span-row-actions">
|
||||
<TooltipProvider delayDuration={200}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
color="secondary"
|
||||
className="span-action-btn"
|
||||
onClick={onSpanCopy}
|
||||
>
|
||||
<Link size={12} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="span-action-tooltip">
|
||||
Copy Span Link
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
color="secondary"
|
||||
className="span-action-btn"
|
||||
onClick={handleFunnelClick}
|
||||
>
|
||||
<ListPlus size={12} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="span-action-tooltip">
|
||||
Add to Trace Funnel
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
</span>
|
||||
</div>
|
||||
{/* Action buttons — shown on hover via CSS, right-aligned */}
|
||||
<span className="span-row-actions">
|
||||
<TooltipProvider delayDuration={200}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
color="secondary"
|
||||
className="span-action-btn"
|
||||
onClick={onSpanCopy}
|
||||
>
|
||||
<Link size={12} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="span-action-tooltip">
|
||||
Copy Span Link
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
color="secondary"
|
||||
className="span-action-btn"
|
||||
onClick={handleFunnelClick}
|
||||
>
|
||||
<ListPlus size={12} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="span-action-tooltip">
|
||||
Add to Trace Funnel
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
</span>
|
||||
</div>
|
||||
</SpanHoverCard>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -389,10 +386,16 @@ export const SpanDuration = memo(function SpanDuration({
|
||||
const leftOffset = ((span.timestamp - traceMetadata.startTime) * 1e2) / spread;
|
||||
const width = (span.duration_nano * 1e2) / (spread * 1e6);
|
||||
|
||||
const { resolveSpanColor } = useTraceContext();
|
||||
const color = resolveSpanColor(span);
|
||||
// `resolveSpanColor` returns a CSS variable for errors; `colorToRgb` can't parse it.
|
||||
const rgbColor = span.has_error ? '239, 68, 68' : colorToRgb(color);
|
||||
let color = generateColor(
|
||||
span['service.name'],
|
||||
themeColors.traceDetailColorsV3,
|
||||
);
|
||||
let rgbColor = colorToRgb(color);
|
||||
|
||||
if (span.has_error) {
|
||||
color = `var(--bg-cherry-500)`;
|
||||
rgbColor = '239, 68, 68';
|
||||
}
|
||||
|
||||
const {
|
||||
isSelected,
|
||||
@@ -417,25 +420,27 @@ export const SpanDuration = memo(function SpanDuration({
|
||||
})}
|
||||
onClick={(): void => handleSpanClick(span)}
|
||||
>
|
||||
<div
|
||||
className="span-bar"
|
||||
style={
|
||||
{
|
||||
left: `${leftOffset}%`,
|
||||
width: `${width}%`,
|
||||
'--span-color': color,
|
||||
'--span-color-rgb': rgbColor,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
>
|
||||
<span className="span-info">
|
||||
<span className="span-name">{span.name}</span>
|
||||
<span className="span-duration-text">{`${toFixed(
|
||||
time,
|
||||
2,
|
||||
)} ${timeUnitName}`}</span>
|
||||
</span>
|
||||
</div>
|
||||
<SpanHoverCard span={span} traceMetadata={traceMetadata}>
|
||||
<div
|
||||
className="span-bar"
|
||||
style={
|
||||
{
|
||||
left: `${leftOffset}%`,
|
||||
width: `${width}%`,
|
||||
'--span-color': color,
|
||||
'--span-color-rgb': rgbColor,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
>
|
||||
<span className="span-info">
|
||||
<span className="span-name">{span.name}</span>
|
||||
<span className="span-duration-text">{`${toFixed(
|
||||
time,
|
||||
2,
|
||||
)} ${timeUnitName}`}</span>
|
||||
</span>
|
||||
</div>
|
||||
</SpanHoverCard>
|
||||
{span.events?.map((event) => {
|
||||
const eventTimeMs = event.timeUnixNano / 1e6;
|
||||
const spanDurationMs = span.duration_nano / 1e6;
|
||||
@@ -501,17 +506,6 @@ function Success(props: ISuccessProps): JSX.Element {
|
||||
const prevHoveredSpanIdRef = useRef<string | null>(null);
|
||||
const autoScrollTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const {
|
||||
topSentinelRef: loadMoreTopSentinelRef,
|
||||
bottomSentinelRef: loadMoreBottomSentinelRef,
|
||||
} = useBoundaryPagination({
|
||||
scrollContainerRef,
|
||||
spans,
|
||||
isFetching,
|
||||
isFullDataLoaded,
|
||||
setInterestedSpanId,
|
||||
});
|
||||
|
||||
const {
|
||||
cursorXPercent,
|
||||
cursorX,
|
||||
@@ -537,32 +531,15 @@ function Success(props: ISuccessProps): JSX.Element {
|
||||
prevHoveredSpanIdRef.current = spanId;
|
||||
}, []);
|
||||
|
||||
// Hover-card state — single popover anchored at the sidebar/timeline
|
||||
// boundary, Y tracks the hovered row. Set after a 500 ms debounce so fast
|
||||
// scrolls/cursor sweeps don't fire the card.
|
||||
const [hoveredSpanId, setHoveredSpanId] = useState<string | null>(null);
|
||||
const hoverDelayTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const handleRowMouseEnter = useCallback(
|
||||
(spanId: string): void => {
|
||||
applyHoverClass(spanId);
|
||||
if (hoverDelayTimerRef.current) {
|
||||
clearTimeout(hoverDelayTimerRef.current);
|
||||
}
|
||||
hoverDelayTimerRef.current = setTimeout(() => {
|
||||
setHoveredSpanId(spanId);
|
||||
}, 500);
|
||||
},
|
||||
[applyHoverClass],
|
||||
);
|
||||
|
||||
const handleRowMouseLeave = useCallback((): void => {
|
||||
applyHoverClass(null);
|
||||
if (hoverDelayTimerRef.current) {
|
||||
clearTimeout(hoverDelayTimerRef.current);
|
||||
hoverDelayTimerRef.current = null;
|
||||
}
|
||||
setHoveredSpanId(null);
|
||||
}, [applyHoverClass]);
|
||||
|
||||
const handleCollapseUncollapse = useCallback(
|
||||
@@ -578,15 +555,14 @@ function Success(props: ISuccessProps): JSX.Element {
|
||||
}
|
||||
return next;
|
||||
});
|
||||
} else {
|
||||
// Backend mode: trigger API call (current behavior)
|
||||
setInterestedSpanId({
|
||||
spanId,
|
||||
isUncollapsed: !collapse,
|
||||
scrollToSpan: false,
|
||||
});
|
||||
}
|
||||
// Backend mode: trigger API call (current behavior)
|
||||
// keeping this for both mode to support scroll to view to function well.
|
||||
// interestedspan would not make api call in frontend mode so it is safe to use for both mode.
|
||||
setInterestedSpanId({
|
||||
spanId,
|
||||
isUncollapsed: !collapse,
|
||||
scrollToSpan: false,
|
||||
});
|
||||
},
|
||||
[isFullDataLoaded, setLocalUncollapsedNodes, setInterestedSpanId],
|
||||
);
|
||||
@@ -639,8 +615,32 @@ function Success(props: ISuccessProps): JSX.Element {
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
// In frontend mode all data is already loaded, no need to fetch more.
|
||||
// In backend mode, skip auto-fetch when under 500 spans (nothing more to paginate).
|
||||
if (isFullDataLoaded || spans.length < 500) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (range?.startIndex === 0 && instance.isScrolling) {
|
||||
// do not trigger for trace root as nothing to fetch above
|
||||
if (spans[0].level !== 0) {
|
||||
setInterestedSpanId({
|
||||
spanId: spans[0].span_id,
|
||||
isUncollapsed: false,
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (range?.endIndex === spans.length - 1 && instance.isScrolling) {
|
||||
setInterestedSpanId({
|
||||
spanId: spans[spans.length - 1].span_id,
|
||||
isUncollapsed: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
[spans],
|
||||
[spans, setInterestedSpanId],
|
||||
);
|
||||
|
||||
const [isAddSpanToFunnelModalOpen, setIsAddSpanToFunnelModalOpen] =
|
||||
@@ -685,11 +685,10 @@ function Success(props: ISuccessProps): JSX.Element {
|
||||
}
|
||||
selectedSpan={selectedSpan}
|
||||
handleSpanClick={handleSpanClick}
|
||||
traceMetadata={traceMetadata}
|
||||
filteredSpanIds={filteredSpanIds}
|
||||
isFilterActive={isFilterActive}
|
||||
onAddSpanToFunnel={handleAddSpanToFunnel}
|
||||
onHoverEnter={handleRowMouseEnter}
|
||||
onHoverLeave={handleRowMouseLeave}
|
||||
/>
|
||||
),
|
||||
}),
|
||||
@@ -699,13 +698,12 @@ function Success(props: ISuccessProps): JSX.Element {
|
||||
uncollapsedNodes,
|
||||
isFullDataLoaded,
|
||||
localUncollapsedNodes,
|
||||
traceMetadata,
|
||||
selectedSpan,
|
||||
handleSpanClick,
|
||||
filteredSpanIds,
|
||||
isFilterActive,
|
||||
handleAddSpanToFunnel,
|
||||
handleRowMouseEnter,
|
||||
handleRowMouseLeave,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -782,12 +780,6 @@ function Success(props: ISuccessProps): JSX.Element {
|
||||
const virtualItems = virtualizer.getVirtualItems();
|
||||
const leftRows = leftTable.getRowModel().rows;
|
||||
|
||||
const handleHoverCardOpenChange = useCallback((open: boolean): void => {
|
||||
if (!open) {
|
||||
setHoveredSpanId(null);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="success-content">
|
||||
{traceMetadata.hasMissingSpans && (
|
||||
@@ -841,24 +833,6 @@ function Success(props: ISuccessProps): JSX.Element {
|
||||
height: '100%',
|
||||
}}
|
||||
>
|
||||
{/* Top / bottom sentinels: each transition into the viewport
|
||||
fires a load-more via useBoundaryPagination. */}
|
||||
<div
|
||||
ref={loadMoreTopSentinelRef}
|
||||
className="waterfall-load-more-sentinel waterfall-load-more-sentinel--top"
|
||||
/>
|
||||
<div
|
||||
ref={loadMoreBottomSentinelRef}
|
||||
className="waterfall-load-more-sentinel waterfall-load-more-sentinel--bottom"
|
||||
/>
|
||||
<SpanHoverCard
|
||||
hoveredSpanId={hoveredSpanId}
|
||||
onOpenChange={handleHoverCardOpenChange}
|
||||
anchorLeft={sidebarWidth}
|
||||
rowHeight={ROW_HEIGHT}
|
||||
spans={spans}
|
||||
traceStartTime={traceMetadata.startTime}
|
||||
/>
|
||||
{/* Left panel - table with horizontal scroll */}
|
||||
<ResizableBox
|
||||
direction="horizontal"
|
||||
@@ -968,8 +942,8 @@ function Success(props: ISuccessProps): JSX.Element {
|
||||
height: ROW_HEIGHT,
|
||||
transform: `translateY(${virtualRow.start}px)`,
|
||||
}}
|
||||
onMouseEnter={(): void => applyHoverClass(span.span_id)}
|
||||
onMouseLeave={(): void => applyHoverClass(null)}
|
||||
onMouseEnter={(): void => handleRowMouseEnter(span.span_id)}
|
||||
onMouseLeave={handleRowMouseLeave}
|
||||
>
|
||||
<SpanDuration
|
||||
span={span}
|
||||
|
||||
@@ -2,12 +2,8 @@ import useUrlQuery from 'hooks/useUrlQuery';
|
||||
import { fireEvent, render, screen } from 'tests/test-utils';
|
||||
import { SpanV3 } from 'types/api/trace/getTraceV3';
|
||||
|
||||
import { TraceProvider } from '../../../../contexts/TraceContext';
|
||||
import { SpanDuration } from '../Success';
|
||||
|
||||
const renderWithTraceProvider: typeof render = (ui, options) =>
|
||||
render(<TraceProvider aggregations={undefined}>{ui}</TraceProvider>, options);
|
||||
|
||||
// Constants to avoid string duplication
|
||||
const SPAN_DURATION_TEXT = '1.16 ms';
|
||||
const SPAN_DURATION_CLASS = '.span-duration';
|
||||
@@ -23,9 +19,6 @@ jest.mock('components/TimelineV3/TimelineV3', () => ({
|
||||
|
||||
// Mock the hooks
|
||||
jest.mock('hooks/useUrlQuery');
|
||||
jest.mock('@signozhq/ui', () => ({
|
||||
Badge: jest.fn(),
|
||||
}));
|
||||
|
||||
const mockSpan: SpanV3 = {
|
||||
span_id: 'test-span-id',
|
||||
@@ -95,7 +88,7 @@ describe('SpanDuration', () => {
|
||||
it('calls handleSpanClick when clicked', () => {
|
||||
const mockHandleSpanClick = jest.fn();
|
||||
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<SpanDuration
|
||||
span={mockSpan}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
@@ -115,7 +108,7 @@ describe('SpanDuration', () => {
|
||||
});
|
||||
|
||||
it('shows action buttons on hover', () => {
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<SpanDuration
|
||||
span={mockSpan}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
@@ -136,7 +129,7 @@ describe('SpanDuration', () => {
|
||||
});
|
||||
|
||||
it('applies interested-span class when span is selected', () => {
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<SpanDuration
|
||||
span={mockSpan}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
@@ -154,7 +147,7 @@ describe('SpanDuration', () => {
|
||||
});
|
||||
|
||||
it('applies highlighted-span class when span matches filter', () => {
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<SpanDuration
|
||||
span={mockSpan}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
@@ -173,7 +166,7 @@ describe('SpanDuration', () => {
|
||||
});
|
||||
|
||||
it('applies dimmed-span class when span does not match filter', () => {
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<SpanDuration
|
||||
span={mockSpan}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
@@ -192,7 +185,7 @@ describe('SpanDuration', () => {
|
||||
});
|
||||
|
||||
it('prioritizes interested-span over highlighted-span when span is selected and matches filter', () => {
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<SpanDuration
|
||||
span={mockSpan}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
@@ -212,7 +205,7 @@ describe('SpanDuration', () => {
|
||||
});
|
||||
|
||||
it('applies selected-non-matching-span class when span is selected but does not match filter', () => {
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<SpanDuration
|
||||
span={mockSpan}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
@@ -233,7 +226,7 @@ describe('SpanDuration', () => {
|
||||
});
|
||||
|
||||
it('applies interested-span class when span is selected and no filter is active', () => {
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<SpanDuration
|
||||
span={mockSpan}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
@@ -254,7 +247,7 @@ describe('SpanDuration', () => {
|
||||
});
|
||||
|
||||
it('dims span when filter is active but no matches found', () => {
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<SpanDuration
|
||||
span={mockSpan}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
|
||||
@@ -2,16 +2,8 @@ import React from 'react';
|
||||
import { render, screen, userEvent, waitFor } from 'tests/test-utils';
|
||||
import { SpanV3 } from 'types/api/trace/getTraceV3';
|
||||
|
||||
import { TraceProvider } from '../../../../contexts/TraceContext';
|
||||
import Success from '../Success';
|
||||
|
||||
const renderWithTraceProvider: typeof render = (ui, options, customOptions) =>
|
||||
render(
|
||||
<TraceProvider aggregations={undefined}>{ui}</TraceProvider>,
|
||||
options,
|
||||
customOptions,
|
||||
);
|
||||
|
||||
// Mock the required hooks with proper typing
|
||||
const mockSafeNavigate = jest.fn() as jest.MockedFunction<
|
||||
(params: { search: string }) => void
|
||||
@@ -230,7 +222,7 @@ describe('Span Click User Flows', () => {
|
||||
it('clicking span updates URL with spanId parameter', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<Success
|
||||
spans={mockSpans}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
@@ -269,7 +261,7 @@ describe('Span Click User Flows', () => {
|
||||
it('clicking span duration visually selects the span', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
renderWithTraceProvider(<TestComponent />, undefined, {
|
||||
render(<TestComponent />, undefined, {
|
||||
initialRoute: '/trace',
|
||||
});
|
||||
|
||||
@@ -308,7 +300,7 @@ describe('Span Click User Flows', () => {
|
||||
it('both click areas produce the same visual result', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
renderWithTraceProvider(<TestComponent />, undefined, {
|
||||
render(<TestComponent />, undefined, {
|
||||
initialRoute: '/trace',
|
||||
});
|
||||
|
||||
@@ -368,7 +360,7 @@ describe('Span Click User Flows', () => {
|
||||
it('clicking different spans updates selection correctly', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
renderWithTraceProvider(<TestComponent />, undefined, {
|
||||
render(<TestComponent />, undefined, {
|
||||
initialRoute: '/trace',
|
||||
});
|
||||
|
||||
@@ -412,7 +404,7 @@ describe('Span Click User Flows', () => {
|
||||
mockUrlQuery.set('existingParam', 'existingValue');
|
||||
mockUrlQuery.set('anotherParam', 'anotherValue');
|
||||
|
||||
renderWithTraceProvider(
|
||||
render(
|
||||
<Success
|
||||
spans={mockSpans}
|
||||
traceMetadata={mockTraceMetadata}
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
import { RefObject, useEffect, useRef } from 'react';
|
||||
import { SpanV3 } from 'types/api/trace/getTraceV3';
|
||||
|
||||
import { IInterestedSpan } from '../types';
|
||||
|
||||
const MIN_SPANS_FOR_PAGINATION = 500;
|
||||
|
||||
interface UseBoundaryPaginationProps {
|
||||
scrollContainerRef: RefObject<HTMLDivElement>;
|
||||
spans: SpanV3[];
|
||||
isFetching: boolean | undefined;
|
||||
isFullDataLoaded: boolean;
|
||||
setInterestedSpanId: (next: IInterestedSpan) => void;
|
||||
}
|
||||
|
||||
interface UseBoundaryPaginationResult {
|
||||
topSentinelRef: RefObject<HTMLDivElement>;
|
||||
bottomSentinelRef: RefObject<HTMLDivElement>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drives load-more on a virtualized list via two `IntersectionObserver`
|
||||
* sentinels (top + bottom of the inner content). The observer is created
|
||||
* once and reads live state through refs — recreating it would re-fire
|
||||
* IO's mandatory initial-intersection callback for sentinels still in view
|
||||
* and produce a fetch spiral on every data update.
|
||||
*
|
||||
* Returns the two refs the caller must attach to its sentinel `<div>`s.
|
||||
*/
|
||||
export function useBoundaryPagination({
|
||||
scrollContainerRef,
|
||||
spans,
|
||||
isFetching,
|
||||
isFullDataLoaded,
|
||||
setInterestedSpanId,
|
||||
}: UseBoundaryPaginationProps): UseBoundaryPaginationResult {
|
||||
const topSentinelRef = useRef<HTMLDivElement | null>(null);
|
||||
const bottomSentinelRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
const spansRef = useRef<SpanV3[]>(spans);
|
||||
const isFetchingRef = useRef<boolean | undefined>(isFetching);
|
||||
const isFullDataLoadedRef = useRef<boolean>(isFullDataLoaded);
|
||||
|
||||
useEffect(() => {
|
||||
spansRef.current = spans;
|
||||
}, [spans]);
|
||||
useEffect(() => {
|
||||
isFetchingRef.current = isFetching;
|
||||
}, [isFetching]);
|
||||
useEffect(() => {
|
||||
isFullDataLoadedRef.current = isFullDataLoaded;
|
||||
}, [isFullDataLoaded]);
|
||||
|
||||
useEffect(() => {
|
||||
const root = scrollContainerRef.current;
|
||||
if (!root) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const seenInitial = new WeakSet<Element>();
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (!seenInitial.has(entry.target)) {
|
||||
seenInitial.add(entry.target);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!entry.isIntersecting ||
|
||||
isFetchingRef.current ||
|
||||
isFullDataLoadedRef.current ||
|
||||
spansRef.current.length < MIN_SPANS_FOR_PAGINATION
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.target === bottomSentinelRef.current) {
|
||||
const lastSpan = spansRef.current[spansRef.current.length - 1];
|
||||
if (lastSpan) {
|
||||
setInterestedSpanId({
|
||||
spanId: lastSpan.span_id,
|
||||
isUncollapsed: false,
|
||||
});
|
||||
}
|
||||
} else if (entry.target === topSentinelRef.current) {
|
||||
const firstSpan = spansRef.current[0];
|
||||
if (firstSpan && firstSpan.level !== 0) {
|
||||
setInterestedSpanId({
|
||||
spanId: firstSpan.span_id,
|
||||
isUncollapsed: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
{ root, threshold: 0 },
|
||||
);
|
||||
|
||||
if (bottomSentinelRef.current) {
|
||||
observer.observe(bottomSentinelRef.current);
|
||||
}
|
||||
if (topSentinelRef.current) {
|
||||
observer.observe(topSentinelRef.current);
|
||||
}
|
||||
|
||||
return (): void => observer.disconnect();
|
||||
}, [scrollContainerRef, setInterestedSpanId]);
|
||||
|
||||
return { topSentinelRef, bottomSentinelRef };
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
export interface IInterestedSpan {
|
||||
spanId: string;
|
||||
isUncollapsed: boolean;
|
||||
scrollToSpan?: boolean;
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
import { useMemo } from 'react';
|
||||
import {
|
||||
closestCenter,
|
||||
DndContext,
|
||||
DragEndEvent,
|
||||
PointerSensor,
|
||||
useSensor,
|
||||
useSensors,
|
||||
} from '@dnd-kit/core';
|
||||
import {
|
||||
arrayMove,
|
||||
SortableContext,
|
||||
useSortable,
|
||||
verticalListSortingStrategy,
|
||||
} from '@dnd-kit/sortable';
|
||||
import { CSS } from '@dnd-kit/utilities';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||
import { GripVertical } from '@signozhq/icons';
|
||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
|
||||
function SortableField({
|
||||
field,
|
||||
onRemove,
|
||||
allowDrag,
|
||||
}: {
|
||||
field: BaseAutocompleteData;
|
||||
onRemove: (field: BaseAutocompleteData) => void;
|
||||
allowDrag: boolean;
|
||||
}): JSX.Element {
|
||||
const { attributes, listeners, setNodeRef, transform, transition } =
|
||||
useSortable({ id: field.key });
|
||||
|
||||
const style = {
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={setNodeRef}
|
||||
style={style}
|
||||
className={`fs-field-item ${allowDrag ? 'drag-enabled' : 'drag-disabled'}`}
|
||||
>
|
||||
<div {...attributes} {...listeners} className="drag-handle">
|
||||
{allowDrag && <GripVertical size={14} />}
|
||||
<span className="fs-field-key">{field.key}</span>
|
||||
</div>
|
||||
<Button
|
||||
className="remove-field-btn periscope-btn"
|
||||
variant="outlined"
|
||||
color="destructive"
|
||||
size="sm"
|
||||
onClick={(): void => onRemove(field)}
|
||||
>
|
||||
Remove
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface AddedFieldsProps {
|
||||
inputValue: string;
|
||||
fields: BaseAutocompleteData[];
|
||||
onFieldsChange: (fields: BaseAutocompleteData[]) => void;
|
||||
}
|
||||
|
||||
function AddedFields({
|
||||
inputValue,
|
||||
fields,
|
||||
onFieldsChange,
|
||||
}: AddedFieldsProps): JSX.Element {
|
||||
const sensors = useSensors(useSensor(PointerSensor));
|
||||
|
||||
const handleDragEnd = (event: DragEndEvent): void => {
|
||||
const { active, over } = event;
|
||||
if (over && active.id !== over.id) {
|
||||
const oldIndex = fields.findIndex((f) => f.key === active.id);
|
||||
const newIndex = fields.findIndex((f) => f.key === over.id);
|
||||
onFieldsChange(arrayMove(fields, oldIndex, newIndex));
|
||||
}
|
||||
};
|
||||
|
||||
const filteredFields = useMemo(
|
||||
() =>
|
||||
fields.filter((f) => f.key.toLowerCase().includes(inputValue.toLowerCase())),
|
||||
[fields, inputValue],
|
||||
);
|
||||
|
||||
const handleRemove = (field: BaseAutocompleteData): void => {
|
||||
onFieldsChange(fields.filter((f) => f.key !== field.key));
|
||||
};
|
||||
|
||||
const allowDrag = inputValue.length === 0;
|
||||
|
||||
return (
|
||||
<div className="fs-section fs-added">
|
||||
<div className="fs-section-header">ADDED FIELDS</div>
|
||||
<div className="fs-added-list">
|
||||
<OverlayScrollbar>
|
||||
<DndContext
|
||||
sensors={sensors}
|
||||
collisionDetection={closestCenter}
|
||||
onDragEnd={handleDragEnd}
|
||||
>
|
||||
{filteredFields.length === 0 ? (
|
||||
<div className="fs-no-values">No values found</div>
|
||||
) : (
|
||||
<SortableContext
|
||||
items={fields.map((f) => f.key)}
|
||||
strategy={verticalListSortingStrategy}
|
||||
disabled={!allowDrag}
|
||||
>
|
||||
{filteredFields.map((field) => (
|
||||
<SortableField
|
||||
key={field.key}
|
||||
field={field}
|
||||
onRemove={handleRemove}
|
||||
allowDrag={allowDrag}
|
||||
/>
|
||||
))}
|
||||
</SortableContext>
|
||||
)}
|
||||
</DndContext>
|
||||
</OverlayScrollbar>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default AddedFields;
|
||||
@@ -1,161 +0,0 @@
|
||||
.fields-settings {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
background: var(--l1-background);
|
||||
color: var(--l1-foreground);
|
||||
overflow: hidden;
|
||||
|
||||
.fs-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid var(--l1-border);
|
||||
|
||||
.fs-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.fs-close-icon {
|
||||
cursor: pointer;
|
||||
color: var(--l2-foreground);
|
||||
|
||||
&:hover {
|
||||
color: var(--l1-foreground);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fs-search {
|
||||
.fs-search-input {
|
||||
background-color: var(--l1-background);
|
||||
height: 40px;
|
||||
border-radius: 0;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
}
|
||||
|
||||
.fs-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&.fs-added {
|
||||
max-height: 40%;
|
||||
border-bottom: 1px solid var(--l1-border);
|
||||
}
|
||||
|
||||
&.fs-other {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.fs-section-header {
|
||||
color: var(--muted-foreground);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
line-height: 18px;
|
||||
letter-spacing: 0.88px;
|
||||
text-transform: uppercase;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.fs-added-list {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fs-other-list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
|
||||
.ant-skeleton-input {
|
||||
width: 300px;
|
||||
margin: 8px 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.fs-no-values {
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
color: var(--l2-foreground);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.fs-limit-hint {
|
||||
padding: 8px 12px;
|
||||
text-align: center;
|
||||
color: var(--muted-foreground);
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
.fs-field-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 6px 12px;
|
||||
border-radius: 4px;
|
||||
user-select: none;
|
||||
font-size: 13px;
|
||||
|
||||
.drag-handle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.fs-field-key {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&.drag-enabled {
|
||||
cursor: grab;
|
||||
|
||||
&:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
}
|
||||
|
||||
&.drag-disabled {
|
||||
padding: 6px 12px;
|
||||
}
|
||||
|
||||
&.other-field-item {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.remove-field-btn,
|
||||
.add-field-btn {
|
||||
padding: 4px 10px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease-in-out;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: var(--l2-background);
|
||||
|
||||
.remove-field-btn,
|
||||
.add-field-btn {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fs-footer {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 12px;
|
||||
border-top: 1px solid var(--l1-border);
|
||||
justify-content: space-between;
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { toast } from '@signozhq/ui/sonner';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Input } from '@signozhq/ui/input';
|
||||
import useDebouncedFn from 'hooks/useDebouncedFunction';
|
||||
import { Check, TableColumnsSplit, X } from '@signozhq/icons';
|
||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
import { DataSource } from 'types/common/queryBuilder';
|
||||
|
||||
import AddedFields from './AddedFields';
|
||||
import OtherFields from './OtherFields';
|
||||
|
||||
import './FieldsSettings.styles.scss';
|
||||
|
||||
const MAX_FIELDS_DEFAULT = 10;
|
||||
|
||||
interface FieldsSettingsProps {
|
||||
title: string;
|
||||
// Picker's native shape (`BaseAutocompleteData`) is preserved end-to-end so
|
||||
// downstream consumers (flamegraph `selectFields`, hover popovers) get full
|
||||
// field metadata without a lossy conversion at add-time.
|
||||
fields: BaseAutocompleteData[];
|
||||
onFieldsChange: (fields: BaseAutocompleteData[]) => void;
|
||||
onClose: () => void;
|
||||
dataSource: DataSource;
|
||||
maxFields?: number;
|
||||
}
|
||||
|
||||
function FieldsSettings({
|
||||
title,
|
||||
fields,
|
||||
onFieldsChange,
|
||||
onClose,
|
||||
dataSource,
|
||||
maxFields = MAX_FIELDS_DEFAULT,
|
||||
}: FieldsSettingsProps): JSX.Element {
|
||||
// Local draft state — changes here don't persist until Save
|
||||
const [draftFields, setDraftFields] = useState<BaseAutocompleteData[]>(fields);
|
||||
const [inputValue, setInputValue] = useState('');
|
||||
const [debouncedInputValue, setDebouncedInputValue] = useState('');
|
||||
|
||||
const debouncedUpdate = useDebouncedFn((value) => {
|
||||
setDebouncedInputValue(value as string);
|
||||
}, 400);
|
||||
|
||||
const handleInputChange = useCallback(
|
||||
(e: React.ChangeEvent<HTMLInputElement>): void => {
|
||||
const value = e.target.value.trim().toLowerCase();
|
||||
setInputValue(value);
|
||||
debouncedUpdate(value);
|
||||
},
|
||||
[debouncedUpdate],
|
||||
);
|
||||
|
||||
const handleAdd = useCallback(
|
||||
(field: BaseAutocompleteData): void => {
|
||||
if (draftFields.length >= maxFields) {
|
||||
return;
|
||||
}
|
||||
if (draftFields.some((f) => f.key === field.key)) {
|
||||
return;
|
||||
}
|
||||
setDraftFields((prev) => [...prev, field]);
|
||||
},
|
||||
[draftFields, maxFields],
|
||||
);
|
||||
|
||||
const handleSave = useCallback((): void => {
|
||||
onFieldsChange(draftFields);
|
||||
toast.success('Saved successfully', {
|
||||
position: 'top-right',
|
||||
});
|
||||
onClose();
|
||||
}, [draftFields, onFieldsChange, onClose]);
|
||||
|
||||
const handleDiscard = useCallback((): void => {
|
||||
setDraftFields(fields);
|
||||
}, [fields]);
|
||||
|
||||
const hasUnsavedChanges = useMemo(
|
||||
() =>
|
||||
!(
|
||||
draftFields.length === fields.length &&
|
||||
draftFields.every((f, i) => f.key === fields[i]?.key)
|
||||
),
|
||||
[draftFields, fields],
|
||||
);
|
||||
|
||||
const isAtLimit = draftFields.length >= maxFields;
|
||||
|
||||
return (
|
||||
<div className="fields-settings">
|
||||
<div className="fs-header">
|
||||
<div className="fs-title">
|
||||
<TableColumnsSplit size={16} />
|
||||
{title}
|
||||
</div>
|
||||
<X className="fs-close-icon" size={16} onClick={onClose} />
|
||||
</div>
|
||||
|
||||
<section className="fs-search">
|
||||
<Input
|
||||
className="fs-search-input"
|
||||
type="text"
|
||||
value={inputValue}
|
||||
placeholder="Search for a field..."
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
</section>
|
||||
|
||||
<AddedFields
|
||||
inputValue={inputValue}
|
||||
fields={draftFields}
|
||||
onFieldsChange={setDraftFields}
|
||||
/>
|
||||
|
||||
<OtherFields
|
||||
dataSource={dataSource}
|
||||
debouncedInputValue={debouncedInputValue}
|
||||
addedFields={draftFields}
|
||||
onAdd={handleAdd}
|
||||
isAtLimit={isAtLimit}
|
||||
/>
|
||||
|
||||
{hasUnsavedChanges && (
|
||||
<div className="fs-footer">
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
onClick={handleDiscard}
|
||||
prefix={<X width={14} height={14} />}
|
||||
>
|
||||
Discard
|
||||
</Button>
|
||||
<Button
|
||||
variant="solid"
|
||||
color="primary"
|
||||
onClick={handleSave}
|
||||
prefix={<Check width={14} height={14} />}
|
||||
>
|
||||
Save changes
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default FieldsSettings;
|
||||
@@ -1,99 +0,0 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Skeleton } from 'antd';
|
||||
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
|
||||
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||
import { useGetAggregateKeys } from 'hooks/queryBuilder/useGetAggregateKeys';
|
||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
import { DataSource } from 'types/common/queryBuilder';
|
||||
|
||||
interface OtherFieldsProps {
|
||||
dataSource: DataSource;
|
||||
debouncedInputValue: string;
|
||||
addedFields: BaseAutocompleteData[];
|
||||
onAdd: (field: BaseAutocompleteData) => void;
|
||||
isAtLimit: boolean;
|
||||
}
|
||||
|
||||
function OtherFields({
|
||||
dataSource,
|
||||
debouncedInputValue,
|
||||
addedFields,
|
||||
onAdd,
|
||||
isAtLimit,
|
||||
}: OtherFieldsProps): JSX.Element {
|
||||
// API call to get available attribute keys
|
||||
const { data, isFetching } = useGetAggregateKeys(
|
||||
{
|
||||
searchText: debouncedInputValue,
|
||||
dataSource,
|
||||
aggregateOperator: 'noop',
|
||||
aggregateAttribute: '',
|
||||
tagType: '',
|
||||
},
|
||||
{
|
||||
queryKey: [
|
||||
REACT_QUERY_KEY.GET_OTHER_FILTERS,
|
||||
'preview-fields',
|
||||
debouncedInputValue,
|
||||
],
|
||||
enabled: true,
|
||||
},
|
||||
);
|
||||
|
||||
// Filter out already-added fields, match on .key from API response objects
|
||||
const otherFields = useMemo(() => {
|
||||
const attributes = data?.payload?.attributeKeys || [];
|
||||
const addedKeys = new Set(addedFields.map((f) => f.key));
|
||||
return attributes.filter((attr) => !addedKeys.has(attr.key));
|
||||
}, [data, addedFields]);
|
||||
|
||||
if (isFetching) {
|
||||
return (
|
||||
<div className="fs-section fs-other">
|
||||
<div className="fs-section-header">OTHER FIELDS</div>
|
||||
<div className="fs-other-list">
|
||||
{Array.from({ length: 5 }).map((_, i) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<Skeleton.Input active size="small" key={i} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="fs-section fs-other">
|
||||
<div className="fs-section-header">OTHER FIELDS</div>
|
||||
<div className="fs-other-list">
|
||||
<OverlayScrollbar>
|
||||
<>
|
||||
{otherFields.length === 0 ? (
|
||||
<div className="fs-no-values">No values found</div>
|
||||
) : (
|
||||
otherFields.map((attr) => (
|
||||
<div key={attr.key} className="fs-field-item other-field-item">
|
||||
<span className="fs-field-key">{attr.key}</span>
|
||||
{!isAtLimit && (
|
||||
<Button
|
||||
className="add-field-btn periscope-btn"
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
size="sm"
|
||||
onClick={(): void => onAdd(attr)}
|
||||
>
|
||||
Add
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
{isAtLimit && <div className="fs-limit-hint">Maximum 10 fields</div>}
|
||||
</>
|
||||
</OverlayScrollbar>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default OtherFields;
|
||||
@@ -1,55 +0,0 @@
|
||||
import { TelemetryFieldKey } from 'types/api/v5/queryRange';
|
||||
|
||||
export interface ColorByOption {
|
||||
field: TelemetryFieldKey;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export const COLOR_BY_OPTIONS: ColorByOption[] = [
|
||||
{
|
||||
field: {
|
||||
name: 'service.name',
|
||||
fieldContext: 'resource',
|
||||
fieldDataType: 'string',
|
||||
},
|
||||
label: 'Service',
|
||||
},
|
||||
{
|
||||
field: {
|
||||
name: 'service.namespace',
|
||||
fieldContext: 'resource',
|
||||
fieldDataType: 'string',
|
||||
},
|
||||
label: 'Namespace',
|
||||
},
|
||||
{
|
||||
field: {
|
||||
name: 'host.name',
|
||||
fieldContext: 'resource',
|
||||
fieldDataType: 'string',
|
||||
},
|
||||
label: 'Host',
|
||||
},
|
||||
{
|
||||
field: {
|
||||
name: 'k8s.node.name',
|
||||
fieldContext: 'resource',
|
||||
fieldDataType: 'string',
|
||||
},
|
||||
label: 'Node',
|
||||
},
|
||||
{
|
||||
field: {
|
||||
name: 'k8s.container.name',
|
||||
fieldContext: 'resource',
|
||||
fieldDataType: 'string',
|
||||
},
|
||||
label: 'Container',
|
||||
},
|
||||
];
|
||||
|
||||
export const COLOR_BY_FIELDS: TelemetryFieldKey[] = COLOR_BY_OPTIONS.map(
|
||||
(o) => o.field,
|
||||
);
|
||||
|
||||
export const DEFAULT_COLOR_BY_FIELD = COLOR_BY_FIELDS[0];
|
||||
@@ -1,220 +0,0 @@
|
||||
import {
|
||||
// oxlint-disable-next-line no-restricted-imports
|
||||
createContext,
|
||||
ReactNode,
|
||||
useCallback,
|
||||
// oxlint-disable-next-line no-restricted-imports
|
||||
useContext,
|
||||
useMemo,
|
||||
} from 'react';
|
||||
import { useMutation } from 'react-query';
|
||||
import updateUserPreferenceAPI from 'api/v1/user/preferences/name/update';
|
||||
import { themeColors } from 'constants/theme';
|
||||
import { USER_PREFERENCES } from 'constants/userPreferences';
|
||||
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
import { TelemetryFieldKey } from 'types/api/v5/queryRange';
|
||||
import {
|
||||
SpanV3,
|
||||
WaterfallAggregationResponse,
|
||||
WaterfallAggregationType,
|
||||
} from 'types/api/trace/getTraceV3';
|
||||
|
||||
import {
|
||||
ColorByOption,
|
||||
COLOR_BY_FIELDS,
|
||||
COLOR_BY_OPTIONS,
|
||||
DEFAULT_COLOR_BY_FIELD,
|
||||
} from '../constants';
|
||||
import { getSpanAttribute } from '../utils';
|
||||
import {
|
||||
AGGREGATIONS,
|
||||
getAggregationMap as findAggregationMap,
|
||||
} from '../utils/aggregations';
|
||||
|
||||
interface TraceContextValue {
|
||||
colorByField: TelemetryFieldKey;
|
||||
setColorByField: (field: TelemetryFieldKey) => void;
|
||||
aggregations: WaterfallAggregationResponse[] | undefined;
|
||||
getAggregationMap: (
|
||||
type: WaterfallAggregationType,
|
||||
) => Record<string, number> | undefined;
|
||||
getSpanGroupValue: (span: SpanV3) => string;
|
||||
resolveSpanColor: (span: SpanV3) => string;
|
||||
/**
|
||||
* Subset of COLOR_BY_OPTIONS whose data is populated on the current trace.
|
||||
* `service.name` is always included; host/container only when their
|
||||
* aggregation `value` map has entries.
|
||||
*/
|
||||
availableColorByOptions: ColorByOption[];
|
||||
/**
|
||||
* Per-user preview fields (selected via the floating "Preview fields"
|
||||
* panel). Stored in `span_details_preview_attributes` user pref. Will be
|
||||
* consumed by the flamegraph `selectFields` request and the waterfall +
|
||||
* flamegraph hover popovers in follow-up phases.
|
||||
*/
|
||||
previewFields: BaseAutocompleteData[];
|
||||
setPreviewFields: (next: BaseAutocompleteData[]) => void;
|
||||
}
|
||||
|
||||
const TraceContext = createContext<TraceContextValue | null>(null);
|
||||
|
||||
export function TraceProvider({
|
||||
aggregations,
|
||||
children,
|
||||
}: {
|
||||
aggregations: WaterfallAggregationResponse[] | undefined;
|
||||
children: ReactNode;
|
||||
}): JSX.Element | null {
|
||||
const { userPreferences, updateUserPreferenceInContext } = useAppContext();
|
||||
const { mutate: updateUserPreferenceMutation } = useMutation(
|
||||
updateUserPreferenceAPI,
|
||||
);
|
||||
|
||||
// Source of truth: user-preferences API (loaded once on app init via
|
||||
// AppProvider). Render nothing until it resolves so we never paint the
|
||||
// default colour first and then swap to the user's persisted choice.
|
||||
// AppProvider fires the prefs query as soon as the user is logged in, so
|
||||
// this is usually already settled by the time TraceDetailsV3 mounts.
|
||||
const persistedColorByField = useMemo<TelemetryFieldKey>(() => {
|
||||
const pref = userPreferences?.find(
|
||||
(p) => p.name === USER_PREFERENCES.SPAN_DETAILS_COLOR_BY_ATTRIBUTE,
|
||||
);
|
||||
const name = (pref?.value as string) || '';
|
||||
return COLOR_BY_FIELDS.find((f) => f.name === name) ?? DEFAULT_COLOR_BY_FIELD;
|
||||
}, [userPreferences]);
|
||||
|
||||
const setColorByField = useCallback(
|
||||
(field: TelemetryFieldKey): void => {
|
||||
// Optimistically reflect the choice in the in-memory cache so the UI
|
||||
// reacts immediately (the GET /user/preferences response on app init
|
||||
// always includes the registered key, so `existing` will be defined).
|
||||
const existing = userPreferences?.find(
|
||||
(p) => p.name === USER_PREFERENCES.SPAN_DETAILS_COLOR_BY_ATTRIBUTE,
|
||||
);
|
||||
if (existing) {
|
||||
updateUserPreferenceInContext({ ...existing, value: field.name });
|
||||
}
|
||||
updateUserPreferenceMutation({
|
||||
name: USER_PREFERENCES.SPAN_DETAILS_COLOR_BY_ATTRIBUTE,
|
||||
value: field.name,
|
||||
});
|
||||
},
|
||||
[
|
||||
userPreferences,
|
||||
updateUserPreferenceInContext,
|
||||
updateUserPreferenceMutation,
|
||||
],
|
||||
);
|
||||
|
||||
const previewFields = useMemo<BaseAutocompleteData[]>(() => {
|
||||
const pref = userPreferences?.find(
|
||||
(p) => p.name === USER_PREFERENCES.SPAN_DETAILS_PREVIEW_ATTRIBUTES,
|
||||
);
|
||||
const raw = (pref?.value as BaseAutocompleteData[] | undefined) ?? [];
|
||||
// Defensive: keep only entries that have a string `key`.
|
||||
return raw.filter(
|
||||
(f): f is BaseAutocompleteData =>
|
||||
typeof f === 'object' &&
|
||||
f !== null &&
|
||||
typeof (f as { key?: unknown }).key === 'string',
|
||||
);
|
||||
}, [userPreferences]);
|
||||
|
||||
const setPreviewFields = useCallback(
|
||||
(next: BaseAutocompleteData[]): void => {
|
||||
const existing = userPreferences?.find(
|
||||
(p) => p.name === USER_PREFERENCES.SPAN_DETAILS_PREVIEW_ATTRIBUTES,
|
||||
);
|
||||
if (existing) {
|
||||
updateUserPreferenceInContext({ ...existing, value: next });
|
||||
}
|
||||
updateUserPreferenceMutation({
|
||||
name: USER_PREFERENCES.SPAN_DETAILS_PREVIEW_ATTRIBUTES,
|
||||
value: next,
|
||||
});
|
||||
},
|
||||
[
|
||||
userPreferences,
|
||||
updateUserPreferenceInContext,
|
||||
updateUserPreferenceMutation,
|
||||
],
|
||||
);
|
||||
|
||||
const value = useMemo<TraceContextValue>(() => {
|
||||
const isFieldAvailable = (fieldName: string): boolean => {
|
||||
if (fieldName === DEFAULT_COLOR_BY_FIELD.name) {
|
||||
return true;
|
||||
}
|
||||
// Pick any aggregation type — if execution_time_percentage is empty,
|
||||
// span_count for the same field will be too (both are derived from
|
||||
// the same set of spans).
|
||||
const map = findAggregationMap(
|
||||
aggregations,
|
||||
AGGREGATIONS.EXEC_TIME_PCT,
|
||||
fieldName,
|
||||
);
|
||||
return !!map && Object.keys(map).length > 0;
|
||||
};
|
||||
|
||||
const availableColorByOptions = COLOR_BY_OPTIONS.filter((opt) =>
|
||||
isFieldAvailable(opt.field.name),
|
||||
);
|
||||
|
||||
const colorByField =
|
||||
aggregations === undefined || isFieldAvailable(persistedColorByField.name)
|
||||
? persistedColorByField
|
||||
: DEFAULT_COLOR_BY_FIELD;
|
||||
|
||||
const getAggregationMap = (
|
||||
type: WaterfallAggregationType,
|
||||
): Record<string, number> | undefined =>
|
||||
findAggregationMap(aggregations, type, colorByField.name);
|
||||
|
||||
const getSpanGroupValue = (span: SpanV3): string =>
|
||||
getSpanAttribute(span, colorByField.name) || 'unknown';
|
||||
|
||||
const resolveSpanColor = (span: SpanV3): string => {
|
||||
if (span.has_error) {
|
||||
return 'var(--bg-cherry-500)';
|
||||
}
|
||||
return generateColor(
|
||||
getSpanGroupValue(span),
|
||||
themeColors.traceDetailColorsV3,
|
||||
);
|
||||
};
|
||||
|
||||
return {
|
||||
colorByField,
|
||||
setColorByField,
|
||||
aggregations,
|
||||
getAggregationMap,
|
||||
getSpanGroupValue,
|
||||
resolveSpanColor,
|
||||
availableColorByOptions,
|
||||
previewFields,
|
||||
setPreviewFields,
|
||||
};
|
||||
}, [
|
||||
persistedColorByField,
|
||||
aggregations,
|
||||
setColorByField,
|
||||
previewFields,
|
||||
setPreviewFields,
|
||||
]);
|
||||
|
||||
if (!userPreferences) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <TraceContext.Provider value={value}>{children}</TraceContext.Provider>;
|
||||
}
|
||||
|
||||
export function useTraceContext(): TraceContextValue {
|
||||
const ctx = useContext(TraceContext);
|
||||
if (!ctx) {
|
||||
throw new Error('useTraceContext must be used inside TraceProvider');
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useMutation } from 'react-query';
|
||||
import updateUserPreferenceAPI from 'api/v1/user/preferences/name/update';
|
||||
import { USER_PREFERENCES } from 'constants/userPreferences';
|
||||
import { isV3PinnedAttribute } from 'pages/TraceDetailsV3/utils';
|
||||
import { serializeKeyPath } from 'periscope/components/PrettyView/utils';
|
||||
import { useAppContext } from 'providers/App/App';
|
||||
import { SpanV3 } from 'types/api/trace/getTraceV3';
|
||||
|
||||
/**
|
||||
* V2 stored pinned attributes as flat strings (`["http.method"]`).
|
||||
* V3 stores nested key paths (`['["attributes","http.method"]']`).
|
||||
*
|
||||
* On first load with both `userPreferences` and `selectedSpan` available,
|
||||
* detect a V2-format value in the backend pref and convert it to V3 paths
|
||||
* using the loaded span's shape. Idempotent: once written in V3 format the
|
||||
* format check on subsequent loads short-circuits.
|
||||
*
|
||||
* Unmappable keys (not present on the loaded span) are dropped — we can't
|
||||
* determine whether they belong under `attributes`, `resource`, or top-level.
|
||||
*/
|
||||
export function useMigratePinnedAttributes(
|
||||
selectedSpan: SpanV3 | undefined,
|
||||
): void {
|
||||
const { userPreferences, updateUserPreferenceInContext } = useAppContext();
|
||||
const { mutate } = useMutation(updateUserPreferenceAPI);
|
||||
const ranRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (ranRef.current) {
|
||||
return;
|
||||
}
|
||||
if (!userPreferences || !selectedSpan) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pref = userPreferences.find(
|
||||
(p) => p.name === USER_PREFERENCES.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
);
|
||||
const value = (pref?.value as string[] | undefined) ?? [];
|
||||
if (value.length === 0) {
|
||||
ranRef.current = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Walk every entry — the array may be mixed (e.g. some legacy V2 flat
|
||||
// keys saved alongside V3 paths). V3 entries pass through unchanged;
|
||||
// V2 entries get converted via the loaded span; unmappable V2 entries
|
||||
// are dropped. We only persist when at least one V2 entry was found
|
||||
// (otherwise the input is already V3-clean).
|
||||
const next: string[] = [];
|
||||
let hadV2Entry = false;
|
||||
|
||||
for (const entry of value) {
|
||||
if (isV3PinnedAttribute(entry)) {
|
||||
next.push(entry);
|
||||
continue;
|
||||
}
|
||||
hadV2Entry = true;
|
||||
const path = v2KeyToPath(entry, selectedSpan);
|
||||
if (path) {
|
||||
next.push(serializeKeyPath(path));
|
||||
}
|
||||
// else: unmappable on the loaded span — drop
|
||||
}
|
||||
|
||||
if (!hadV2Entry) {
|
||||
ranRef.current = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pref) {
|
||||
updateUserPreferenceInContext({ ...pref, value: next });
|
||||
}
|
||||
mutate(
|
||||
{
|
||||
name: USER_PREFERENCES.SPAN_DETAILS_PINNED_ATTRIBUTES,
|
||||
value: next,
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
ranRef.current = true;
|
||||
},
|
||||
onError: () => {
|
||||
// Roll back the optimistic context update
|
||||
if (pref) {
|
||||
updateUserPreferenceInContext({ ...pref, value });
|
||||
}
|
||||
},
|
||||
},
|
||||
);
|
||||
}, [userPreferences, selectedSpan, updateUserPreferenceInContext, mutate]);
|
||||
}
|
||||
|
||||
function v2KeyToPath(key: string, span: SpanV3): (string | number)[] | null {
|
||||
if (span.attributes && key in span.attributes) {
|
||||
return ['attributes', key];
|
||||
}
|
||||
if (span.resource && key in span.resource) {
|
||||
return ['resource', key];
|
||||
}
|
||||
if (key in (span as unknown as Record<string, unknown>)) {
|
||||
return [key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -12,23 +12,16 @@ import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
||||
import useUrlQuery from 'hooks/useUrlQuery';
|
||||
import NoData from 'pages/TraceDetailV2/NoData/NoData';
|
||||
import { ResizableBox } from 'periscope/components/ResizableBox';
|
||||
import {
|
||||
SpanV3,
|
||||
TraceDetailV3URLProps,
|
||||
WaterfallAggregationRequest,
|
||||
} from 'types/api/trace/getTraceV3';
|
||||
import { SpanV3, TraceDetailV3URLProps } from 'types/api/trace/getTraceV3';
|
||||
|
||||
import { COLOR_BY_FIELDS } from './constants';
|
||||
import { TraceProvider } from './contexts/TraceContext';
|
||||
import { AGGREGATIONS } from './utils/aggregations';
|
||||
import { SpanDetailVariant } from './SpanDetailsPanel/constants';
|
||||
import SpanDetailsPanel from './SpanDetailsPanel/SpanDetailsPanel';
|
||||
import type { TraceMetadataForHeader } from './TraceDetailsHeader/TraceDetailsHeader';
|
||||
import TraceDetailsHeader from './TraceDetailsHeader/TraceDetailsHeader';
|
||||
import { FLAMEGRAPH_SPAN_LIMIT } from './TraceFlamegraph/constants';
|
||||
import TraceFlamegraph from './TraceFlamegraph/TraceFlamegraph';
|
||||
import TraceWaterfall from './TraceWaterfall/TraceWaterfall';
|
||||
import { IInterestedSpan } from './TraceWaterfall/types';
|
||||
import TraceWaterfall, {
|
||||
IInterestedSpan,
|
||||
} from './TraceWaterfall/TraceWaterfall';
|
||||
import { getAncestorSpanIds } from './TraceWaterfall/utils';
|
||||
|
||||
import './TraceDetailsV3.styles.scss';
|
||||
@@ -86,17 +79,6 @@ function TraceDetailsV3(): JSX.Element {
|
||||
});
|
||||
}, [urlQuery]);
|
||||
|
||||
// Hardcoded for now — fetch aggregations for all 3 candidate color-by fields
|
||||
// upfront so a future color-by-field switch doesn't need to refetch.
|
||||
const waterfallAggregationsRequest = useMemo<WaterfallAggregationRequest[]>(
|
||||
() =>
|
||||
COLOR_BY_FIELDS.flatMap((field) => [
|
||||
{ field, aggregation: AGGREGATIONS.EXEC_TIME_PCT },
|
||||
{ field, aggregation: AGGREGATIONS.SPAN_COUNT },
|
||||
]),
|
||||
[],
|
||||
);
|
||||
|
||||
// Once all spans are loaded (frontend mode), freeze query params so
|
||||
// subsequent interestedSpanId changes don't trigger unnecessary refetches.
|
||||
const fullDataLoadedRef = useRef(false);
|
||||
@@ -104,7 +86,6 @@ function TraceDetailsV3(): JSX.Element {
|
||||
selectedSpanId: interestedSpanId.spanId,
|
||||
isSelectedSpanIDUnCollapsed: interestedSpanId.isUncollapsed,
|
||||
uncollapsedSpans: uncollapsedNodes,
|
||||
aggregations: waterfallAggregationsRequest,
|
||||
});
|
||||
|
||||
const queryParams = fullDataLoadedRef.current
|
||||
@@ -113,7 +94,6 @@ function TraceDetailsV3(): JSX.Element {
|
||||
selectedSpanId: interestedSpanId.spanId,
|
||||
isSelectedSpanIDUnCollapsed: interestedSpanId.isUncollapsed,
|
||||
uncollapsedSpans: uncollapsedNodes,
|
||||
aggregations: waterfallAggregationsRequest,
|
||||
};
|
||||
|
||||
const {
|
||||
@@ -125,7 +105,6 @@ function TraceDetailsV3(): JSX.Element {
|
||||
uncollapsedSpans: queryParams.uncollapsedSpans,
|
||||
selectedSpanId: queryParams.selectedSpanId,
|
||||
isSelectedSpanIDUnCollapsed: queryParams.isSelectedSpanIDUnCollapsed,
|
||||
aggregations: queryParams.aggregations,
|
||||
});
|
||||
|
||||
const allSpans = traceData?.payload?.spans || [];
|
||||
@@ -140,7 +119,6 @@ function TraceDetailsV3(): JSX.Element {
|
||||
selectedSpanId: interestedSpanId.spanId,
|
||||
isSelectedSpanIDUnCollapsed: interestedSpanId.isUncollapsed,
|
||||
uncollapsedSpans: uncollapsedNodes,
|
||||
aggregations: waterfallAggregationsRequest,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -235,23 +213,6 @@ function TraceDetailsV3(): JSX.Element {
|
||||
],
|
||||
);
|
||||
|
||||
const traceMetadataForHeader = useMemo(():
|
||||
| TraceMetadataForHeader
|
||||
| undefined => {
|
||||
const payload = traceData?.payload;
|
||||
if (!payload) {
|
||||
return undefined;
|
||||
}
|
||||
const rootSpan = payload.spans?.find((s) => s.level === 0);
|
||||
return {
|
||||
startTimestampMillis: payload.startTimestampMillis,
|
||||
endTimestampMillis: payload.endTimestampMillis,
|
||||
rootServiceName: payload.rootServiceName,
|
||||
rootServiceEntryPoint: payload.rootServiceEntryPoint,
|
||||
rootSpanStatusCode: rootSpan?.response_status_code || '',
|
||||
};
|
||||
}, [traceData?.payload]);
|
||||
|
||||
const showNoData =
|
||||
!isFetchingTraceData &&
|
||||
(!!errorFetchingTraceData || !traceData?.payload?.spans?.length);
|
||||
@@ -285,116 +246,104 @@ function TraceDetailsV3(): JSX.Element {
|
||||
);
|
||||
|
||||
return (
|
||||
<TraceProvider aggregations={traceData?.payload?.aggregations}>
|
||||
<div className="trace-details-v3">
|
||||
<TraceDetailsHeader
|
||||
filterMetadata={filterMetadata}
|
||||
onFilteredSpansChange={handleFilteredSpansChange}
|
||||
isDataLoaded={!!traceData?.payload?.spans?.length && !showNoData}
|
||||
traceMetadata={traceMetadataForHeader}
|
||||
/>
|
||||
<div className="trace-details-v3">
|
||||
<TraceDetailsHeader
|
||||
filterMetadata={filterMetadata}
|
||||
onFilteredSpansChange={handleFilteredSpansChange}
|
||||
noData={showNoData}
|
||||
/>
|
||||
|
||||
{showNoData ? (
|
||||
<NoData />
|
||||
) : (
|
||||
<>
|
||||
<div className="trace-details-v3__content">
|
||||
<Collapse
|
||||
// @ts-expect-error motion is passed through to rc-collapse to disable animation
|
||||
motion={false}
|
||||
activeKey={activeKeys.filter((k) => k === 'flame')}
|
||||
onChange={(): void => handleCollapseChange('flame')}
|
||||
size="small"
|
||||
className="trace-details-v3__flame-collapse"
|
||||
items={[
|
||||
{
|
||||
key: 'flame',
|
||||
label: (
|
||||
<div className="trace-details-v3__collapse-label">
|
||||
<span>Flame Graph</span>
|
||||
{traceData?.payload?.totalSpansCount ? (
|
||||
<span className="trace-details-v3__collapse-count">
|
||||
<span>Spans: {traceData.payload.totalSpansCount}</span>
|
||||
<span
|
||||
className={
|
||||
traceData.payload.totalErrorSpansCount > 0
|
||||
? 'trace-details-v3__collapse-count-errors'
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
Errors: {traceData.payload.totalErrorSpansCount ?? 0}
|
||||
</span>
|
||||
{traceData.payload.totalSpansCount > FLAMEGRAPH_SPAN_LIMIT && (
|
||||
<WarningPopover
|
||||
message="The total span count exceeds the visualization limit. Displaying a sampled subset of spans in flamegraph."
|
||||
placement="bottomRight"
|
||||
autoAdjustOverflow={false}
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
),
|
||||
children: (
|
||||
<ResizableBox defaultHeight={300} minHeight={100} maxHeight={400}>
|
||||
<TraceFlamegraph
|
||||
filteredSpanIds={filteredSpanIds}
|
||||
isFilterActive={isFilterActive}
|
||||
/>
|
||||
</ResizableBox>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{showNoData ? (
|
||||
<NoData />
|
||||
) : (
|
||||
<>
|
||||
<div className="trace-details-v3__content">
|
||||
<Collapse
|
||||
// @ts-expect-error motion is passed through to rc-collapse to disable animation
|
||||
motion={false}
|
||||
activeKey={activeKeys.filter((k) => k === 'flame')}
|
||||
onChange={(): void => handleCollapseChange('flame')}
|
||||
size="small"
|
||||
className="trace-details-v3__flame-collapse"
|
||||
items={[
|
||||
{
|
||||
key: 'flame',
|
||||
label: (
|
||||
<div className="trace-details-v3__collapse-label">
|
||||
<span>Flame Graph</span>
|
||||
{traceData?.payload?.totalSpansCount ? (
|
||||
<span className="trace-details-v3__collapse-count">
|
||||
{traceData.payload.totalSpansCount} spans
|
||||
{traceData.payload.totalSpansCount > FLAMEGRAPH_SPAN_LIMIT && (
|
||||
<WarningPopover
|
||||
message="The total span count exceeds the visualization limit. Displaying a sampled subset of spans."
|
||||
placement="bottomRight"
|
||||
autoAdjustOverflow={false}
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
),
|
||||
children: (
|
||||
<ResizableBox defaultHeight={300} minHeight={100} maxHeight={400}>
|
||||
<TraceFlamegraph
|
||||
filteredSpanIds={filteredSpanIds}
|
||||
isFilterActive={isFilterActive}
|
||||
/>
|
||||
</ResizableBox>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<Collapse
|
||||
// @ts-expect-error motion is passed through to rc-collapse to disable animation
|
||||
motion={false}
|
||||
activeKey={activeKeys.filter((k) => k === 'waterfall')}
|
||||
onChange={(): void => handleCollapseChange('waterfall')}
|
||||
size="small"
|
||||
className={`trace-details-v3__waterfall-collapse${
|
||||
isWaterfallDocked
|
||||
? ' trace-details-v3__waterfall-collapse--docked'
|
||||
: ''
|
||||
}`}
|
||||
items={[
|
||||
{
|
||||
key: 'waterfall',
|
||||
label: 'Waterfall',
|
||||
children: activeKeys.includes('waterfall') ? waterfallChildren : null,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Collapse
|
||||
// @ts-expect-error motion is passed through to rc-collapse to disable animation
|
||||
motion={false}
|
||||
activeKey={activeKeys.filter((k) => k === 'waterfall')}
|
||||
onChange={(): void => handleCollapseChange('waterfall')}
|
||||
size="small"
|
||||
className={`trace-details-v3__waterfall-collapse${
|
||||
isWaterfallDocked ? ' trace-details-v3__waterfall-collapse--docked' : ''
|
||||
}`}
|
||||
items={[
|
||||
{
|
||||
key: 'waterfall',
|
||||
label: 'Waterfall',
|
||||
children: activeKeys.includes('waterfall') ? waterfallChildren : null,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
{panelState.isOpen && isDocked && (
|
||||
<div className="trace-details-v3__docked-span-details">
|
||||
<SpanDetailsPanel
|
||||
panelState={panelState}
|
||||
selectedSpan={selectedSpan}
|
||||
variant={SpanDetailVariant.DOCKED}
|
||||
onVariantChange={handleVariantChange}
|
||||
traceStartTime={traceData?.payload?.startTimestampMillis}
|
||||
traceEndTime={traceData?.payload?.endTimestampMillis}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{panelState.isOpen && !isDocked && (
|
||||
<SpanDetailsPanel
|
||||
panelState={panelState}
|
||||
selectedSpan={selectedSpan}
|
||||
variant={SpanDetailVariant.DIALOG}
|
||||
onVariantChange={handleVariantChange}
|
||||
traceStartTime={traceData?.payload?.startTimestampMillis}
|
||||
traceEndTime={traceData?.payload?.endTimestampMillis}
|
||||
/>
|
||||
{panelState.isOpen && isDocked && (
|
||||
<div className="trace-details-v3__docked-span-details">
|
||||
<SpanDetailsPanel
|
||||
panelState={panelState}
|
||||
selectedSpan={selectedSpan}
|
||||
variant={SpanDetailVariant.DOCKED}
|
||||
onVariantChange={handleVariantChange}
|
||||
traceStartTime={traceData?.payload?.startTimestampMillis}
|
||||
traceEndTime={traceData?.payload?.endTimestampMillis}
|
||||
serviceExecTime={traceData?.payload?.serviceNameToTotalDurationMap}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</TraceProvider>
|
||||
</div>
|
||||
|
||||
{panelState.isOpen && !isDocked && (
|
||||
<SpanDetailsPanel
|
||||
panelState={panelState}
|
||||
selectedSpan={selectedSpan}
|
||||
variant={SpanDetailVariant.DIALOG}
|
||||
onVariantChange={handleVariantChange}
|
||||
traceStartTime={traceData?.payload?.startTimestampMillis}
|
||||
traceEndTime={traceData?.payload?.endTimestampMillis}
|
||||
serviceExecTime={traceData?.payload?.serviceNameToTotalDurationMap}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,17 +3,10 @@ import { SpanV3 } from 'types/api/trace/getTraceV3';
|
||||
/**
|
||||
* Look up an attribute from both `resource` and `attributes` on a span.
|
||||
* Resources are checked first (service.name, k8s.* etc. live there).
|
||||
*
|
||||
* Accepts both `SpanV3` (waterfall) and `FlamegraphSpan` (flamegraph) by typing
|
||||
* structurally — the only fields touched are `resource` and `attributes`.
|
||||
*
|
||||
* TODO: Remove tagMap fallback when phasing out V2
|
||||
*/
|
||||
export function getSpanAttribute(
|
||||
span: {
|
||||
resource?: Record<string, string>;
|
||||
attributes?: Record<string, any>;
|
||||
},
|
||||
span: SpanV3,
|
||||
key: string,
|
||||
): string | undefined {
|
||||
return (
|
||||
@@ -38,40 +31,3 @@ export function hasInfraMetadata(span: SpanV3 | undefined): boolean {
|
||||
}
|
||||
return INFRA_METADATA_KEYS.some((key) => getSpanAttribute(span, key));
|
||||
}
|
||||
|
||||
// Top-level fields that exist on the API response only to support waterfall
|
||||
// rendering. They have no value in the Span Details DataViewer. Drop the whole
|
||||
// constant + helper once the backend stops emitting them.
|
||||
const HIDDEN_SPAN_FIELDS_IN_DETAILS_VIEW: ReadonlySet<string> = new Set([
|
||||
'sub_tree_node_count',
|
||||
'has_children',
|
||||
'level',
|
||||
'service.name',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Shallow-copies the span with waterfall-only fields stripped, for display in
|
||||
* the Span Details DataViewer.
|
||||
*/
|
||||
export function getSpanDisplayData(span: SpanV3): Record<string, unknown> {
|
||||
const result: Record<string, unknown> = {};
|
||||
for (const [key, value] of Object.entries(span)) {
|
||||
if (!HIDDEN_SPAN_FIELDS_IN_DETAILS_VIEW.has(key)) {
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* V3 pinned-attribute entries are JSON-stringified arrays (e.g.
|
||||
* `'["attributes","http.method"]'`). Legacy V2 entries are flat strings.
|
||||
* Used to distinguish V3 from V2 entries when reading the persisted value.
|
||||
*/
|
||||
export function isV3PinnedAttribute(entry: string): boolean {
|
||||
try {
|
||||
return Array.isArray(JSON.parse(entry));
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import {
|
||||
WaterfallAggregationResponse,
|
||||
WaterfallAggregationType,
|
||||
} from 'types/api/trace/getTraceV3';
|
||||
|
||||
export const AGGREGATIONS = {
|
||||
EXEC_TIME_PCT: 'execution_time_percentage',
|
||||
SPAN_COUNT: 'span_count',
|
||||
DURATION: 'duration',
|
||||
} as const satisfies Record<string, WaterfallAggregationType>;
|
||||
|
||||
export function getAggregationMap(
|
||||
aggregations: WaterfallAggregationResponse[] | undefined,
|
||||
type: WaterfallAggregationType,
|
||||
fieldName: string,
|
||||
): Record<string, number> | undefined {
|
||||
return aggregations?.find(
|
||||
(a) => a.aggregation === type && a.field.name === fieldName,
|
||||
)?.value;
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
import {
|
||||
BaseAutocompleteData,
|
||||
DataTypes,
|
||||
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
import {
|
||||
FieldContext,
|
||||
FieldDataType,
|
||||
TelemetryFieldKey,
|
||||
} from 'types/api/v5/queryRange';
|
||||
|
||||
/**
|
||||
* Map the picker's `BaseAutocompleteData.type` (`'tag' | 'resource' | '' | null`)
|
||||
* to the API's `FieldContext`. Unknown values fall back to `'attribute'`.
|
||||
*/
|
||||
function mapFieldContext(type: BaseAutocompleteData['type']): FieldContext {
|
||||
if (type === 'resource') {
|
||||
return 'resource';
|
||||
}
|
||||
return 'attribute';
|
||||
}
|
||||
|
||||
const DATA_TYPE_MAP: Record<DataTypes, FieldDataType> = {
|
||||
[DataTypes.String]: 'string',
|
||||
[DataTypes.bool]: 'bool',
|
||||
[DataTypes.Int64]: 'int64',
|
||||
[DataTypes.Float64]: 'float64',
|
||||
[DataTypes.ArrayString]: '[]string',
|
||||
[DataTypes.ArrayBool]: '[]bool',
|
||||
[DataTypes.ArrayInt64]: '[]int64',
|
||||
[DataTypes.ArrayFloat64]: '[]float64',
|
||||
[DataTypes.EMPTY]: 'string',
|
||||
};
|
||||
|
||||
function mapFieldDataType(
|
||||
dataType: BaseAutocompleteData['dataType'],
|
||||
): FieldDataType {
|
||||
if (!dataType) {
|
||||
return 'string';
|
||||
}
|
||||
return DATA_TYPE_MAP[dataType] ?? 'string';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a picker-shaped field to the API's `TelemetryFieldKey` shape used
|
||||
* for `selectFields` on the flamegraph request.
|
||||
*/
|
||||
export function toTelemetryFieldKey(
|
||||
field: BaseAutocompleteData,
|
||||
): TelemetryFieldKey {
|
||||
return {
|
||||
name: field.key,
|
||||
fieldContext: mapFieldContext(field.type),
|
||||
fieldDataType: mapFieldDataType(field.dataType),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge two `TelemetryFieldKey` lists, de-duping by `name`. Earlier entries win
|
||||
* (so callers can pass user-controlled fields after a baseline list and have
|
||||
* the baseline's metadata be preserved).
|
||||
*/
|
||||
export function mergeTelemetryFieldKeys(
|
||||
...lists: TelemetryFieldKey[][]
|
||||
): TelemetryFieldKey[] {
|
||||
const seen = new Set<string>();
|
||||
const out: TelemetryFieldKey[] = [];
|
||||
for (const list of lists) {
|
||||
for (const f of list) {
|
||||
if (seen.has(f.name)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(f.name);
|
||||
out.push(f);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -23,14 +23,7 @@ const editorOptions: EditorProps['options'] = {
|
||||
lineHeight: 18,
|
||||
colorDecorators: true,
|
||||
scrollBeyondLastLine: false,
|
||||
scrollbar: {
|
||||
vertical: 'hidden',
|
||||
horizontal: 'hidden',
|
||||
// Once the editor can't scroll any further, release the wheel event so
|
||||
// the parent container picks it up. Without this Monaco swallows the
|
||||
// event at the boundary and outer scroll feels stuck.
|
||||
alwaysConsumeMouseWheel: false,
|
||||
},
|
||||
scrollbar: { vertical: 'hidden', horizontal: 'hidden' },
|
||||
folding: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -56,13 +56,6 @@ export interface PrettyViewProps {
|
||||
searchable?: boolean;
|
||||
showPinned?: boolean;
|
||||
drawerKey?: string;
|
||||
/**
|
||||
* Controlled list of pinned key paths (each entry is `JSON.stringify(path)`).
|
||||
* When provided, PrettyView delegates persistence to the caller via
|
||||
* `onPinnedFieldsChange` and skips its own localStorage I/O.
|
||||
*/
|
||||
pinnedFieldsValue?: string[];
|
||||
onPinnedFieldsChange?: (next: string[]) => void;
|
||||
}
|
||||
|
||||
function PrettyView({
|
||||
@@ -72,8 +65,6 @@ function PrettyView({
|
||||
searchable = true,
|
||||
showPinned = false,
|
||||
drawerKey = 'default',
|
||||
pinnedFieldsValue,
|
||||
onPinnedFieldsChange,
|
||||
}: PrettyViewProps): JSX.Element {
|
||||
const isDarkMode = useIsDarkMode();
|
||||
const [, setCopy] = useCopyToClipboard();
|
||||
@@ -84,10 +75,7 @@ function PrettyView({
|
||||
pinnedEntries,
|
||||
pinnedData,
|
||||
displayKeyToForwardPath,
|
||||
} = usePinnedFields(data, drawerKey, {
|
||||
value: pinnedFieldsValue,
|
||||
onChange: onPinnedFieldsChange,
|
||||
});
|
||||
} = usePinnedFields(data, drawerKey);
|
||||
|
||||
const filteredPinnedData = useMemo(() => {
|
||||
const trimmed = searchQuery.trim();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user