mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 21:45:56 +08:00
feat: tree is updated to show different node values instead of editor (#2696)
* feat: tree is updated to show different node values instead of editor * chore: table view is updated * [Refactoring]: Seperate title and menu to another component (#3531) * refactor: separated the title renderer * refactor: separated styles * refactor: seperate types * refactor: instead of key showing value if array (#3532) * refactor: instead of key showing value if array * feat: added filter for array and also nodekey * refactor: made common check for value is array * refactor: changed the key to value for arrays * chore: getData types is updated * chore: getDataTypes function types is updated * refactor: connection to querybuilder (#3535) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * chore: operator is updated * fix: build is fixed * fix: build is fixed * chore: operator is updated * chore: operator is updated * chore: parsing is updated * chore: key is updated * Refactor: Log parsing updates (#3542) * refactor: updated nodekey * refactor: removed pasred data * refactor: parentIsArray check * chore: added the support for the bool * [Refactor]: handle nested object case (#3545) * refactor: updated nodekey * refactor: removed pasred data * refactor: parentIsArray check * refactor: handled nested array inside object case * fix: float issue parsing * chore: operator is updated * chore: title is updated * chore: title is updated * fix: update tagRegexp * fix: maintain single source of DataTypes * chore: operator is updated * fix: fixed due to merge conflicts --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus A M <myounis.ar@live.com>
This commit is contained in:
parent
72f4578152
commit
56f1f71461
@ -4,6 +4,7 @@ import { createNewBuilderItemName } from 'lib/newQueryBuilder/createNewBuilderIt
|
|||||||
import {
|
import {
|
||||||
AutocompleteType,
|
AutocompleteType,
|
||||||
BaseAutocompleteData,
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
LocalDataType,
|
LocalDataType,
|
||||||
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import {
|
import {
|
||||||
@ -46,7 +47,7 @@ export const selectValueDivider = '__';
|
|||||||
|
|
||||||
export const baseAutoCompleteIdKeysOrder: (keyof Omit<
|
export const baseAutoCompleteIdKeysOrder: (keyof Omit<
|
||||||
BaseAutocompleteData,
|
BaseAutocompleteData,
|
||||||
'id'
|
'id' | 'isJSON'
|
||||||
>)[] = ['key', 'dataType', 'type', 'isColumn'];
|
>)[] = ['key', 'dataType', 'type', 'isColumn'];
|
||||||
|
|
||||||
export const autocompleteType: Record<AutocompleteType, AutocompleteType> = {
|
export const autocompleteType: Record<AutocompleteType, AutocompleteType> = {
|
||||||
@ -112,10 +113,11 @@ export const initialAutocompleteData: BaseAutocompleteData = {
|
|||||||
{ dataType: null, key: '', isColumn: null, type: null },
|
{ dataType: null, key: '', isColumn: null, type: null },
|
||||||
baseAutoCompleteIdKeysOrder,
|
baseAutoCompleteIdKeysOrder,
|
||||||
),
|
),
|
||||||
dataType: '',
|
dataType: DataTypes.EMPTY,
|
||||||
key: '',
|
key: '',
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: '',
|
type: '',
|
||||||
|
isJSON: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initialFilters: TagFilter = {
|
export const initialFilters: TagFilter = {
|
||||||
@ -273,6 +275,8 @@ export const OPERATORS = {
|
|||||||
'>': '>',
|
'>': '>',
|
||||||
'<=': '<=',
|
'<=': '<=',
|
||||||
'<': '<',
|
'<': '<',
|
||||||
|
HAS: 'HAS',
|
||||||
|
NHAS: 'NHAS',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const QUERY_BUILDER_OPERATORS_BY_TYPES = {
|
export const QUERY_BUILDER_OPERATORS_BY_TYPES = {
|
||||||
|
@ -4,6 +4,7 @@ import { useOrderByFilter } from 'container/QueryBuilder/filters/OrderByFilter/u
|
|||||||
import { selectStyle } from 'container/QueryBuilder/filters/QueryBuilderSearch/config';
|
import { selectStyle } from 'container/QueryBuilder/filters/QueryBuilderSearch/config';
|
||||||
import { useGetAggregateKeys } from 'hooks/queryBuilder/useGetAggregateKeys';
|
import { useGetAggregateKeys } from 'hooks/queryBuilder/useGetAggregateKeys';
|
||||||
import { memo, useMemo } from 'react';
|
import { memo, useMemo } from 'react';
|
||||||
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { StringOperators } from 'types/common/queryBuilder';
|
import { StringOperators } from 'types/common/queryBuilder';
|
||||||
|
|
||||||
function ExplorerOrderBy({ query, onChange }: OrderByFilterProps): JSX.Element {
|
function ExplorerOrderBy({ query, onChange }: OrderByFilterProps): JSX.Element {
|
||||||
@ -33,7 +34,7 @@ function ExplorerOrderBy({ query, onChange }: OrderByFilterProps): JSX.Element {
|
|||||||
const keysOptions = createOptions(data?.payload?.attributeKeys || []);
|
const keysOptions = createOptions(data?.payload?.attributeKeys || []);
|
||||||
|
|
||||||
const customOptions = createOptions([
|
const customOptions = createOptions([
|
||||||
{ key: 'timestamp', isColumn: true, type: '', dataType: '' },
|
{ key: 'timestamp', isColumn: true, type: '', dataType: DataTypes.EMPTY },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const baseOptions = [
|
const baseOptions = [
|
||||||
|
@ -3,7 +3,10 @@ import {
|
|||||||
initialQueryBuilderFormValuesMap,
|
initialQueryBuilderFormValuesMap,
|
||||||
} from 'constants/queryBuilder';
|
} from 'constants/queryBuilder';
|
||||||
import { FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
|
import { FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { IBuilderQuery, Query } from 'types/api/queryBuilder/queryBuilderData';
|
import { IBuilderQuery, Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { LogsAggregatorOperator } from 'types/common/queryBuilder';
|
import { LogsAggregatorOperator } from 'types/common/queryBuilder';
|
||||||
|
|
||||||
@ -45,6 +48,6 @@ export const liveLogsCompositeQuery = constructCompositeQuery({
|
|||||||
export const idObject: BaseAutocompleteData = {
|
export const idObject: BaseAutocompleteData = {
|
||||||
key: 'id',
|
key: 'id',
|
||||||
type: '',
|
type: '',
|
||||||
dataType: 'string',
|
dataType: DataTypes.String,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
export const TitleWrapper = styled.span`
|
||||||
|
.hover-reveal {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover .hover-reveal {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
`;
|
89
frontend/src/container/LogDetailedView/BodyTitleRenderer.tsx
Normal file
89
frontend/src/container/LogDetailedView/BodyTitleRenderer.tsx
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
import { orange } from '@ant-design/colors';
|
||||||
|
import { SettingOutlined } from '@ant-design/icons';
|
||||||
|
import { Dropdown, MenuProps } from 'antd';
|
||||||
|
import { OPERATORS } from 'constants/queryBuilder';
|
||||||
|
import { useActiveLog } from 'hooks/logs/useActiveLog';
|
||||||
|
|
||||||
|
import { TitleWrapper } from './BodyTitleRenderer.styles';
|
||||||
|
import { DROPDOWN_KEY } from './constant';
|
||||||
|
import { BodyTitleRendererProps } from './LogDetailedView.types';
|
||||||
|
import {
|
||||||
|
generateFieldKeyForArray,
|
||||||
|
getDataTypes,
|
||||||
|
removeObjectFromString,
|
||||||
|
} from './utils';
|
||||||
|
|
||||||
|
function BodyTitleRenderer({
|
||||||
|
title,
|
||||||
|
parentIsArray = false,
|
||||||
|
nodeKey,
|
||||||
|
value,
|
||||||
|
}: BodyTitleRendererProps): JSX.Element {
|
||||||
|
const { onAddToQuery } = useActiveLog();
|
||||||
|
|
||||||
|
const filterHandler = (isFilterIn: boolean) => (): void => {
|
||||||
|
if (parentIsArray) {
|
||||||
|
onAddToQuery(
|
||||||
|
generateFieldKeyForArray(
|
||||||
|
removeObjectFromString(nodeKey),
|
||||||
|
getDataTypes(value),
|
||||||
|
),
|
||||||
|
`${value}`,
|
||||||
|
isFilterIn ? OPERATORS.HAS : OPERATORS.NHAS,
|
||||||
|
true,
|
||||||
|
parentIsArray ? getDataTypes([value]) : getDataTypes(value),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
onAddToQuery(
|
||||||
|
`body.${removeObjectFromString(nodeKey)}`,
|
||||||
|
`${value}`,
|
||||||
|
isFilterIn ? OPERATORS['='] : OPERATORS['!='],
|
||||||
|
true,
|
||||||
|
getDataTypes(value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onClickHandler: MenuProps['onClick'] = (props): void => {
|
||||||
|
const mapper = {
|
||||||
|
[DROPDOWN_KEY.FILTER_IN]: filterHandler(true),
|
||||||
|
[DROPDOWN_KEY.FILTER_OUT]: filterHandler(false),
|
||||||
|
};
|
||||||
|
|
||||||
|
const handler = mapper[props.key];
|
||||||
|
|
||||||
|
if (handler) {
|
||||||
|
handler();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const menu: MenuProps = {
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
key: DROPDOWN_KEY.FILTER_IN,
|
||||||
|
label: `Filter for ${value}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: DROPDOWN_KEY.FILTER_OUT,
|
||||||
|
label: `Filter out ${value}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
onClick: onClickHandler,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TitleWrapper>
|
||||||
|
<Dropdown menu={menu} trigger={['click']}>
|
||||||
|
<SettingOutlined style={{ marginRight: 8 }} className="hover-reveal" />
|
||||||
|
</Dropdown>
|
||||||
|
{title.toString()}{' '}
|
||||||
|
{!parentIsArray && (
|
||||||
|
<span>
|
||||||
|
: <span style={{ color: orange[6] }}>{`${value}`}</span>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</TitleWrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BodyTitleRenderer;
|
@ -1,5 +1,14 @@
|
|||||||
import { MetricsType } from 'container/MetricsApplication/constant';
|
import { MetricsType } from 'container/MetricsApplication/constant';
|
||||||
|
|
||||||
|
export interface BodyTitleRendererProps {
|
||||||
|
title: string;
|
||||||
|
nodeKey: string;
|
||||||
|
value: unknown;
|
||||||
|
parentIsArray?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AnyObject = { [key: string]: any };
|
||||||
|
|
||||||
export interface FieldRendererProps {
|
export interface FieldRendererProps {
|
||||||
field: string;
|
field: string;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { orange } from '@ant-design/colors';
|
import { orange } from '@ant-design/colors';
|
||||||
import { LinkOutlined } from '@ant-design/icons';
|
import { LinkOutlined } from '@ant-design/icons';
|
||||||
import { Input, Space, Tooltip } from 'antd';
|
import { Input, Space, Tooltip, Tree } from 'antd';
|
||||||
import { ColumnsType } from 'antd/es/table';
|
import { ColumnsType } from 'antd/es/table';
|
||||||
import Editor from 'components/Editor';
|
|
||||||
import AddToQueryHOC, {
|
import AddToQueryHOC, {
|
||||||
AddToQueryHOCProps,
|
AddToQueryHOCProps,
|
||||||
} from 'components/Logs/AddToQueryHOC';
|
} from 'components/Logs/AddToQueryHOC';
|
||||||
@ -22,7 +21,7 @@ import { ILog } from 'types/api/logs/log';
|
|||||||
|
|
||||||
import ActionItem, { ActionItemProps } from './ActionItem';
|
import ActionItem, { ActionItemProps } from './ActionItem';
|
||||||
import FieldRenderer from './FieldRenderer';
|
import FieldRenderer from './FieldRenderer';
|
||||||
import { flattenObject, recursiveParseJSON } from './utils';
|
import { flattenObject, jsonToDataNodes, recursiveParseJSON } from './utils';
|
||||||
|
|
||||||
// Fields which should be restricted from adding it to query
|
// Fields which should be restricted from adding it to query
|
||||||
const RESTRICTED_FIELDS = ['timestamp'];
|
const RESTRICTED_FIELDS = ['timestamp'];
|
||||||
@ -168,18 +167,7 @@ function TableView({
|
|||||||
if (record.field === 'body') {
|
if (record.field === 'body') {
|
||||||
const parsedBody = recursiveParseJSON(field);
|
const parsedBody = recursiveParseJSON(field);
|
||||||
if (!isEmpty(parsedBody)) {
|
if (!isEmpty(parsedBody)) {
|
||||||
return (
|
return <Tree showLine treeData={jsonToDataNodes(parsedBody)} />;
|
||||||
<Editor
|
|
||||||
value={JSON.stringify(parsedBody, null, 2).replace(/\\n/g, '\n')}
|
|
||||||
readOnly
|
|
||||||
height="70vh"
|
|
||||||
options={{
|
|
||||||
minimap: {
|
|
||||||
enabled: false,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
frontend/src/container/LogDetailedView/constant.ts
Normal file
4
frontend/src/container/LogDetailedView/constant.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export const DROPDOWN_KEY = {
|
||||||
|
FILTER_IN: 'filterIn',
|
||||||
|
FILTER_OUT: 'filterOut',
|
||||||
|
};
|
@ -1,4 +1,6 @@
|
|||||||
import { flattenObject, recursiveParseJSON } from './utils';
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
|
|
||||||
|
import { flattenObject, getDataTypes, recursiveParseJSON } from './utils';
|
||||||
|
|
||||||
describe('recursiveParseJSON', () => {
|
describe('recursiveParseJSON', () => {
|
||||||
it('should return an empty object if the input is not valid JSON', () => {
|
it('should return an empty object if the input is not valid JSON', () => {
|
||||||
@ -146,3 +148,40 @@ describe('flattenObject in the objects recursively', () => {
|
|||||||
expect(flattenObject(complexObj)).toEqual(expected);
|
expect(flattenObject(complexObj)).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Get Data Types utils', () => {
|
||||||
|
it('should return String for string input', () => {
|
||||||
|
expect(getDataTypes('hello')).toBe(DataTypes.String);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return Float64 for float input', () => {
|
||||||
|
expect(getDataTypes(3.14)).toBe(DataTypes.Float64);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return Int64 for integer input', () => {
|
||||||
|
expect(getDataTypes(42)).toBe(DataTypes.Int64);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Test for arrays
|
||||||
|
it('should return ArrayString for string array input', () => {
|
||||||
|
expect(getDataTypes(['hello', 'world'])).toBe(DataTypes.ArrayString);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return ArrayFloat64 for float array input', () => {
|
||||||
|
expect(getDataTypes([1.23, 4.56, 7.89])).toBe(DataTypes.ArrayFloat64);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return ArrayInt64 for integer array input', () => {
|
||||||
|
expect(getDataTypes([1, 2, 3])).toBe(DataTypes.ArrayInt64);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edge cases
|
||||||
|
it('should return Int64 for empty array input', () => {
|
||||||
|
expect(getDataTypes([])).toBe(DataTypes.Int64);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle mixed array (return based on first element)', () => {
|
||||||
|
expect(getDataTypes([1, 2.5, 3])).toBe(DataTypes.ArrayInt64);
|
||||||
|
expect(getDataTypes([2.5, 3, 1])).toBe(DataTypes.ArrayFloat64);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
import { MetricsType } from 'container/MetricsApplication/constant';
|
|
||||||
|
|
||||||
import { IFieldAttributes } from './LogDetailedView.types';
|
|
||||||
|
|
||||||
export const recursiveParseJSON = (obj: string): Record<string, unknown> => {
|
|
||||||
try {
|
|
||||||
const value = JSON.parse(obj);
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
return recursiveParseJSON(value);
|
|
||||||
}
|
|
||||||
if (typeof value === 'object') {
|
|
||||||
Object.entries(value).forEach(([key, val]) => {
|
|
||||||
if (typeof val === 'string') {
|
|
||||||
value[key] = val.trim();
|
|
||||||
} else if (typeof val === 'object') {
|
|
||||||
value[key] = recursiveParseJSON(JSON.stringify(val));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
} catch (e) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
type AnyObject = { [key: string]: any };
|
|
||||||
|
|
||||||
export function flattenObject(obj: AnyObject, prefix = ''): AnyObject {
|
|
||||||
return Object.keys(obj).reduce((acc: AnyObject, k: string): AnyObject => {
|
|
||||||
const pre = prefix.length ? `${prefix}.` : '';
|
|
||||||
if (typeof obj[k] === 'object' && obj[k] !== null && !Array.isArray(obj[k])) {
|
|
||||||
Object.assign(acc, flattenObject(obj[k], pre + k));
|
|
||||||
} else {
|
|
||||||
acc[pre + k] = obj[k];
|
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getFieldAttributes = (field: string): IFieldAttributes => {
|
|
||||||
let dataType;
|
|
||||||
let newField;
|
|
||||||
let logType;
|
|
||||||
|
|
||||||
if (field.startsWith('attributes_')) {
|
|
||||||
logType = MetricsType.Tag;
|
|
||||||
const stringWithoutPrefix = field.slice('attributes_'.length);
|
|
||||||
const parts = stringWithoutPrefix.split('.');
|
|
||||||
[dataType, newField] = parts;
|
|
||||||
} else if (field.startsWith('resources_')) {
|
|
||||||
logType = MetricsType.Resource;
|
|
||||||
const stringWithoutPrefix = field.slice('resources_'.length);
|
|
||||||
const parts = stringWithoutPrefix.split('.');
|
|
||||||
[dataType, newField] = parts;
|
|
||||||
}
|
|
||||||
|
|
||||||
return { dataType, newField, logType };
|
|
||||||
};
|
|
176
frontend/src/container/LogDetailedView/utils.tsx
Normal file
176
frontend/src/container/LogDetailedView/utils.tsx
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
import { DataNode } from 'antd/es/tree';
|
||||||
|
import { MetricsType } from 'container/MetricsApplication/constant';
|
||||||
|
import { uniqueId } from 'lodash-es';
|
||||||
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
|
|
||||||
|
import BodyTitleRenderer from './BodyTitleRenderer';
|
||||||
|
import { AnyObject, IFieldAttributes } from './LogDetailedView.types';
|
||||||
|
|
||||||
|
export const recursiveParseJSON = (obj: string): Record<string, unknown> => {
|
||||||
|
try {
|
||||||
|
const value = JSON.parse(obj);
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return recursiveParseJSON(value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
} catch (e) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const computeDataNode = (
|
||||||
|
key: string,
|
||||||
|
valueIsArray: boolean,
|
||||||
|
value: unknown,
|
||||||
|
nodeKey: string,
|
||||||
|
): DataNode => ({
|
||||||
|
key: uniqueId(),
|
||||||
|
title: `${key} ${valueIsArray ? '[...]' : ''}`,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||||
|
children: jsonToDataNodes(
|
||||||
|
value as Record<string, unknown>,
|
||||||
|
valueIsArray ? `${nodeKey}[*]` : nodeKey,
|
||||||
|
valueIsArray,
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function jsonToDataNodes(
|
||||||
|
json: Record<string, unknown>,
|
||||||
|
parentKey = '',
|
||||||
|
parentIsArray = false,
|
||||||
|
): DataNode[] {
|
||||||
|
return Object.entries(json).map(([key, value]) => {
|
||||||
|
let nodeKey = parentKey || key;
|
||||||
|
if (parentIsArray) {
|
||||||
|
nodeKey += `.${value}`;
|
||||||
|
} else if (parentKey) {
|
||||||
|
nodeKey += `.${key}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const valueIsArray = Array.isArray(value);
|
||||||
|
|
||||||
|
if (parentIsArray) {
|
||||||
|
if (typeof value === 'object' && value !== null) {
|
||||||
|
return computeDataNode(key, valueIsArray, value, nodeKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
key: uniqueId(),
|
||||||
|
title: (
|
||||||
|
<BodyTitleRenderer
|
||||||
|
title={value as string}
|
||||||
|
nodeKey={nodeKey}
|
||||||
|
value={value}
|
||||||
|
parentIsArray={parentIsArray}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
children: jsonToDataNodes({}, nodeKey, valueIsArray),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value === 'object' && value !== null) {
|
||||||
|
return computeDataNode(key, valueIsArray, value, nodeKey);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
key: uniqueId(),
|
||||||
|
title: (
|
||||||
|
<BodyTitleRenderer
|
||||||
|
title={key}
|
||||||
|
nodeKey={nodeKey}
|
||||||
|
value={value}
|
||||||
|
parentIsArray={parentIsArray}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function flattenObject(obj: AnyObject, prefix = ''): AnyObject {
|
||||||
|
return Object.keys(obj).reduce((acc: AnyObject, k: string): AnyObject => {
|
||||||
|
const pre = prefix.length ? `${prefix}.` : '';
|
||||||
|
if (typeof obj[k] === 'object' && obj[k] !== null && !Array.isArray(obj[k])) {
|
||||||
|
Object.assign(acc, flattenObject(obj[k], pre + k));
|
||||||
|
} else {
|
||||||
|
acc[pre + k] = obj[k];
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
const isFloat = (num: number): boolean => num % 1 !== 0;
|
||||||
|
|
||||||
|
export const getDataTypes = (value: unknown): DataTypes => {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return DataTypes.String;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value === 'number') {
|
||||||
|
return isFloat(value) ? DataTypes.Float64 : DataTypes.Int64;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value === 'boolean') {
|
||||||
|
return DataTypes.bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
const firstElement = value[0];
|
||||||
|
|
||||||
|
if (typeof firstElement === 'string') {
|
||||||
|
return DataTypes.ArrayString;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof firstElement === 'boolean') {
|
||||||
|
return DataTypes.ArrayBool;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof firstElement === 'number') {
|
||||||
|
return isFloat(firstElement) ? DataTypes.ArrayFloat64 : DataTypes.ArrayInt64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return DataTypes.Int64;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const generateFieldKeyForArray = (
|
||||||
|
fieldKey: string,
|
||||||
|
dataType: DataTypes,
|
||||||
|
): string => {
|
||||||
|
let lastDotIndex = fieldKey.lastIndexOf('.');
|
||||||
|
let resultNodeKey = fieldKey;
|
||||||
|
if (lastDotIndex !== -1) {
|
||||||
|
resultNodeKey = fieldKey.substring(0, lastDotIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
let newResultNodeKey = resultNodeKey;
|
||||||
|
|
||||||
|
if (dataType === DataTypes.Float64) {
|
||||||
|
lastDotIndex = resultNodeKey.lastIndexOf('.');
|
||||||
|
if (lastDotIndex !== -1) {
|
||||||
|
newResultNodeKey = resultNodeKey.substring(0, lastDotIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return `body.${newResultNodeKey}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const removeObjectFromString = (str: string): string =>
|
||||||
|
str.replace(/\[object Object\]./g, '');
|
||||||
|
|
||||||
|
export const getFieldAttributes = (field: string): IFieldAttributes => {
|
||||||
|
let dataType;
|
||||||
|
let newField;
|
||||||
|
let logType;
|
||||||
|
|
||||||
|
if (field.startsWith('attributes_')) {
|
||||||
|
logType = MetricsType.Tag;
|
||||||
|
const stringWithoutPrefix = field.slice('attributes_'.length);
|
||||||
|
const parts = stringWithoutPrefix.split('.');
|
||||||
|
[dataType, newField] = parts;
|
||||||
|
} else if (field.startsWith('resources_')) {
|
||||||
|
logType = MetricsType.Resource;
|
||||||
|
const stringWithoutPrefix = field.slice('resources_'.length);
|
||||||
|
const parts = stringWithoutPrefix.split('.');
|
||||||
|
[dataType, newField] = parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { dataType, newField, logType };
|
||||||
|
};
|
@ -1,5 +1,6 @@
|
|||||||
import { OPERATORS } from 'constants/queryBuilder';
|
import { OPERATORS } from 'constants/queryBuilder';
|
||||||
import { ILog } from 'types/api/logs/log';
|
import { ILog } from 'types/api/logs/log';
|
||||||
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ export const getFiltersFromResources = (
|
|||||||
id: uuid(),
|
id: uuid(),
|
||||||
key: {
|
key: {
|
||||||
key,
|
key,
|
||||||
dataType: 'string',
|
dataType: DataTypes.String,
|
||||||
type: 'resource',
|
type: 'resource',
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { OPERATORS } from 'constants/queryBuilder';
|
import { OPERATORS } from 'constants/queryBuilder';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import {
|
import {
|
||||||
DataSource,
|
DataSource,
|
||||||
@ -7,7 +10,7 @@ import {
|
|||||||
QueryBuilderData,
|
QueryBuilderData,
|
||||||
} from 'types/common/queryBuilder';
|
} from 'types/common/queryBuilder';
|
||||||
|
|
||||||
import { DataType, FORMULA, MetricsType, WidgetKeys } from '../constant';
|
import { FORMULA, MetricsType, WidgetKeys } from '../constant';
|
||||||
import { DatabaseCallProps, DatabaseCallsRPSProps } from '../types';
|
import { DatabaseCallProps, DatabaseCallsRPSProps } from '../types';
|
||||||
import {
|
import {
|
||||||
getQueryBuilderQueries,
|
getQueryBuilderQueries,
|
||||||
@ -22,13 +25,18 @@ export const databaseCallsRPS = ({
|
|||||||
const autocompleteData: BaseAutocompleteData[] = [
|
const autocompleteData: BaseAutocompleteData[] = [
|
||||||
{
|
{
|
||||||
key: WidgetKeys.SignozDBLatencyCount,
|
key: WidgetKeys.SignozDBLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const groupBy: BaseAutocompleteData[] = [
|
const groupBy: BaseAutocompleteData[] = [
|
||||||
{ dataType: DataType.STRING, isColumn: false, key: 'db_system', type: 'tag' },
|
{
|
||||||
|
dataType: DataTypes.String,
|
||||||
|
isColumn: false,
|
||||||
|
key: 'db_system',
|
||||||
|
type: 'tag',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
const filterItems: TagFilterItem[][] = [
|
const filterItems: TagFilterItem[][] = [
|
||||||
[
|
[
|
||||||
@ -36,7 +44,7 @@ export const databaseCallsRPS = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
@ -65,13 +73,13 @@ export const databaseCallsAvgDuration = ({
|
|||||||
}: DatabaseCallProps): QueryBuilderData => {
|
}: DatabaseCallProps): QueryBuilderData => {
|
||||||
const autocompleteDataA: BaseAutocompleteData = {
|
const autocompleteDataA: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozDbLatencySum,
|
key: WidgetKeys.SignozDbLatencySum,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozDBLatencyCount,
|
key: WidgetKeys.SignozDBLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
@ -81,12 +89,12 @@ export const databaseCallsAvgDuration = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
op: OPERATORS.IN,
|
op: OPERATORS.IN,
|
||||||
value: [`${servicename}`],
|
value: [servicename],
|
||||||
},
|
},
|
||||||
...tagFilterItems,
|
...tagFilterItems,
|
||||||
];
|
];
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { OPERATORS } from 'constants/queryBuilder';
|
import { OPERATORS } from 'constants/queryBuilder';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import {
|
import {
|
||||||
DataSource,
|
DataSource,
|
||||||
@ -7,7 +10,7 @@ import {
|
|||||||
QueryBuilderData,
|
QueryBuilderData,
|
||||||
} from 'types/common/queryBuilder';
|
} from 'types/common/queryBuilder';
|
||||||
|
|
||||||
import { DataType, FORMULA, MetricsType, WidgetKeys } from '../constant';
|
import { FORMULA, MetricsType, WidgetKeys } from '../constant';
|
||||||
import {
|
import {
|
||||||
ExternalCallDurationByAddressProps,
|
ExternalCallDurationByAddressProps,
|
||||||
ExternalCallProps,
|
ExternalCallProps,
|
||||||
@ -19,7 +22,7 @@ import {
|
|||||||
|
|
||||||
const groupBy: BaseAutocompleteData[] = [
|
const groupBy: BaseAutocompleteData[] = [
|
||||||
{
|
{
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Address,
|
key: WidgetKeys.Address,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
@ -33,13 +36,13 @@ export const externalCallErrorPercent = ({
|
|||||||
}: ExternalCallDurationByAddressProps): QueryBuilderData => {
|
}: ExternalCallDurationByAddressProps): QueryBuilderData => {
|
||||||
const autocompleteDataA: BaseAutocompleteData = {
|
const autocompleteDataA: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
@ -49,18 +52,18 @@ export const externalCallErrorPercent = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
op: OPERATORS.IN,
|
op: OPERATORS.IN,
|
||||||
value: [`${servicename}`],
|
value: [servicename],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.StatusCode,
|
key: WidgetKeys.StatusCode,
|
||||||
dataType: DataType.INT64,
|
dataType: DataTypes.Int64,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -74,7 +77,7 @@ export const externalCallErrorPercent = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
@ -115,13 +118,13 @@ export const externalCallDuration = ({
|
|||||||
tagFilterItems,
|
tagFilterItems,
|
||||||
}: ExternalCallProps): QueryBuilderData => {
|
}: ExternalCallProps): QueryBuilderData => {
|
||||||
const autocompleteDataA: BaseAutocompleteData = {
|
const autocompleteDataA: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencySum,
|
key: WidgetKeys.SignozExternalCallLatencySum,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
type: '',
|
type: '',
|
||||||
@ -134,13 +137,13 @@ export const externalCallDuration = ({
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
op: OPERATORS.IN,
|
op: OPERATORS.IN,
|
||||||
value: [`${servicename}`],
|
value: [servicename],
|
||||||
},
|
},
|
||||||
...tagFilterItems,
|
...tagFilterItems,
|
||||||
];
|
];
|
||||||
@ -174,7 +177,7 @@ export const externalCallRpsByAddress = ({
|
|||||||
}: ExternalCallDurationByAddressProps): QueryBuilderData => {
|
}: ExternalCallDurationByAddressProps): QueryBuilderData => {
|
||||||
const autocompleteData: BaseAutocompleteData[] = [
|
const autocompleteData: BaseAutocompleteData[] = [
|
||||||
{
|
{
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
type: '',
|
type: '',
|
||||||
@ -185,13 +188,13 @@ export const externalCallRpsByAddress = ({
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
op: OPERATORS.IN,
|
op: OPERATORS.IN,
|
||||||
value: [`${servicename}`],
|
value: [servicename],
|
||||||
},
|
},
|
||||||
...tagFilterItems,
|
...tagFilterItems,
|
||||||
],
|
],
|
||||||
@ -215,13 +218,13 @@ export const externalCallDurationByAddress = ({
|
|||||||
tagFilterItems,
|
tagFilterItems,
|
||||||
}: ExternalCallDurationByAddressProps): QueryBuilderData => {
|
}: ExternalCallDurationByAddressProps): QueryBuilderData => {
|
||||||
const autocompleteDataA: BaseAutocompleteData = {
|
const autocompleteDataA: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencySum,
|
key: WidgetKeys.SignozExternalCallLatencySum,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
type: '',
|
type: '',
|
||||||
@ -233,13 +236,13 @@ export const externalCallDurationByAddress = ({
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
op: OPERATORS.IN,
|
op: OPERATORS.IN,
|
||||||
value: [`${servicename}`],
|
value: [servicename],
|
||||||
},
|
},
|
||||||
...tagFilterItems,
|
...tagFilterItems,
|
||||||
];
|
];
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { OPERATORS } from 'constants/queryBuilder';
|
import { OPERATORS } from 'constants/queryBuilder';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import {
|
import {
|
||||||
DataSource,
|
DataSource,
|
||||||
@ -8,7 +11,6 @@ import {
|
|||||||
} from 'types/common/queryBuilder';
|
} from 'types/common/queryBuilder';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DataType,
|
|
||||||
FORMULA,
|
FORMULA,
|
||||||
GraphTitle,
|
GraphTitle,
|
||||||
LATENCY_AGGREGATEOPERATOR,
|
LATENCY_AGGREGATEOPERATOR,
|
||||||
@ -40,7 +42,7 @@ export const latency = ({
|
|||||||
key: isSpanMetricEnable
|
key: isSpanMetricEnable
|
||||||
? WidgetKeys.Signoz_latency_bucket
|
? WidgetKeys.Signoz_latency_bucket
|
||||||
: WidgetKeys.DurationNano,
|
: WidgetKeys.DurationNano,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: isSpanMetricEnable ? '' : MetricsType.Tag,
|
type: isSpanMetricEnable ? '' : MetricsType.Tag,
|
||||||
};
|
};
|
||||||
@ -52,7 +54,7 @@ export const latency = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: isSpanMetricEnable ? WidgetKeys.Service_name : WidgetKeys.ServiceName,
|
key: isSpanMetricEnable ? WidgetKeys.Service_name : WidgetKeys.ServiceName,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
type: isSpanMetricEnable ? MetricsType.Resource : MetricsType.Tag,
|
type: isSpanMetricEnable ? MetricsType.Resource : MetricsType.Tag,
|
||||||
isColumn: !isSpanMetricEnable,
|
isColumn: !isSpanMetricEnable,
|
||||||
},
|
},
|
||||||
@ -62,7 +64,7 @@ export const latency = ({
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: !isSpanMetricEnable,
|
isColumn: !isSpanMetricEnable,
|
||||||
key: isSpanMetricEnable ? WidgetKeys.Operation : WidgetKeys.Name,
|
key: isSpanMetricEnable ? WidgetKeys.Operation : WidgetKeys.Name,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
@ -98,21 +100,21 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
threashold,
|
threashold,
|
||||||
}: ApDexProps): QueryBuilderData => {
|
}: ApDexProps): QueryBuilderData => {
|
||||||
const autoCompleteDataA: BaseAutocompleteData = {
|
const autoCompleteDataA: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: '',
|
key: '',
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autoCompleteDataB: BaseAutocompleteData = {
|
const autoCompleteDataB: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: '',
|
key: '',
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autoCompleteDataC: BaseAutocompleteData = {
|
const autoCompleteDataC: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: '',
|
key: '',
|
||||||
type: '',
|
type: '',
|
||||||
@ -123,7 +125,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.ServiceName,
|
key: WidgetKeys.ServiceName,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -134,7 +136,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Name,
|
key: WidgetKeys.Name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -149,7 +151,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.HasError,
|
key: WidgetKeys.HasError,
|
||||||
dataType: DataType.BOOL,
|
dataType: DataTypes.bool,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -160,7 +162,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.DurationNano,
|
key: WidgetKeys.DurationNano,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -171,7 +173,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.ServiceName,
|
key: WidgetKeys.ServiceName,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -182,7 +184,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Name,
|
key: WidgetKeys.Name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -196,7 +198,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.DurationNano,
|
key: WidgetKeys.DurationNano,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -207,7 +209,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.HasError,
|
key: WidgetKeys.HasError,
|
||||||
dataType: DataType.BOOL,
|
dataType: DataTypes.bool,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -218,7 +220,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.ServiceName,
|
key: WidgetKeys.ServiceName,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -229,7 +231,7 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Name,
|
key: WidgetKeys.Name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -277,21 +279,21 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
}: ApDexMetricsQueryBuilderQueriesProps): QueryBuilderData => {
|
}: ApDexMetricsQueryBuilderQueriesProps): QueryBuilderData => {
|
||||||
const autoCompleteDataA: BaseAutocompleteData = {
|
const autoCompleteDataA: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozLatencyCount,
|
key: WidgetKeys.SignozLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autoCompleteDataB: BaseAutocompleteData = {
|
const autoCompleteDataB: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.Signoz_latency_bucket,
|
key: WidgetKeys.Signoz_latency_bucket,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autoCompleteDataC: BaseAutocompleteData = {
|
const autoCompleteDataC: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.Signoz_latency_bucket,
|
key: WidgetKeys.Signoz_latency_bucket,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
@ -301,7 +303,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -312,7 +314,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -327,7 +329,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.StatusCode,
|
key: WidgetKeys.StatusCode,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -338,7 +340,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Le,
|
key: WidgetKeys.Le,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -349,7 +351,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -360,7 +362,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -375,7 +377,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Le,
|
key: WidgetKeys.Le,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -386,7 +388,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.StatusCode,
|
key: WidgetKeys.StatusCode,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -397,7 +399,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -408,7 +410,7 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -458,7 +460,7 @@ export const operationPerSec = ({
|
|||||||
const autocompleteData: BaseAutocompleteData[] = [
|
const autocompleteData: BaseAutocompleteData[] = [
|
||||||
{
|
{
|
||||||
key: WidgetKeys.SignozLatencyCount,
|
key: WidgetKeys.SignozLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
},
|
},
|
||||||
@ -470,7 +472,7 @@ export const operationPerSec = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
@ -481,7 +483,7 @@ export const operationPerSec = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -510,13 +512,13 @@ export const errorPercentage = ({
|
|||||||
}: OperationPerSecProps): QueryBuilderData => {
|
}: OperationPerSecProps): QueryBuilderData => {
|
||||||
const autocompleteDataA: BaseAutocompleteData = {
|
const autocompleteDataA: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
@ -528,7 +530,7 @@ export const errorPercentage = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
@ -539,7 +541,7 @@ export const errorPercentage = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -550,7 +552,7 @@ export const errorPercentage = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.StatusCode,
|
key: WidgetKeys.StatusCode,
|
||||||
dataType: DataType.INT64,
|
dataType: DataTypes.Int64,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
@ -565,7 +567,7 @@ export const errorPercentage = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
@ -576,7 +578,7 @@ export const errorPercentage = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { OPERATORS } from 'constants/queryBuilder';
|
import { OPERATORS } from 'constants/queryBuilder';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import {
|
import {
|
||||||
DataSource,
|
DataSource,
|
||||||
@ -8,7 +11,6 @@ import {
|
|||||||
} from 'types/common/queryBuilder';
|
} from 'types/common/queryBuilder';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DataType,
|
|
||||||
GraphTitle,
|
GraphTitle,
|
||||||
KeyOperationTableHeader,
|
KeyOperationTableHeader,
|
||||||
MetricsType,
|
MetricsType,
|
||||||
@ -22,21 +24,21 @@ export const topOperationQueries = ({
|
|||||||
}: TopOperationQueryFactoryProps): QueryBuilderData => {
|
}: TopOperationQueryFactoryProps): QueryBuilderData => {
|
||||||
const latencyAutoCompleteData: BaseAutocompleteData = {
|
const latencyAutoCompleteData: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.Signoz_latency_bucket,
|
key: WidgetKeys.Signoz_latency_bucket,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const numOfCallAutoCompleteData: BaseAutocompleteData = {
|
const numOfCallAutoCompleteData: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozLatencyCount,
|
key: WidgetKeys.SignozLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
@ -46,7 +48,7 @@ export const topOperationQueries = ({
|
|||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
},
|
},
|
||||||
@ -59,7 +61,7 @@ export const topOperationQueries = ({
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
@ -70,7 +72,7 @@ export const topOperationQueries = ({
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.INT64,
|
dataType: DataTypes.Int64,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.StatusCode,
|
key: WidgetKeys.StatusCode,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
@ -84,7 +86,7 @@ export const topOperationQueries = ({
|
|||||||
|
|
||||||
const groupBy: BaseAutocompleteData[] = [
|
const groupBy: BaseAutocompleteData[] = [
|
||||||
{
|
{
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
|
@ -41,13 +41,6 @@ export enum KeyOperationTableHeader {
|
|||||||
OPERATION_PR_SECOND = 'Op/s',
|
OPERATION_PR_SECOND = 'Op/s',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum DataType {
|
|
||||||
STRING = 'string',
|
|
||||||
FLOAT64 = 'float64',
|
|
||||||
INT64 = 'int64',
|
|
||||||
BOOL = 'bool',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum MetricsType {
|
export enum MetricsType {
|
||||||
Tag = 'tag',
|
Tag = 'tag',
|
||||||
Resource = 'resource',
|
Resource = 'resource',
|
||||||
|
@ -12,6 +12,7 @@ import { useEffect, useState } from 'react';
|
|||||||
import { SuccessResponse } from 'types/api';
|
import { SuccessResponse } from 'types/api';
|
||||||
import { ILog } from 'types/api/logs/log';
|
import { ILog } from 'types/api/logs/log';
|
||||||
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
||||||
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { EQueryType } from 'types/common/dashboard';
|
import { EQueryType } from 'types/common/dashboard';
|
||||||
import { DataSource } from 'types/common/queryBuilder';
|
import { DataSource } from 'types/common/queryBuilder';
|
||||||
@ -43,7 +44,7 @@ export default function LogsConnectionStatus({
|
|||||||
aggregateOperator: 'noop',
|
aggregateOperator: 'noop',
|
||||||
aggregateAttribute: {
|
aggregateAttribute: {
|
||||||
id: '------false',
|
id: '------false',
|
||||||
dataType: '',
|
dataType: DataTypes.EMPTY,
|
||||||
key: '',
|
key: '',
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
type: '',
|
type: '',
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
initialQueryBuilderFormValuesMap,
|
initialQueryBuilderFormValuesMap,
|
||||||
} from 'constants/queryBuilder';
|
} from 'constants/queryBuilder';
|
||||||
import { transformFromStringToHaving } from 'lib/query/transformQueryBuilderData';
|
import { transformFromStringToHaving } from 'lib/query/transformQueryBuilderData';
|
||||||
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
// ** Types
|
// ** Types
|
||||||
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ const valueWithAttributeAndOperator: IBuilderQuery = {
|
|||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: 'bytes',
|
key: 'bytes',
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
dataType: 'float64',
|
dataType: DataTypes.Float64,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { Select, Spin, Tag, Tooltip } from 'antd';
|
import { Select, Spin, Tag, Tooltip } from 'antd';
|
||||||
|
import { OPERATORS } from 'constants/queryBuilder';
|
||||||
|
import { getDataTypes } from 'container/LogDetailedView/utils';
|
||||||
import {
|
import {
|
||||||
useAutoComplete,
|
useAutoComplete,
|
||||||
WhereClauseConfig,
|
WhereClauseConfig,
|
||||||
@ -12,7 +14,10 @@ import {
|
|||||||
useEffect,
|
useEffect,
|
||||||
useMemo,
|
useMemo,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import {
|
import {
|
||||||
IBuilderQuery,
|
IBuilderQuery,
|
||||||
TagFilter,
|
TagFilter,
|
||||||
@ -80,15 +85,22 @@ function QueryBuilderSearch({
|
|||||||
handleSearch(value);
|
handleSearch(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isDisabled =
|
||||||
|
!!searchValue ||
|
||||||
|
OPERATORS.HAS === tagOperator ||
|
||||||
|
OPERATORS.NHAS === tagOperator;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tag closable={!searchValue && closable} onClose={onCloseHandler}>
|
<Tag closable={!searchValue && closable} onClose={onCloseHandler}>
|
||||||
<Tooltip title={chipValue}>
|
<Tooltip title={chipValue}>
|
||||||
<TypographyText
|
<TypographyText
|
||||||
ellipsis
|
ellipsis
|
||||||
$isInNin={isInNin}
|
$isInNin={isInNin}
|
||||||
disabled={!!searchValue}
|
disabled={isDisabled}
|
||||||
$isEnabled={!!searchValue}
|
$isEnabled={!!searchValue}
|
||||||
onClick={(): void => tagEditHandler(value)}
|
onClick={(): void => {
|
||||||
|
if (!isDisabled) tagEditHandler(value);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{chipValue}
|
{chipValue}
|
||||||
</TypographyText>
|
</TypographyText>
|
||||||
@ -119,6 +131,14 @@ function QueryBuilderSearch({
|
|||||||
[query.dataSource],
|
[query.dataSource],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const fetchValueDataType = (value: unknown, operator: string): DataTypes => {
|
||||||
|
if (operator === OPERATORS.HAS || operator === OPERATORS.NHAS) {
|
||||||
|
return getDataTypes([value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DataTypes.EMPTY;
|
||||||
|
};
|
||||||
|
|
||||||
const queryTags = useMemo(() => {
|
const queryTags = useMemo(() => {
|
||||||
if (!query.aggregateAttribute.key && isMetricsDataSource) return [];
|
if (!query.aggregateAttribute.key && isMetricsDataSource) return [];
|
||||||
return tags;
|
return tags;
|
||||||
@ -129,26 +149,35 @@ function QueryBuilderSearch({
|
|||||||
const initialSourceKeys = query.filters.items?.map(
|
const initialSourceKeys = query.filters.items?.map(
|
||||||
(item) => item.key as BaseAutocompleteData,
|
(item) => item.key as BaseAutocompleteData,
|
||||||
);
|
);
|
||||||
initialTagFilters.items = tags.map((tag) => {
|
|
||||||
|
initialTagFilters.items = tags.map((tag, index) => {
|
||||||
|
const isJsonTrue = query.filters?.items[index]?.key?.isJSON;
|
||||||
|
|
||||||
const { tagKey, tagOperator, tagValue } = getTagToken(tag);
|
const { tagKey, tagOperator, tagValue } = getTagToken(tag);
|
||||||
|
|
||||||
const filterAttribute = [...initialSourceKeys, ...sourceKeys].find(
|
const filterAttribute = [...initialSourceKeys, ...sourceKeys].find(
|
||||||
(key) => key.key === getRemovePrefixFromKey(tagKey),
|
(key) => key.key === getRemovePrefixFromKey(tagKey),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const computedTagValue =
|
||||||
|
tagValue && Array.isArray(tagValue) && tagValue[tagValue.length - 1] === ''
|
||||||
|
? tagValue?.slice(0, -1)
|
||||||
|
: tagValue ?? '';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: uuid().slice(0, 8),
|
id: uuid().slice(0, 8),
|
||||||
key: filterAttribute ?? {
|
key: filterAttribute ?? {
|
||||||
key: tagKey,
|
key: tagKey,
|
||||||
dataType: '',
|
dataType: fetchValueDataType(computedTagValue, tagOperator),
|
||||||
type: '',
|
type: '',
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
|
isJSON: isJsonTrue,
|
||||||
},
|
},
|
||||||
op: getOperatorValue(tagOperator),
|
op: getOperatorValue(tagOperator),
|
||||||
value:
|
value: computedTagValue,
|
||||||
tagValue[tagValue.length - 1] === ''
|
|
||||||
? tagValue?.slice(0, -1)
|
|
||||||
: tagValue ?? '',
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
onChange(initialTagFilters);
|
onChange(initialTagFilters);
|
||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
}, [sourceKeys]);
|
}, [sourceKeys]);
|
||||||
|
@ -3,7 +3,8 @@ import { parse } from 'papaparse';
|
|||||||
|
|
||||||
import { orderByValueDelimiter } from '../OrderByFilter/utils';
|
import { orderByValueDelimiter } from '../OrderByFilter/utils';
|
||||||
|
|
||||||
export const tagRegexp = /([a-zA-Z0-9_.:@$()\-/\\]+)\s*(!=|=|<=|<|>=|>|IN|NOT_IN|LIKE|NOT_LIKE|REGEX|NOT_REGEX|EXISTS|NOT_EXISTS|CONTAINS|NOT_CONTAINS|-->|--!>)\s*([\s\S]*)/g;
|
// eslint-disable-next-line no-useless-escape
|
||||||
|
export const tagRegexp = /^\s*(.*?)\s*(IN|NOT_IN|LIKE|NOT_LIKE|REGEX|NOT_REGEX|=|!=|EXISTS|NOT_EXISTS|CONTAINS|NOT_CONTAINS|>=|>|<=|<|HAS|NHAS)\s*(.*)$/g;
|
||||||
|
|
||||||
export function isInNInOperator(value: string): boolean {
|
export function isInNInOperator(value: string): boolean {
|
||||||
return value === OPERATORS.IN || value === OPERATORS.NIN;
|
return value === OPERATORS.IN || value === OPERATORS.NIN;
|
||||||
@ -57,6 +58,10 @@ export function getOperatorValue(op: string): string {
|
|||||||
return 'nin';
|
return 'nin';
|
||||||
case OPERATORS.REGEX:
|
case OPERATORS.REGEX:
|
||||||
return 'regex';
|
return 'regex';
|
||||||
|
case OPERATORS.HAS:
|
||||||
|
return 'has';
|
||||||
|
case OPERATORS.NHAS:
|
||||||
|
return 'nhas';
|
||||||
case OPERATORS.NREGEX:
|
case OPERATORS.NREGEX:
|
||||||
return 'nregex';
|
return 'nregex';
|
||||||
case 'LIKE':
|
case 'LIKE':
|
||||||
@ -98,6 +103,10 @@ export function getOperatorFromValue(op: string): string {
|
|||||||
return 'CONTAINS';
|
return 'CONTAINS';
|
||||||
case 'ncontains':
|
case 'ncontains':
|
||||||
return 'NOT_CONTAINS';
|
return 'NOT_CONTAINS';
|
||||||
|
case 'has':
|
||||||
|
return OPERATORS.HAS;
|
||||||
|
case 'nhas':
|
||||||
|
return OPERATORS.NHAS;
|
||||||
default:
|
default:
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
import { ServiceDataProps } from 'api/metrics/getTopLevelOperations';
|
import { ServiceDataProps } from 'api/metrics/getTopLevelOperations';
|
||||||
import { OPERATORS } from 'constants/queryBuilder';
|
import { OPERATORS } from 'constants/queryBuilder';
|
||||||
import {
|
import {
|
||||||
DataType,
|
|
||||||
KeyOperationTableHeader,
|
KeyOperationTableHeader,
|
||||||
MetricsType,
|
MetricsType,
|
||||||
WidgetKeys,
|
WidgetKeys,
|
||||||
} from 'container/MetricsApplication/constant';
|
} from 'container/MetricsApplication/constant';
|
||||||
import { getQueryBuilderQuerieswithFormula } from 'container/MetricsApplication/MetricsPageQueries/MetricsPageQueriesFactory';
|
import { getQueryBuilderQuerieswithFormula } from 'container/MetricsApplication/MetricsPageQueries/MetricsPageQueriesFactory';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import {
|
import {
|
||||||
DataSource,
|
DataSource,
|
||||||
@ -19,21 +21,21 @@ export const serviceMetricsQuery = (
|
|||||||
topLevelOperation: [keyof ServiceDataProps, string[]],
|
topLevelOperation: [keyof ServiceDataProps, string[]],
|
||||||
): QueryBuilderData => {
|
): QueryBuilderData => {
|
||||||
const p99AutoCompleteData: BaseAutocompleteData = {
|
const p99AutoCompleteData: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.Signoz_latency_bucket,
|
key: WidgetKeys.Signoz_latency_bucket,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
type: '',
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const operationPrSecondAutoCompleteData: BaseAutocompleteData = {
|
const operationPrSecondAutoCompleteData: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataTypes.Float64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
type: '',
|
type: '',
|
||||||
@ -50,7 +52,7 @@ export const serviceMetricsQuery = (
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
@ -61,7 +63,7 @@ export const serviceMetricsQuery = (
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
@ -75,7 +77,7 @@ export const serviceMetricsQuery = (
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
@ -86,7 +88,7 @@ export const serviceMetricsQuery = (
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.INT64,
|
dataType: DataTypes.Int64,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.StatusCode,
|
key: WidgetKeys.StatusCode,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
@ -97,7 +99,7 @@ export const serviceMetricsQuery = (
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
@ -111,7 +113,7 @@ export const serviceMetricsQuery = (
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
@ -122,7 +124,7 @@ export const serviceMetricsQuery = (
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
@ -136,7 +138,7 @@ export const serviceMetricsQuery = (
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
@ -147,7 +149,7 @@ export const serviceMetricsQuery = (
|
|||||||
{
|
{
|
||||||
id: '',
|
id: '',
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Operation,
|
key: WidgetKeys.Operation,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
@ -185,7 +187,7 @@ export const serviceMetricsQuery = (
|
|||||||
|
|
||||||
const groupBy: BaseAutocompleteData[] = [
|
const groupBy: BaseAutocompleteData[] = [
|
||||||
{
|
{
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: WidgetKeys.Service_name,
|
key: WidgetKeys.Service_name,
|
||||||
type: MetricsType.Tag,
|
type: MetricsType.Tag,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { MouseEventHandler } from 'react';
|
import { MouseEventHandler } from 'react';
|
||||||
import { ILog } from 'types/api/logs/log';
|
import { ILog } from 'types/api/logs/log';
|
||||||
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
|
|
||||||
export type LogTimeRange = {
|
export type LogTimeRange = {
|
||||||
start: number;
|
start: number;
|
||||||
@ -20,5 +21,11 @@ export type UseActiveLog = {
|
|||||||
activeLog: ILog | null;
|
activeLog: ILog | null;
|
||||||
onSetActiveLog: (log: ILog) => void;
|
onSetActiveLog: (log: ILog) => void;
|
||||||
onClearActiveLog: () => void;
|
onClearActiveLog: () => void;
|
||||||
onAddToQuery: (fieldKey: string, fieldValue: string, operator: string) => void;
|
onAddToQuery: (
|
||||||
|
fieldKey: string,
|
||||||
|
fieldValue: string,
|
||||||
|
operator: string,
|
||||||
|
isJSON?: boolean,
|
||||||
|
dataType?: DataTypes,
|
||||||
|
) => void;
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { getAggregateKeys } from 'api/queryBuilder/getAttributeKeys';
|
import { getAggregateKeys } from 'api/queryBuilder/getAttributeKeys';
|
||||||
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
import { QueryBuilderKeys } from 'constants/queryBuilder';
|
import { QueryBuilderKeys } from 'constants/queryBuilder';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import { getOperatorValue } from 'container/QueryBuilder/filters/QueryBuilderSearch/utils';
|
import { getOperatorValue } from 'container/QueryBuilder/filters/QueryBuilderSearch/utils';
|
||||||
@ -7,14 +8,16 @@ import { useNotifications } from 'hooks/useNotifications';
|
|||||||
import { getGeneratedFilterQueryString } from 'lib/getGeneratedFilterQueryString';
|
import { getGeneratedFilterQueryString } from 'lib/getGeneratedFilterQueryString';
|
||||||
import { chooseAutocompleteFromCustomValue } from 'lib/newQueryBuilder/chooseAutocompleteFromCustomValue';
|
import { chooseAutocompleteFromCustomValue } from 'lib/newQueryBuilder/chooseAutocompleteFromCustomValue';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { useQueryClient } from 'react-query';
|
import { useQueryClient } from 'react-query';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { useHistory, useLocation } from 'react-router-dom';
|
import { useHistory, useLocation } from 'react-router-dom';
|
||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
import { SET_DETAILED_LOG_DATA } from 'types/actions/logs';
|
import { SET_DETAILED_LOG_DATA } from 'types/actions/logs';
|
||||||
import { ILog } from 'types/api/logs/log';
|
import { ILog } from 'types/api/logs/log';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { ILogsReducer } from 'types/reducer/logs';
|
import { ILogsReducer } from 'types/reducer/logs';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
@ -33,8 +36,6 @@ export const useActiveLog = (): UseActiveLog => {
|
|||||||
const { currentQuery, redirectWithQueryBuilderData } = useQueryBuilder();
|
const { currentQuery, redirectWithQueryBuilderData } = useQueryBuilder();
|
||||||
const { notifications } = useNotifications();
|
const { notifications } = useNotifications();
|
||||||
|
|
||||||
const { t } = useTranslation('common');
|
|
||||||
|
|
||||||
const isLogsPage = useMemo(() => pathname === ROUTES.LOGS, [pathname]);
|
const isLogsPage = useMemo(() => pathname === ROUTES.LOGS, [pathname]);
|
||||||
|
|
||||||
const [activeLog, setActiveLog] = useState<ILog | null>(null);
|
const [activeLog, setActiveLog] = useState<ILog | null>(null);
|
||||||
@ -67,6 +68,8 @@ export const useActiveLog = (): UseActiveLog => {
|
|||||||
fieldKey: string,
|
fieldKey: string,
|
||||||
fieldValue: string,
|
fieldValue: string,
|
||||||
operator: string,
|
operator: string,
|
||||||
|
isJSON?: boolean,
|
||||||
|
dataType?: DataTypes,
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const keysAutocompleteResponse = await queryClient.fetchQuery(
|
const keysAutocompleteResponse = await queryClient.fetchQuery(
|
||||||
@ -87,6 +90,8 @@ export const useActiveLog = (): UseActiveLog => {
|
|||||||
const existAutocompleteKey = chooseAutocompleteFromCustomValue(
|
const existAutocompleteKey = chooseAutocompleteFromCustomValue(
|
||||||
keysAutocomplete,
|
keysAutocomplete,
|
||||||
fieldKey,
|
fieldKey,
|
||||||
|
isJSON,
|
||||||
|
dataType,
|
||||||
);
|
);
|
||||||
|
|
||||||
const currentOperator = getOperatorValue(operator);
|
const currentOperator = getOperatorValue(operator);
|
||||||
@ -100,9 +105,7 @@ export const useActiveLog = (): UseActiveLog => {
|
|||||||
filters: {
|
filters: {
|
||||||
...item.filters,
|
...item.filters,
|
||||||
items: [
|
items: [
|
||||||
...item.filters.items.filter(
|
...item.filters.items,
|
||||||
(item) => item.key?.id !== existAutocompleteKey.id,
|
|
||||||
),
|
|
||||||
{
|
{
|
||||||
id: uuid(),
|
id: uuid(),
|
||||||
key: existAutocompleteKey,
|
key: existAutocompleteKey,
|
||||||
@ -117,10 +120,10 @@ export const useActiveLog = (): UseActiveLog => {
|
|||||||
|
|
||||||
redirectWithQueryBuilderData(nextQuery);
|
redirectWithQueryBuilderData(nextQuery);
|
||||||
} catch {
|
} catch {
|
||||||
notifications.error({ message: t('something_went_wrong') });
|
notifications.error({ message: SOMETHING_WENT_WRONG });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[currentQuery, notifications, queryClient, redirectWithQueryBuilderData, t],
|
[currentQuery, notifications, queryClient, redirectWithQueryBuilderData],
|
||||||
);
|
);
|
||||||
|
|
||||||
const onAddToQueryLogs = useCallback(
|
const onAddToQueryLogs = useCallback(
|
||||||
|
@ -9,7 +9,10 @@ import useDebounceValue from 'hooks/useDebounce';
|
|||||||
import { isEqual, uniqWith } from 'lodash-es';
|
import { isEqual, uniqWith } from 'lodash-es';
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useDebounce } from 'react-use';
|
import { useDebounce } from 'react-use';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { DataSource } from 'types/common/queryBuilder';
|
import { DataSource } from 'types/common/queryBuilder';
|
||||||
|
|
||||||
@ -109,7 +112,7 @@ export const useFetchKeysAndValues = (
|
|||||||
dataSource: query.dataSource,
|
dataSource: query.dataSource,
|
||||||
aggregateAttribute: query.aggregateAttribute.key,
|
aggregateAttribute: query.aggregateAttribute.key,
|
||||||
attributeKey: filterAttributeKey?.key ?? tagKey,
|
attributeKey: filterAttributeKey?.key ?? tagKey,
|
||||||
filterAttributeKeyDataType: filterAttributeKey?.dataType ?? '',
|
filterAttributeKeyDataType: filterAttributeKey?.dataType ?? DataTypes.EMPTY,
|
||||||
tagType: filterAttributeKey?.type ?? '',
|
tagType: filterAttributeKey?.type ?? '',
|
||||||
searchText: isInNInOperator(tagOperator)
|
searchText: isInNInOperator(tagOperator)
|
||||||
? tagValue[tagValue.length - 1]?.toString() ?? '' // last element of tagvalue will be always user search value
|
? tagValue[tagValue.length - 1]?.toString() ?? '' // last element of tagvalue will be always user search value
|
||||||
|
@ -23,6 +23,8 @@ const operatorTypeMapper: Record<string, OperatorType> = {
|
|||||||
[OPERATORS.NOT_CONTAINS]: 'SINGLE_VALUE',
|
[OPERATORS.NOT_CONTAINS]: 'SINGLE_VALUE',
|
||||||
[OPERATORS['=']]: 'SINGLE_VALUE',
|
[OPERATORS['=']]: 'SINGLE_VALUE',
|
||||||
[OPERATORS['!=']]: 'SINGLE_VALUE',
|
[OPERATORS['!=']]: 'SINGLE_VALUE',
|
||||||
|
[OPERATORS.HAS]: 'SINGLE_VALUE',
|
||||||
|
[OPERATORS.NHAS]: 'SINGLE_VALUE',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useOperatorType = (operator: string): OperatorType =>
|
export const useOperatorType = (operator: string): OperatorType =>
|
||||||
|
@ -17,6 +17,8 @@ export const useOperators = (
|
|||||||
useMemo(() => {
|
useMemo(() => {
|
||||||
const currentKey = keys?.find((el) => el.key === getRemovePrefixFromKey(key));
|
const currentKey = keys?.find((el) => el.key === getRemovePrefixFromKey(key));
|
||||||
return currentKey?.dataType
|
return currentKey?.dataType
|
||||||
? QUERY_BUILDER_OPERATORS_BY_TYPES[currentKey.dataType]
|
? QUERY_BUILDER_OPERATORS_BY_TYPES[
|
||||||
|
currentKey.dataType as keyof typeof QUERY_BUILDER_OPERATORS_BY_TYPES
|
||||||
|
]
|
||||||
: QUERY_BUILDER_OPERATORS_BY_TYPES.universal;
|
: QUERY_BUILDER_OPERATORS_BY_TYPES.universal;
|
||||||
}, [keys, key]);
|
}, [keys, key]);
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
} from 'api/metrics/getResourceAttributes';
|
} from 'api/metrics/getResourceAttributes';
|
||||||
import { OperatorConversions } from 'constants/resourceAttributes';
|
import { OperatorConversions } from 'constants/resourceAttributes';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import { DataType, MetricsType } from 'container/MetricsApplication/constant';
|
import { MetricsType } from 'container/MetricsApplication/constant';
|
||||||
import {
|
import {
|
||||||
IOption,
|
IOption,
|
||||||
IResourceAttribute,
|
IResourceAttribute,
|
||||||
@ -12,6 +12,7 @@ import {
|
|||||||
} from 'hooks/useResourceAttribute/types';
|
} from 'hooks/useResourceAttribute/types';
|
||||||
import { decode } from 'js-base64';
|
import { decode } from 'js-base64';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { OperatorValues, Tags } from 'types/reducer/trace';
|
import { OperatorValues, Tags } from 'types/reducer/trace';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
@ -72,7 +73,7 @@ export const resourceAttributesToTagFilterItems = (
|
|||||||
op: e.Operator,
|
op: e.Operator,
|
||||||
value: e.StringValues,
|
value: e.StringValues,
|
||||||
key: {
|
key: {
|
||||||
dataType: DataType.STRING,
|
dataType: DataTypes.String,
|
||||||
type: MetricsType.Resource,
|
type: MetricsType.Resource,
|
||||||
isColumn: false,
|
isColumn: false,
|
||||||
key: e.Key,
|
key: e.Key,
|
||||||
@ -82,7 +83,12 @@ export const resourceAttributesToTagFilterItems = (
|
|||||||
|
|
||||||
return queries.map((res) => ({
|
return queries.map((res) => ({
|
||||||
id: `${res.id}`,
|
id: `${res.id}`,
|
||||||
key: { key: res.tagKey, isColumn: false, type: '', dataType: '' },
|
key: {
|
||||||
|
key: res.tagKey,
|
||||||
|
isColumn: false,
|
||||||
|
type: '',
|
||||||
|
dataType: DataTypes.EMPTY,
|
||||||
|
},
|
||||||
op: `${res.operator}`,
|
op: `${res.operator}`,
|
||||||
value: `${res.tagValue}`.split(','),
|
value: `${res.tagValue}`.split(','),
|
||||||
}));
|
}));
|
||||||
|
@ -1,16 +1,26 @@
|
|||||||
import { initialAutocompleteData } from 'constants/queryBuilder';
|
import { initialAutocompleteData } from 'constants/queryBuilder';
|
||||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
import {
|
||||||
|
BaseAutocompleteData,
|
||||||
|
DataTypes,
|
||||||
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
|
|
||||||
export const chooseAutocompleteFromCustomValue = (
|
export const chooseAutocompleteFromCustomValue = (
|
||||||
sourceList: BaseAutocompleteData[],
|
sourceList: BaseAutocompleteData[],
|
||||||
value: string,
|
value: string,
|
||||||
|
isJSON?: boolean,
|
||||||
|
dataType?: DataTypes,
|
||||||
): BaseAutocompleteData => {
|
): BaseAutocompleteData => {
|
||||||
const firstBaseAutoCompleteValue = sourceList.find(
|
const firstBaseAutoCompleteValue = sourceList.find(
|
||||||
(sourceAutoComplete) => value === sourceAutoComplete.key,
|
(sourceAutoComplete) => value === sourceAutoComplete.key,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!firstBaseAutoCompleteValue) {
|
if (!firstBaseAutoCompleteValue) {
|
||||||
return { ...initialAutocompleteData, key: value, dataType: 'string' };
|
return {
|
||||||
|
...initialAutocompleteData,
|
||||||
|
key: value,
|
||||||
|
dataType: dataType || DataTypes.EMPTY,
|
||||||
|
isJSON,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return firstBaseAutoCompleteValue;
|
return firstBaseAutoCompleteValue;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
|
import { FILTERS } from 'container/QueryBuilder/filters/OrderByFilter/config';
|
||||||
|
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||||
import {
|
import {
|
||||||
IBuilderQuery,
|
IBuilderQuery,
|
||||||
OrderByPayload,
|
OrderByPayload,
|
||||||
@ -47,7 +48,7 @@ export const getPaginationQueryData: SetupPaginationQueryData = ({
|
|||||||
key: {
|
key: {
|
||||||
key: 'id',
|
key: 'id',
|
||||||
type: '',
|
type: '',
|
||||||
dataType: 'string',
|
dataType: DataTypes.String,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
},
|
},
|
||||||
op: orderByTimestamp.order === FILTERS.ASC ? '>' : '<',
|
op: orderByTimestamp.order === FILTERS.ASC ? '>' : '<',
|
||||||
|
@ -1,15 +1,26 @@
|
|||||||
export type LocalDataType = 'number' | 'string' | 'bool';
|
export enum DataTypes {
|
||||||
|
Int64 = 'int64',
|
||||||
|
String = 'string',
|
||||||
|
Float64 = 'float64',
|
||||||
|
bool = 'bool',
|
||||||
|
ArrayFloat64 = 'array(float64)',
|
||||||
|
ArrayInt64 = 'array(int64)',
|
||||||
|
ArrayString = 'array(string)',
|
||||||
|
ArrayBool = 'array(bool)',
|
||||||
|
EMPTY = '',
|
||||||
|
}
|
||||||
|
|
||||||
export type DataType = 'int64' | 'float64' | 'string' | 'bool' | '';
|
export type LocalDataType = 'number' | 'string' | 'bool';
|
||||||
|
|
||||||
export type AutocompleteType = 'tag' | 'resource' | '';
|
export type AutocompleteType = 'tag' | 'resource' | '';
|
||||||
|
|
||||||
export interface BaseAutocompleteData {
|
export interface BaseAutocompleteData {
|
||||||
id?: string;
|
id?: string;
|
||||||
dataType: DataType;
|
dataType: DataTypes;
|
||||||
isColumn: boolean;
|
isColumn: boolean;
|
||||||
key: string;
|
key: string;
|
||||||
type: AutocompleteType | string | null;
|
type: AutocompleteType | string | null;
|
||||||
|
isJSON?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IQueryAutocompleteResponse {
|
export interface IQueryAutocompleteResponse {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user