mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-29 16:14:42 +00:00
* refactor: generic querybuilderWithFormula * refactor: added generic datasource * refactor: dynamic disabled in getQueryBuilderQueriesWithFormula * refactor: generic legend for building query with formulas * feat: added new TopOperationMetrics component for key operation * refactor: added feature flag for key operation * refactor: shifted types and fixed typos * refactor: separated types and renamed file * refactor: one on one mapping * refactor: added clickable link for navigating to traces * chore: separated types * chore: removed unnecessary comments * refactor: one on one mapping for DBCallQueries * refactor: seperated types and one on one mapping for externalQueries * refactor: separate type from metricsPagesQueriesFactory * refactor: separated types and one on one mapping for overviewQueries * refactor: remove the type inforcement from TopOperationQueries.ts * refactor: one on one mapping in TopOperationQueries.ts * refactor: one on one mapping and remove the unwanted code * refactor: shifted logic of navigating to traces to utils * refactor: separated renderColumnCell from the TopOperationMetric component * refactor: generic tableRenderer * refactor: made getTableColumnRenderer more generic * chore: title is updated --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com>
134 lines
2.9 KiB
TypeScript
134 lines
2.9 KiB
TypeScript
import { OPERATORS } from 'constants/queryBuilder';
|
|
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
|
import {
|
|
DataSource,
|
|
MetricAggregateOperator,
|
|
QueryBuilderData,
|
|
} from 'types/common/queryBuilder';
|
|
|
|
import { DataType, FORMULA, MetricsType, WidgetKeys } from '../constant';
|
|
import { IServiceName } from '../Tabs/types';
|
|
import {
|
|
getQueryBuilderQueries,
|
|
getQueryBuilderQuerieswithFormula,
|
|
} from './MetricsPageQueriesFactory';
|
|
|
|
export const databaseCallsRPS = ({
|
|
servicename,
|
|
legend,
|
|
tagFilterItems,
|
|
}: DatabaseCallsRPSProps): QueryBuilderData => {
|
|
const autocompleteData: BaseAutocompleteData[] = [
|
|
{
|
|
key: WidgetKeys.SignozDBLatencyCount,
|
|
dataType: DataType.FLOAT64,
|
|
isColumn: true,
|
|
type: null,
|
|
},
|
|
];
|
|
const groupBy: BaseAutocompleteData[] = [
|
|
{ dataType: DataType.STRING, isColumn: false, key: 'db_system', type: 'tag' },
|
|
];
|
|
const filterItems: TagFilterItem[][] = [
|
|
[
|
|
{
|
|
id: '',
|
|
key: {
|
|
key: WidgetKeys.Service_name,
|
|
dataType: DataType.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: DataType.FLOAT64,
|
|
isColumn: true,
|
|
type: null,
|
|
};
|
|
const autocompleteDataB: BaseAutocompleteData = {
|
|
key: WidgetKeys.SignozDBLatencyCount,
|
|
dataType: DataType.FLOAT64,
|
|
isColumn: true,
|
|
type: null,
|
|
};
|
|
|
|
const additionalItemsA: TagFilterItem[] = [
|
|
{
|
|
id: '',
|
|
key: {
|
|
key: WidgetKeys.Service_name,
|
|
dataType: DataType.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 legendFormula = 'Average Duration';
|
|
const expression = FORMULA.DATABASE_CALLS_AVG_DURATION;
|
|
const aggregateOperators = [
|
|
MetricAggregateOperator.SUM,
|
|
MetricAggregateOperator.SUM,
|
|
];
|
|
const dataSource = DataSource.METRICS;
|
|
|
|
return getQueryBuilderQuerieswithFormula({
|
|
autocompleteData,
|
|
additionalItems,
|
|
legends,
|
|
disabled,
|
|
expression,
|
|
legendFormula,
|
|
aggregateOperators,
|
|
dataSource,
|
|
});
|
|
};
|
|
|
|
interface DatabaseCallsRPSProps extends DatabaseCallProps {
|
|
legend: '{{db_system}}';
|
|
}
|
|
|
|
interface DatabaseCallProps {
|
|
servicename: IServiceName['servicename'];
|
|
tagFilterItems: TagFilterItem[];
|
|
}
|