mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 09:46:05 +08:00
feat: default types for the query builder is updated (#3369)
Co-authored-by: Rajat Dabade <rajat@signoz.io>
This commit is contained in:
parent
f8bfd1abc4
commit
2aef4578b0
@ -52,6 +52,7 @@ export const baseAutoCompleteIdKeysOrder: (keyof Omit<
|
|||||||
export const autocompleteType: Record<AutocompleteType, AutocompleteType> = {
|
export const autocompleteType: Record<AutocompleteType, AutocompleteType> = {
|
||||||
resource: 'resource',
|
resource: 'resource',
|
||||||
tag: 'tag',
|
tag: 'tag',
|
||||||
|
'': '',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const formulasNames: string[] = Array.from(
|
export const formulasNames: string[] = Array.from(
|
||||||
@ -111,10 +112,10 @@ export const initialAutocompleteData: BaseAutocompleteData = {
|
|||||||
{ dataType: null, key: '', isColumn: null, type: null },
|
{ dataType: null, key: '', isColumn: null, type: null },
|
||||||
baseAutoCompleteIdKeysOrder,
|
baseAutoCompleteIdKeysOrder,
|
||||||
),
|
),
|
||||||
dataType: null,
|
dataType: '',
|
||||||
key: '',
|
key: '',
|
||||||
isColumn: null,
|
isColumn: false,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initialFilters: TagFilter = {
|
export const initialFilters: TagFilter = {
|
||||||
|
@ -33,7 +33,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: null, dataType: null },
|
{ key: 'timestamp', isColumn: true, type: '', dataType: '' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const baseOptions = [
|
const baseOptions = [
|
||||||
|
@ -24,7 +24,7 @@ export const databaseCallsRPS = ({
|
|||||||
key: WidgetKeys.SignozDBLatencyCount,
|
key: WidgetKeys.SignozDBLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const groupBy: BaseAutocompleteData[] = [
|
const groupBy: BaseAutocompleteData[] = [
|
||||||
@ -67,13 +67,13 @@ export const databaseCallsAvgDuration = ({
|
|||||||
key: WidgetKeys.SignozDbLatencySum,
|
key: WidgetKeys.SignozDbLatencySum,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozDBLatencyCount,
|
key: WidgetKeys.SignozDBLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const additionalItemsA: TagFilterItem[] = [
|
const additionalItemsA: TagFilterItem[] = [
|
||||||
|
@ -35,13 +35,13 @@ export const externalCallErrorPercent = ({
|
|||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const additionalItemsA: TagFilterItem[] = [
|
const additionalItemsA: TagFilterItem[] = [
|
||||||
@ -118,13 +118,13 @@ export const externalCallDuration = ({
|
|||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencySum,
|
key: WidgetKeys.SignozExternalCallLatencySum,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
const expressions = [FORMULA.DATABASE_CALLS_AVG_DURATION];
|
const expressions = [FORMULA.DATABASE_CALLS_AVG_DURATION];
|
||||||
const legendFormulas = ['Average Duration'];
|
const legendFormulas = ['Average Duration'];
|
||||||
@ -177,7 +177,7 @@ export const externalCallRpsByAddress = ({
|
|||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
type: null,
|
type: '',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const filterItems: TagFilterItem[][] = [
|
const filterItems: TagFilterItem[][] = [
|
||||||
@ -218,13 +218,13 @@ export const externalCallDurationByAddress = ({
|
|||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencySum,
|
key: WidgetKeys.SignozExternalCallLatencySum,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
const expressions = [FORMULA.DATABASE_CALLS_AVG_DURATION];
|
const expressions = [FORMULA.DATABASE_CALLS_AVG_DURATION];
|
||||||
const legendFormulas = [legend];
|
const legendFormulas = [legend];
|
||||||
|
@ -42,7 +42,7 @@ export const latency = ({
|
|||||||
: WidgetKeys.DurationNano,
|
: WidgetKeys.DurationNano,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: isSpanMetricEnable ? null : MetricsType.Tag,
|
type: isSpanMetricEnable ? '' : MetricsType.Tag,
|
||||||
};
|
};
|
||||||
|
|
||||||
const autocompleteData = Array(3).fill(newAutoCompleteData);
|
const autocompleteData = Array(3).fill(newAutoCompleteData);
|
||||||
@ -101,21 +101,21 @@ export const apDexTracesQueryBuilderQueries = ({
|
|||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: '',
|
key: '',
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autoCompleteDataB: BaseAutocompleteData = {
|
const autoCompleteDataB: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: '',
|
key: '',
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autoCompleteDataC: BaseAutocompleteData = {
|
const autoCompleteDataC: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: '',
|
key: '',
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterItemA: TagFilterItem[] = [
|
const filterItemA: TagFilterItem[] = [
|
||||||
@ -279,21 +279,21 @@ export const apDexMetricsQueryBuilderQueries = ({
|
|||||||
key: WidgetKeys.SignozLatencyCount,
|
key: WidgetKeys.SignozLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autoCompleteDataB: BaseAutocompleteData = {
|
const autoCompleteDataB: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.Signoz_latency_bucket,
|
key: WidgetKeys.Signoz_latency_bucket,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autoCompleteDataC: BaseAutocompleteData = {
|
const autoCompleteDataC: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.Signoz_latency_bucket,
|
key: WidgetKeys.Signoz_latency_bucket,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterItemA: TagFilterItem[] = [
|
const filterItemA: TagFilterItem[] = [
|
||||||
@ -460,7 +460,7 @@ export const operationPerSec = ({
|
|||||||
key: WidgetKeys.SignozLatencyCount,
|
key: WidgetKeys.SignozLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -512,13 +512,13 @@ export const errorPercentage = ({
|
|||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
const autocompleteDataB: BaseAutocompleteData = {
|
const autocompleteDataB: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autocompleteData = [autocompleteDataA, autocompleteDataB];
|
const autocompleteData = [autocompleteDataA, autocompleteDataB];
|
||||||
|
@ -24,21 +24,21 @@ export const topOperationQueries = ({
|
|||||||
key: WidgetKeys.Signoz_latency_bucket,
|
key: WidgetKeys.Signoz_latency_bucket,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const numOfCallAutoCompleteData: BaseAutocompleteData = {
|
const numOfCallAutoCompleteData: BaseAutocompleteData = {
|
||||||
key: WidgetKeys.SignozLatencyCount,
|
key: WidgetKeys.SignozLatencyCount,
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const latencyAndNumberOfCallAdditionalItems: TagFilterItem[] = [
|
const latencyAndNumberOfCallAdditionalItems: TagFilterItem[] = [
|
||||||
|
@ -54,7 +54,7 @@ const useOptionsMenu = ({
|
|||||||
() => ({
|
() => ({
|
||||||
searchText: '',
|
searchText: '',
|
||||||
aggregateAttribute: '',
|
aggregateAttribute: '',
|
||||||
tagType: null,
|
tagType: undefined,
|
||||||
dataSource,
|
dataSource,
|
||||||
aggregateOperator,
|
aggregateOperator,
|
||||||
}),
|
}),
|
||||||
|
@ -137,9 +137,9 @@ function QueryBuilderSearch({
|
|||||||
id: uuid().slice(0, 8),
|
id: uuid().slice(0, 8),
|
||||||
key: filterAttribute ?? {
|
key: filterAttribute ?? {
|
||||||
key: tagKey,
|
key: tagKey,
|
||||||
dataType: null,
|
dataType: '',
|
||||||
type: null,
|
type: '',
|
||||||
isColumn: null,
|
isColumn: false,
|
||||||
},
|
},
|
||||||
op: getOperatorValue(tagOperator),
|
op: getOperatorValue(tagOperator),
|
||||||
value:
|
value:
|
||||||
|
@ -22,21 +22,21 @@ export const serviceMetricsQuery = (
|
|||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.Signoz_latency_bucket,
|
key: WidgetKeys.Signoz_latency_bucket,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const operationPrSecondAutoCompleteData: BaseAutocompleteData = {
|
const operationPrSecondAutoCompleteData: BaseAutocompleteData = {
|
||||||
dataType: DataType.FLOAT64,
|
dataType: DataType.FLOAT64,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
key: WidgetKeys.SignozCallsTotal,
|
key: WidgetKeys.SignozCallsTotal,
|
||||||
type: null,
|
type: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const autocompleteData = [
|
const autocompleteData = [
|
||||||
|
@ -109,8 +109,8 @@ 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 ?? null,
|
filterAttributeKeyDataType: filterAttributeKey?.dataType ?? '',
|
||||||
tagType: filterAttributeKey?.type ?? null,
|
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
|
||||||
: tagValue?.toString() ?? '',
|
: tagValue?.toString() ?? '',
|
||||||
|
@ -82,7 +82,7 @@ export const resourceAttributesToTagFilterItems = (
|
|||||||
|
|
||||||
return queries.map((res) => ({
|
return queries.map((res) => ({
|
||||||
id: `${res.id}`,
|
id: `${res.id}`,
|
||||||
key: { key: res.tagKey, isColumn: false, type: null, dataType: null },
|
key: { key: res.tagKey, isColumn: false, type: '', dataType: '' },
|
||||||
op: `${res.operator}`,
|
op: `${res.operator}`,
|
||||||
value: `${res.tagValue}`.split(','),
|
value: `${res.tagValue}`.split(','),
|
||||||
}));
|
}));
|
||||||
|
@ -46,7 +46,7 @@ export const getPaginationQueryData: SetupPaginationQueryData = ({
|
|||||||
id: uuid(),
|
id: uuid(),
|
||||||
key: {
|
key: {
|
||||||
key: 'id',
|
key: 'id',
|
||||||
type: null,
|
type: '',
|
||||||
dataType: 'string',
|
dataType: 'string',
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
},
|
},
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
export type LocalDataType = 'number' | 'string' | 'bool';
|
export type LocalDataType = 'number' | 'string' | 'bool';
|
||||||
|
|
||||||
export type DataType = 'int64' | 'float64' | 'string' | 'bool';
|
export type DataType = 'int64' | 'float64' | 'string' | 'bool' | '';
|
||||||
|
|
||||||
export type AutocompleteType = 'tag' | 'resource';
|
export type AutocompleteType = 'tag' | 'resource' | '';
|
||||||
|
|
||||||
export interface BaseAutocompleteData {
|
export interface BaseAutocompleteData {
|
||||||
id?: string;
|
id?: string;
|
||||||
dataType: DataType | null;
|
dataType: DataType;
|
||||||
isColumn: boolean | null;
|
isColumn: boolean;
|
||||||
key: string;
|
key: string;
|
||||||
type: AutocompleteType | null;
|
type: AutocompleteType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IQueryAutocompleteResponse {
|
export interface IQueryAutocompleteResponse {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user