mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-29 16:14:42 +00:00
* 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>
133 lines
2.8 KiB
TypeScript
133 lines
2.8 KiB
TypeScript
import { OPERATORS } from 'constants/queryBuilder';
|
|
import {
|
|
BaseAutocompleteData,
|
|
DataTypes,
|
|
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
|
import {
|
|
DataSource,
|
|
MetricAggregateOperator,
|
|
QueryBuilderData,
|
|
} from 'types/common/queryBuilder';
|
|
|
|
import { FORMULA, MetricsType, WidgetKeys } from '../constant';
|
|
import { DatabaseCallProps, DatabaseCallsRPSProps } from '../types';
|
|
import {
|
|
getQueryBuilderQueries,
|
|
getQueryBuilderQuerieswithFormula,
|
|
} from './MetricsPageQueriesFactory';
|
|
|
|
export const databaseCallsRPS = ({
|
|
servicename,
|
|
legend,
|
|
tagFilterItems,
|
|
}: DatabaseCallsRPSProps): QueryBuilderData => {
|
|
const autocompleteData: BaseAutocompleteData[] = [
|
|
{
|
|
key: WidgetKeys.SignozDBLatencyCount,
|
|
dataType: DataTypes.Float64,
|
|
isColumn: true,
|
|
type: '',
|
|
},
|
|
];
|
|
const groupBy: BaseAutocompleteData[] = [
|
|
{
|
|
dataType: DataTypes.String,
|
|
isColumn: false,
|
|
key: 'db_system',
|
|
type: 'tag',
|
|
},
|
|
];
|
|
const filterItems: TagFilterItem[][] = [
|
|
[
|
|
{
|
|
id: '',
|
|
key: {
|
|
key: WidgetKeys.Service_name,
|
|
dataType: DataTypes.String,
|
|
isColumn: false,
|
|
type: MetricsType.Resource,
|
|
},
|
|
op: OPERATORS.IN,
|
|
value: [`${servicename}`],
|
|
},
|
|
...tagFilterItems,
|
|
],
|
|
];
|
|
|
|
const legends = [legend];
|
|
const dataSource = DataSource.METRICS;
|
|
|
|
return getQueryBuilderQueries({
|
|
autocompleteData,
|
|
groupBy,
|
|
legends,
|
|
filterItems,
|
|
dataSource,
|
|
});
|
|
};
|
|
|
|
export const databaseCallsAvgDuration = ({
|
|
servicename,
|
|
tagFilterItems,
|
|
}: DatabaseCallProps): QueryBuilderData => {
|
|
const autocompleteDataA: BaseAutocompleteData = {
|
|
key: WidgetKeys.SignozDbLatencySum,
|
|
dataType: DataTypes.Float64,
|
|
isColumn: true,
|
|
type: '',
|
|
};
|
|
const autocompleteDataB: BaseAutocompleteData = {
|
|
key: WidgetKeys.SignozDBLatencyCount,
|
|
dataType: DataTypes.Float64,
|
|
isColumn: true,
|
|
type: '',
|
|
};
|
|
|
|
const additionalItemsA: TagFilterItem[] = [
|
|
{
|
|
id: '',
|
|
key: {
|
|
key: WidgetKeys.Service_name,
|
|
dataType: DataTypes.String,
|
|
isColumn: false,
|
|
type: MetricsType.Resource,
|
|
},
|
|
op: OPERATORS.IN,
|
|
value: [servicename],
|
|
},
|
|
...tagFilterItems,
|
|
];
|
|
|
|
const autocompleteData: BaseAutocompleteData[] = [
|
|
autocompleteDataA,
|
|
autocompleteDataB,
|
|
];
|
|
|
|
const additionalItems: TagFilterItem[][] = [
|
|
additionalItemsA,
|
|
additionalItemsA,
|
|
];
|
|
|
|
const legends = ['', ''];
|
|
const disabled = [true, true];
|
|
const legendFormulas = ['Average Duration'];
|
|
const expressions = [FORMULA.DATABASE_CALLS_AVG_DURATION];
|
|
const aggregateOperators = [
|
|
MetricAggregateOperator.SUM,
|
|
MetricAggregateOperator.SUM,
|
|
];
|
|
const dataSource = DataSource.METRICS;
|
|
|
|
return getQueryBuilderQuerieswithFormula({
|
|
autocompleteData,
|
|
additionalItems,
|
|
legends,
|
|
disabled,
|
|
expressions,
|
|
legendFormulas,
|
|
aggregateOperators,
|
|
dataSource,
|
|
});
|
|
};
|