mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-18 07:56:56 +00:00
* feat: added traceoperator component and styles * chore: minor style improvments * feat: added conditions for traceoperator * chore: minor UI fixes * chore: type changes * chore: added initialvalue for trace operators * chore: Added changes to prepare request payload * chore: fixed minor styles + minor ux fix * feat: added span selector * chore: added ui changes in the editor * chore: removed traceoperations and reused queryoperations * chore: minor changes in queryaddon and aggregation for support * chore: added traceoperators in alerts * chore: minor pr review change * chore: linter fix * fix: fixed minor ts issues * fix: added limit support in traceoperator * chore: minor fix in traceoperator styles * chore: linting fix + icon changes * chore: updated type * chore: lint fixes * feat: added changes for showing querynames in alerts * feat: added trace operator grammer + antlr files * feat: added traceoperator context util * chore: added traceoperator validation function * feat: added traceoperator editor * feat: added queryname boost + operator constants * fix: pr reviews * chore: minor ui fix * fix: updated grammer files * test: added test for traceoperatorcontext * chore: removed check for multiple queries in traceexplorer * test: minor test fix * test: fixed breaking mapQueryDataFromApi test * chore: fixed logic to show trace operator * chore: updated docs link * chore: minor ui issue fix * chore: changed trace operator query name * chore: removed using spans from in trace opeartors * fix: added fix for order by in trace opeartor * feat: added changes related to saved in views in trace opeartor * chore: added changes to keep indirect descendent operator at bottom * chore: removed returnspansfrom field from traceoperator * chore: updated file names + regenerated grammer * chore: added beta tag in trace opeartor * chore: pr review fixes * Fix/tsc trace operator + tests (#8942) * fix: added tsc fixes for trace operator * chore: moved traceoperator utils * test: added test for traceopertor util * chore: tsc fix * fix: fixed tsc issue * Feat/trace operator dashboards (#8992) * chore: added callout message for multiple queries without trace operators * feat: added changes for supporting trace operators in dashboards * chore: minor changes for list panel
146 lines
4.1 KiB
TypeScript
146 lines
4.1 KiB
TypeScript
/* eslint-disable @typescript-eslint/naming-convention */
|
|
|
|
export const OPERATORS = {
|
|
IN: 'IN',
|
|
LIKE: 'LIKE',
|
|
ILIKE: 'ILIKE',
|
|
REGEXP: 'REGEXP',
|
|
EXISTS: 'EXISTS',
|
|
CONTAINS: 'CONTAINS',
|
|
BETWEEN: 'BETWEEN',
|
|
NOT: 'NOT',
|
|
'=': '=',
|
|
'!=': '!=',
|
|
'>=': '>=',
|
|
'>': '>',
|
|
'<=': '<=',
|
|
'<': '<',
|
|
};
|
|
|
|
export const TRACE_OPERATOR_OPERATORS = {
|
|
AND: '&&',
|
|
OR: '||',
|
|
NOT: 'NOT',
|
|
DIRECT_DESCENDENT: '=>',
|
|
INDIRECT_DESCENDENT: '->',
|
|
};
|
|
|
|
export const TRACE_OPERATOR_OPERATORS_WITH_PRIORITY = {
|
|
[TRACE_OPERATOR_OPERATORS.DIRECT_DESCENDENT]: 1,
|
|
[TRACE_OPERATOR_OPERATORS.AND]: 2,
|
|
[TRACE_OPERATOR_OPERATORS.OR]: 3,
|
|
[TRACE_OPERATOR_OPERATORS.NOT]: 4,
|
|
[TRACE_OPERATOR_OPERATORS.INDIRECT_DESCENDENT]: 5,
|
|
};
|
|
|
|
export const TRACE_OPERATOR_OPERATORS_LABELS = {
|
|
[TRACE_OPERATOR_OPERATORS.DIRECT_DESCENDENT]: 'Direct Descendant',
|
|
[TRACE_OPERATOR_OPERATORS.INDIRECT_DESCENDENT]: 'Indirect Descendant',
|
|
};
|
|
|
|
export const QUERY_BUILDER_FUNCTIONS = {
|
|
HAS: 'has',
|
|
HASANY: 'hasAny',
|
|
HASALL: 'hasAll',
|
|
};
|
|
|
|
export function negateOperator(operatorOrFunction: string): string {
|
|
// Special cases for equals/not equals
|
|
if (operatorOrFunction === OPERATORS['=']) {
|
|
return OPERATORS['!='];
|
|
}
|
|
if (operatorOrFunction === OPERATORS['!=']) {
|
|
return OPERATORS['='];
|
|
}
|
|
// For all other operators and functions, add NOT in front
|
|
return `${OPERATORS.NOT} ${operatorOrFunction}`;
|
|
}
|
|
|
|
export enum DEPRECATED_OPERATORS {
|
|
REGEX = 'regex',
|
|
NIN = 'nin',
|
|
NREGEX = 'nregex',
|
|
NLIKE = 'nlike',
|
|
NILIKE = 'nilike',
|
|
NEXTISTS = 'nexists',
|
|
NCONTAINS = 'ncontains',
|
|
NHAS = 'nhas',
|
|
NHASANY = 'nhasany',
|
|
NHASALL = 'nhasall',
|
|
}
|
|
|
|
export const DEPRECATED_OPERATORS_MAP = {
|
|
[DEPRECATED_OPERATORS.REGEX]: OPERATORS.REGEXP,
|
|
[DEPRECATED_OPERATORS.NIN]: negateOperator(OPERATORS.IN),
|
|
[DEPRECATED_OPERATORS.NREGEX]: negateOperator(OPERATORS.REGEXP),
|
|
[DEPRECATED_OPERATORS.NLIKE]: negateOperator(OPERATORS.LIKE),
|
|
[DEPRECATED_OPERATORS.NILIKE]: negateOperator(OPERATORS.ILIKE),
|
|
[DEPRECATED_OPERATORS.NEXTISTS]: negateOperator(OPERATORS.EXISTS),
|
|
[DEPRECATED_OPERATORS.NCONTAINS]: negateOperator(OPERATORS.CONTAINS),
|
|
[DEPRECATED_OPERATORS.NHAS]: negateOperator(QUERY_BUILDER_FUNCTIONS.HAS),
|
|
[DEPRECATED_OPERATORS.NHASANY]: negateOperator(QUERY_BUILDER_FUNCTIONS.HASANY),
|
|
[DEPRECATED_OPERATORS.NHASALL]: negateOperator(QUERY_BUILDER_FUNCTIONS.HASALL),
|
|
};
|
|
|
|
export const NON_VALUE_OPERATORS = [OPERATORS.EXISTS];
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
export enum QUERY_BUILDER_KEY_TYPES {
|
|
STRING = 'string',
|
|
NUMBER = 'number',
|
|
BOOLEAN = 'boolean',
|
|
}
|
|
|
|
export const QUERY_BUILDER_OPERATORS_BY_KEY_TYPE = {
|
|
[QUERY_BUILDER_KEY_TYPES.STRING]: [
|
|
OPERATORS['='],
|
|
OPERATORS['!='],
|
|
OPERATORS.IN,
|
|
OPERATORS.LIKE,
|
|
OPERATORS.ILIKE,
|
|
OPERATORS.CONTAINS,
|
|
OPERATORS.EXISTS,
|
|
OPERATORS.REGEXP,
|
|
OPERATORS.NOT,
|
|
],
|
|
[QUERY_BUILDER_KEY_TYPES.NUMBER]: [
|
|
OPERATORS['='],
|
|
OPERATORS['!='],
|
|
OPERATORS['>='],
|
|
OPERATORS['>'],
|
|
OPERATORS['<='],
|
|
OPERATORS['<'],
|
|
OPERATORS.IN,
|
|
OPERATORS.EXISTS,
|
|
OPERATORS.BETWEEN,
|
|
OPERATORS.NOT,
|
|
],
|
|
[QUERY_BUILDER_KEY_TYPES.BOOLEAN]: [
|
|
OPERATORS['='],
|
|
OPERATORS['!='],
|
|
OPERATORS.EXISTS,
|
|
OPERATORS.NOT,
|
|
],
|
|
};
|
|
|
|
export const negationQueryOperatorSuggestions = [
|
|
{ label: OPERATORS.LIKE, type: 'operator', info: 'Like' },
|
|
{ label: OPERATORS.ILIKE, type: 'operator', info: 'Case insensitive like' },
|
|
{ label: OPERATORS.EXISTS, type: 'operator', info: 'Exists' },
|
|
{ label: OPERATORS.BETWEEN, type: 'operator', info: 'Between' },
|
|
{ label: OPERATORS.IN, type: 'operator', info: 'In' },
|
|
{ label: OPERATORS.REGEXP, type: 'operator', info: 'Regular expression' },
|
|
{ label: OPERATORS.CONTAINS, type: 'operator', info: 'Contains' },
|
|
];
|
|
|
|
export const queryOperatorSuggestions = [
|
|
{ label: OPERATORS['='], type: 'operator', info: 'Equal to' },
|
|
{ label: OPERATORS['!='], type: 'operator', info: 'Not equal to' },
|
|
{ label: OPERATORS['>'], type: 'operator', info: 'Greater than' },
|
|
{ label: OPERATORS['<'], type: 'operator', info: 'Less than' },
|
|
{ label: OPERATORS['>='], type: 'operator', info: 'Greater than or equal to' },
|
|
{ label: OPERATORS['<='], type: 'operator', info: 'Less than or equal to' },
|
|
{ label: OPERATORS.NOT, type: 'operator', info: 'Not' },
|
|
...negationQueryOperatorSuggestions,
|
|
];
|