mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 16:59:04 +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> = {
|
||||
resource: 'resource',
|
||||
tag: 'tag',
|
||||
'': '',
|
||||
};
|
||||
|
||||
export const formulasNames: string[] = Array.from(
|
||||
@ -111,10 +112,10 @@ export const initialAutocompleteData: BaseAutocompleteData = {
|
||||
{ dataType: null, key: '', isColumn: null, type: null },
|
||||
baseAutoCompleteIdKeysOrder,
|
||||
),
|
||||
dataType: null,
|
||||
dataType: '',
|
||||
key: '',
|
||||
isColumn: null,
|
||||
type: null,
|
||||
isColumn: false,
|
||||
type: '',
|
||||
};
|
||||
|
||||
export const initialFilters: TagFilter = {
|
||||
|
@ -33,7 +33,7 @@ function ExplorerOrderBy({ query, onChange }: OrderByFilterProps): JSX.Element {
|
||||
const keysOptions = createOptions(data?.payload?.attributeKeys || []);
|
||||
|
||||
const customOptions = createOptions([
|
||||
{ key: 'timestamp', isColumn: true, type: null, dataType: null },
|
||||
{ key: 'timestamp', isColumn: true, type: '', dataType: '' },
|
||||
]);
|
||||
|
||||
const baseOptions = [
|
||||
|
@ -24,7 +24,7 @@ export const databaseCallsRPS = ({
|
||||
key: WidgetKeys.SignozDBLatencyCount,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
},
|
||||
];
|
||||
const groupBy: BaseAutocompleteData[] = [
|
||||
@ -67,13 +67,13 @@ export const databaseCallsAvgDuration = ({
|
||||
key: WidgetKeys.SignozDbLatencySum,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
const autocompleteDataB: BaseAutocompleteData = {
|
||||
key: WidgetKeys.SignozDBLatencyCount,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const additionalItemsA: TagFilterItem[] = [
|
||||
|
@ -35,13 +35,13 @@ export const externalCallErrorPercent = ({
|
||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
const autocompleteDataB: BaseAutocompleteData = {
|
||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const additionalItemsA: TagFilterItem[] = [
|
||||
@ -118,13 +118,13 @@ export const externalCallDuration = ({
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: WidgetKeys.SignozExternalCallLatencySum,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
const autocompleteDataB: BaseAutocompleteData = {
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
const expressions = [FORMULA.DATABASE_CALLS_AVG_DURATION];
|
||||
const legendFormulas = ['Average Duration'];
|
||||
@ -177,7 +177,7 @@ export const externalCallRpsByAddress = ({
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||
type: null,
|
||||
type: '',
|
||||
},
|
||||
];
|
||||
const filterItems: TagFilterItem[][] = [
|
||||
@ -218,13 +218,13 @@ export const externalCallDurationByAddress = ({
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: WidgetKeys.SignozExternalCallLatencySum,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
const autocompleteDataB: BaseAutocompleteData = {
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: WidgetKeys.SignozExternalCallLatencyCount,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
const expressions = [FORMULA.DATABASE_CALLS_AVG_DURATION];
|
||||
const legendFormulas = [legend];
|
||||
|
@ -42,7 +42,7 @@ export const latency = ({
|
||||
: WidgetKeys.DurationNano,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: isSpanMetricEnable ? null : MetricsType.Tag,
|
||||
type: isSpanMetricEnable ? '' : MetricsType.Tag,
|
||||
};
|
||||
|
||||
const autocompleteData = Array(3).fill(newAutoCompleteData);
|
||||
@ -101,21 +101,21 @@ export const apDexTracesQueryBuilderQueries = ({
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: '',
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const autoCompleteDataB: BaseAutocompleteData = {
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: '',
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const autoCompleteDataC: BaseAutocompleteData = {
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: '',
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const filterItemA: TagFilterItem[] = [
|
||||
@ -279,21 +279,21 @@ export const apDexMetricsQueryBuilderQueries = ({
|
||||
key: WidgetKeys.SignozLatencyCount,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const autoCompleteDataB: BaseAutocompleteData = {
|
||||
key: WidgetKeys.Signoz_latency_bucket,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const autoCompleteDataC: BaseAutocompleteData = {
|
||||
key: WidgetKeys.Signoz_latency_bucket,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const filterItemA: TagFilterItem[] = [
|
||||
@ -460,7 +460,7 @@ export const operationPerSec = ({
|
||||
key: WidgetKeys.SignozLatencyCount,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
},
|
||||
];
|
||||
|
||||
@ -512,13 +512,13 @@ export const errorPercentage = ({
|
||||
key: WidgetKeys.SignozCallsTotal,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
const autocompleteDataB: BaseAutocompleteData = {
|
||||
key: WidgetKeys.SignozCallsTotal,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const autocompleteData = [autocompleteDataA, autocompleteDataB];
|
||||
|
@ -24,21 +24,21 @@ export const topOperationQueries = ({
|
||||
key: WidgetKeys.Signoz_latency_bucket,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
||||
key: WidgetKeys.SignozCallsTotal,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const numOfCallAutoCompleteData: BaseAutocompleteData = {
|
||||
key: WidgetKeys.SignozLatencyCount,
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const latencyAndNumberOfCallAdditionalItems: TagFilterItem[] = [
|
||||
|
@ -54,7 +54,7 @@ const useOptionsMenu = ({
|
||||
() => ({
|
||||
searchText: '',
|
||||
aggregateAttribute: '',
|
||||
tagType: null,
|
||||
tagType: undefined,
|
||||
dataSource,
|
||||
aggregateOperator,
|
||||
}),
|
||||
|
@ -137,9 +137,9 @@ function QueryBuilderSearch({
|
||||
id: uuid().slice(0, 8),
|
||||
key: filterAttribute ?? {
|
||||
key: tagKey,
|
||||
dataType: null,
|
||||
type: null,
|
||||
isColumn: null,
|
||||
dataType: '',
|
||||
type: '',
|
||||
isColumn: false,
|
||||
},
|
||||
op: getOperatorValue(tagOperator),
|
||||
value:
|
||||
|
@ -22,21 +22,21 @@ export const serviceMetricsQuery = (
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: WidgetKeys.Signoz_latency_bucket,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const errorRateAutoCompleteData: BaseAutocompleteData = {
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: WidgetKeys.SignozCallsTotal,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const operationPrSecondAutoCompleteData: BaseAutocompleteData = {
|
||||
dataType: DataType.FLOAT64,
|
||||
isColumn: true,
|
||||
key: WidgetKeys.SignozCallsTotal,
|
||||
type: null,
|
||||
type: '',
|
||||
};
|
||||
|
||||
const autocompleteData = [
|
||||
|
@ -109,8 +109,8 @@ export const useFetchKeysAndValues = (
|
||||
dataSource: query.dataSource,
|
||||
aggregateAttribute: query.aggregateAttribute.key,
|
||||
attributeKey: filterAttributeKey?.key ?? tagKey,
|
||||
filterAttributeKeyDataType: filterAttributeKey?.dataType ?? null,
|
||||
tagType: filterAttributeKey?.type ?? null,
|
||||
filterAttributeKeyDataType: filterAttributeKey?.dataType ?? '',
|
||||
tagType: filterAttributeKey?.type ?? '',
|
||||
searchText: isInNInOperator(tagOperator)
|
||||
? tagValue[tagValue.length - 1]?.toString() ?? '' // last element of tagvalue will be always user search value
|
||||
: tagValue?.toString() ?? '',
|
||||
|
@ -82,7 +82,7 @@ export const resourceAttributesToTagFilterItems = (
|
||||
|
||||
return queries.map((res) => ({
|
||||
id: `${res.id}`,
|
||||
key: { key: res.tagKey, isColumn: false, type: null, dataType: null },
|
||||
key: { key: res.tagKey, isColumn: false, type: '', dataType: '' },
|
||||
op: `${res.operator}`,
|
||||
value: `${res.tagValue}`.split(','),
|
||||
}));
|
||||
|
@ -46,7 +46,7 @@ export const getPaginationQueryData: SetupPaginationQueryData = ({
|
||||
id: uuid(),
|
||||
key: {
|
||||
key: 'id',
|
||||
type: null,
|
||||
type: '',
|
||||
dataType: 'string',
|
||||
isColumn: true,
|
||||
},
|
||||
|
@ -1,15 +1,15 @@
|
||||
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 {
|
||||
id?: string;
|
||||
dataType: DataType | null;
|
||||
isColumn: boolean | null;
|
||||
dataType: DataType;
|
||||
isColumn: boolean;
|
||||
key: string;
|
||||
type: AutocompleteType | null;
|
||||
type: AutocompleteType;
|
||||
}
|
||||
|
||||
export interface IQueryAutocompleteResponse {
|
||||
|
Loading…
x
Reference in New Issue
Block a user