* 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
109 lines
2.8 KiB
TypeScript
109 lines
2.8 KiB
TypeScript
import './QueryAggregation.styles.scss';
|
|
|
|
import { Tooltip } from 'antd';
|
|
import InputWithLabel from 'components/InputWithLabel/InputWithLabel';
|
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
|
import { useMemo } from 'react';
|
|
import {
|
|
IBuilderQuery,
|
|
IBuilderTraceOperator,
|
|
} from 'types/api/queryBuilder/queryBuilderData';
|
|
import { DataSource } from 'types/common/queryBuilder';
|
|
|
|
import QueryAggregationSelect from './QueryAggregationSelect';
|
|
|
|
function QueryAggregationOptions({
|
|
dataSource,
|
|
panelType,
|
|
onAggregationIntervalChange,
|
|
onChange,
|
|
queryData,
|
|
}: {
|
|
dataSource: DataSource;
|
|
panelType?: string;
|
|
onAggregationIntervalChange: (value: number) => void;
|
|
onChange?: (value: string) => void;
|
|
queryData: IBuilderQuery | IBuilderTraceOperator;
|
|
}): JSX.Element {
|
|
const showAggregationInterval = useMemo(() => {
|
|
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
if (panelType === PANEL_TYPES.VALUE) {
|
|
return false;
|
|
}
|
|
|
|
if (dataSource === DataSource.TRACES || dataSource === DataSource.LOGS) {
|
|
return !(panelType === PANEL_TYPES.TABLE || panelType === PANEL_TYPES.PIE);
|
|
}
|
|
|
|
return true;
|
|
}, [dataSource, panelType]);
|
|
|
|
const handleAggregationIntervalChange = (value: string): void => {
|
|
onAggregationIntervalChange(Number(value));
|
|
};
|
|
|
|
return (
|
|
<div className="query-aggregation-container">
|
|
<div className="aggregation-container">
|
|
<QueryAggregationSelect
|
|
onChange={onChange}
|
|
queryData={queryData}
|
|
maxAggregations={
|
|
panelType === PANEL_TYPES.VALUE || panelType === PANEL_TYPES.PIE
|
|
? 1
|
|
: undefined
|
|
}
|
|
/>
|
|
|
|
{showAggregationInterval && (
|
|
<div className="query-aggregation-interval">
|
|
<Tooltip
|
|
title={
|
|
<div>
|
|
Set the time interval for aggregation
|
|
<br />
|
|
<a
|
|
href="https://signoz.io/docs/userguide/query-builder-v5/#time-aggregation-windows"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
style={{ color: '#1890ff', textDecoration: 'underline' }}
|
|
>
|
|
Learn about step intervals
|
|
</a>
|
|
</div>
|
|
}
|
|
placement="top"
|
|
>
|
|
<div
|
|
className="metrics-aggregation-section-content-item-label"
|
|
style={{ cursor: 'help' }}
|
|
>
|
|
every
|
|
</div>
|
|
</Tooltip>
|
|
|
|
<div className="query-aggregation-interval-input-container">
|
|
<InputWithLabel
|
|
initialValue={queryData?.stepInterval ? queryData?.stepInterval : null}
|
|
className="query-aggregation-interval-input"
|
|
label="Seconds"
|
|
placeholder="Auto"
|
|
type="number"
|
|
onChange={handleAggregationIntervalChange}
|
|
labelAfter
|
|
/>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
QueryAggregationOptions.defaultProps = {
|
|
panelType: null,
|
|
onChange: undefined,
|
|
};
|
|
|
|
export default QueryAggregationOptions;
|