mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 05:36:03 +08:00
USE_SPAN_METRICS for latency graph on Feature flag (#3172)
This commit is contained in:
parent
98a2ef4080
commit
6d7081a4bd
@ -8,4 +8,5 @@ export enum FeatureKeys {
|
|||||||
QUERY_BUILDER_PANELS = 'QUERY_BUILDER_PANELS',
|
QUERY_BUILDER_PANELS = 'QUERY_BUILDER_PANELS',
|
||||||
QUERY_BUILDER_ALERTS = 'QUERY_BUILDER_ALERTS',
|
QUERY_BUILDER_ALERTS = 'QUERY_BUILDER_ALERTS',
|
||||||
DISABLE_UPSELL = 'DISABLE_UPSELL',
|
DISABLE_UPSELL = 'DISABLE_UPSELL',
|
||||||
|
USE_SPAN_METRICS = 'USE_SPAN_METRICS',
|
||||||
}
|
}
|
||||||
|
@ -43,11 +43,11 @@ export const getQueryBuilderQueries = ({
|
|||||||
inputFormat: 'ns',
|
inputFormat: 'ns',
|
||||||
start: store.getState().globalTime.minTime,
|
start: store.getState().globalTime.minTime,
|
||||||
}),
|
}),
|
||||||
reduceTo: 'sum',
|
|
||||||
filters: {
|
filters: {
|
||||||
items: filterItems[index],
|
items: filterItems[index],
|
||||||
op: 'AND',
|
op: 'AND',
|
||||||
},
|
},
|
||||||
|
reduceTo: 'sum',
|
||||||
dataSource,
|
dataSource,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@ import {
|
|||||||
DataType,
|
DataType,
|
||||||
FORMULA,
|
FORMULA,
|
||||||
GraphTitle,
|
GraphTitle,
|
||||||
LETENCY_LEGENDS_AGGREGATEOPERATOR,
|
LATENCY_AGGREGATEOPERATOR,
|
||||||
|
LATENCY_AGGREGATEOPERATOR_SPAN_METRICS,
|
||||||
MetricsType,
|
MetricsType,
|
||||||
OPERATION_LEGENDS,
|
OPERATION_LEGENDS,
|
||||||
QUERYNAME_AND_EXPRESSION,
|
QUERYNAME_AND_EXPRESSION,
|
||||||
@ -22,79 +23,58 @@ import {
|
|||||||
export const latency = ({
|
export const latency = ({
|
||||||
servicename,
|
servicename,
|
||||||
tagFilterItems,
|
tagFilterItems,
|
||||||
|
isSpanMetricEnable = false,
|
||||||
|
topLevelOperationsRoute,
|
||||||
}: LatencyProps): QueryBuilderData => {
|
}: LatencyProps): QueryBuilderData => {
|
||||||
const autocompleteData: BaseAutocompleteData[] = [
|
const newAutoCompleteData: BaseAutocompleteData = {
|
||||||
|
key: isSpanMetricEnable
|
||||||
|
? WidgetKeys.Signoz_latency_bucket
|
||||||
|
: WidgetKeys.DurationNano,
|
||||||
|
dataType: DataType.FLOAT64,
|
||||||
|
isColumn: true,
|
||||||
|
type: isSpanMetricEnable ? null : MetricsType.Tag,
|
||||||
|
};
|
||||||
|
|
||||||
|
const autocompleteData: BaseAutocompleteData[] = Array(3).fill(
|
||||||
|
newAutoCompleteData,
|
||||||
|
);
|
||||||
|
|
||||||
|
const filterItem: TagFilterItem[] = [
|
||||||
{
|
{
|
||||||
key: WidgetKeys.DurationNano,
|
id: '',
|
||||||
dataType: DataType.FLOAT64,
|
key: {
|
||||||
isColumn: true,
|
key: isSpanMetricEnable ? WidgetKeys.Service_name : WidgetKeys.ServiceName,
|
||||||
type: MetricsType.Tag,
|
dataType: DataType.STRING,
|
||||||
|
type: isSpanMetricEnable ? MetricsType.Resource : MetricsType.Tag,
|
||||||
|
isColumn: !isSpanMetricEnable,
|
||||||
|
},
|
||||||
|
op: isSpanMetricEnable ? OPERATORS.IN : OPERATORS['='],
|
||||||
|
value: isSpanMetricEnable ? [servicename] : servicename,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: WidgetKeys.DurationNano,
|
id: '',
|
||||||
dataType: DataType.FLOAT64,
|
key: {
|
||||||
isColumn: true,
|
dataType: DataType.STRING,
|
||||||
type: MetricsType.Tag,
|
isColumn: !isSpanMetricEnable,
|
||||||
},
|
key: isSpanMetricEnable ? WidgetKeys.Operation : WidgetKeys.Name,
|
||||||
{
|
type: MetricsType.Tag,
|
||||||
key: WidgetKeys.DurationNano,
|
},
|
||||||
dataType: DataType.FLOAT64,
|
op: OPERATORS.IN.toLowerCase(), // TODO: need to remove toLowerCase() this once backend is changed
|
||||||
isColumn: true,
|
value: [...topLevelOperationsRoute],
|
||||||
type: MetricsType.Tag,
|
|
||||||
},
|
},
|
||||||
|
...tagFilterItems,
|
||||||
];
|
];
|
||||||
|
|
||||||
const filterItems: TagFilterItem[][] = [
|
const filterItems: TagFilterItem[][] = Array(3).fill([...filterItem]);
|
||||||
[
|
|
||||||
{
|
|
||||||
id: '',
|
|
||||||
key: {
|
|
||||||
key: WidgetKeys.ServiceName,
|
|
||||||
dataType: DataType.STRING,
|
|
||||||
type: MetricsType.Tag,
|
|
||||||
isColumn: true,
|
|
||||||
},
|
|
||||||
op: OPERATORS['='],
|
|
||||||
value: `${servicename}`,
|
|
||||||
},
|
|
||||||
...tagFilterItems,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
id: '',
|
|
||||||
key: {
|
|
||||||
key: WidgetKeys.ServiceName,
|
|
||||||
dataType: DataType.STRING,
|
|
||||||
type: MetricsType.Tag,
|
|
||||||
isColumn: true,
|
|
||||||
},
|
|
||||||
op: OPERATORS['='],
|
|
||||||
value: `${servicename}`,
|
|
||||||
},
|
|
||||||
...tagFilterItems,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
id: '',
|
|
||||||
key: {
|
|
||||||
key: WidgetKeys.ServiceName,
|
|
||||||
dataType: DataType.STRING,
|
|
||||||
type: MetricsType.Tag,
|
|
||||||
isColumn: true,
|
|
||||||
},
|
|
||||||
op: OPERATORS['='],
|
|
||||||
value: `${servicename}`,
|
|
||||||
},
|
|
||||||
...tagFilterItems,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
return getQueryBuilderQueries({
|
return getQueryBuilderQueries({
|
||||||
autocompleteData,
|
autocompleteData,
|
||||||
legends: LETENCY_LEGENDS_AGGREGATEOPERATOR,
|
legends: LATENCY_AGGREGATEOPERATOR,
|
||||||
filterItems,
|
filterItems,
|
||||||
aggregateOperator: LETENCY_LEGENDS_AGGREGATEOPERATOR,
|
aggregateOperator: isSpanMetricEnable
|
||||||
dataSource: DataSource.TRACES,
|
? LATENCY_AGGREGATEOPERATOR_SPAN_METRICS
|
||||||
|
: LATENCY_AGGREGATEOPERATOR,
|
||||||
|
dataSource: isSpanMetricEnable ? DataSource.METRICS : DataSource.TRACES,
|
||||||
queryNameAndExpression: QUERYNAME_AND_EXPRESSION,
|
queryNameAndExpression: QUERYNAME_AND_EXPRESSION,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -250,4 +230,6 @@ export interface OperationPerSecProps {
|
|||||||
export interface LatencyProps {
|
export interface LatencyProps {
|
||||||
servicename: IServiceName['servicename'];
|
servicename: IServiceName['servicename'];
|
||||||
tagFilterItems: TagFilterItem[];
|
tagFilterItems: TagFilterItem[];
|
||||||
|
isSpanMetricEnable?: boolean;
|
||||||
|
topLevelOperationsRoute: string[];
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,11 @@ function Application(): JSX.Element {
|
|||||||
[queries],
|
[queries],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const topLevelOperationsRoute = useMemo(
|
||||||
|
() => (topLevelOperations ? topLevelOperations[servicename || ''] : []),
|
||||||
|
[servicename, topLevelOperations],
|
||||||
|
);
|
||||||
|
|
||||||
const operationPerSecWidget = useMemo(
|
const operationPerSecWidget = useMemo(
|
||||||
() =>
|
() =>
|
||||||
getWidgetQueryBuilder(
|
getWidgetQueryBuilder(
|
||||||
@ -106,16 +111,14 @@ function Application(): JSX.Element {
|
|||||||
builder: operationPerSec({
|
builder: operationPerSec({
|
||||||
servicename,
|
servicename,
|
||||||
tagFilterItems,
|
tagFilterItems,
|
||||||
topLevelOperations: topLevelOperations
|
topLevelOperations: topLevelOperationsRoute,
|
||||||
? topLevelOperations[servicename || '']
|
|
||||||
: [],
|
|
||||||
}),
|
}),
|
||||||
clickhouse_sql: [],
|
clickhouse_sql: [],
|
||||||
id: uuid(),
|
id: uuid(),
|
||||||
},
|
},
|
||||||
GraphTitle.RATE_PER_OPS,
|
GraphTitle.RATE_PER_OPS,
|
||||||
),
|
),
|
||||||
[servicename, topLevelOperations, tagFilterItems],
|
[servicename, tagFilterItems, topLevelOperationsRoute],
|
||||||
);
|
);
|
||||||
|
|
||||||
const errorPercentageWidget = useMemo(
|
const errorPercentageWidget = useMemo(
|
||||||
@ -127,16 +130,14 @@ function Application(): JSX.Element {
|
|||||||
builder: errorPercentage({
|
builder: errorPercentage({
|
||||||
servicename,
|
servicename,
|
||||||
tagFilterItems,
|
tagFilterItems,
|
||||||
topLevelOperations: topLevelOperations
|
topLevelOperations: topLevelOperationsRoute,
|
||||||
? topLevelOperations[servicename || '']
|
|
||||||
: [],
|
|
||||||
}),
|
}),
|
||||||
clickhouse_sql: [],
|
clickhouse_sql: [],
|
||||||
id: uuid(),
|
id: uuid(),
|
||||||
},
|
},
|
||||||
GraphTitle.ERROR_PERCENTAGE,
|
GraphTitle.ERROR_PERCENTAGE,
|
||||||
),
|
),
|
||||||
[servicename, topLevelOperations, tagFilterItems],
|
[servicename, tagFilterItems, topLevelOperationsRoute],
|
||||||
);
|
);
|
||||||
|
|
||||||
const onDragSelect = useCallback(
|
const onDragSelect = useCallback(
|
||||||
@ -181,6 +182,7 @@ function Application(): JSX.Element {
|
|||||||
selectedTimeStamp={selectedTimeStamp}
|
selectedTimeStamp={selectedTimeStamp}
|
||||||
selectedTraceTags={selectedTraceTags}
|
selectedTraceTags={selectedTraceTags}
|
||||||
tagFilterItems={tagFilterItems}
|
tagFilterItems={tagFilterItems}
|
||||||
|
topLevelOperationsRoute={topLevelOperationsRoute}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
import { FeatureKeys } from 'constants/features';
|
||||||
import Graph from 'container/GridGraphLayout/Graph/';
|
import Graph from 'container/GridGraphLayout/Graph/';
|
||||||
import { GraphTitle } from 'container/MetricsApplication/constant';
|
import { GraphTitle } from 'container/MetricsApplication/constant';
|
||||||
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
|
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
|
||||||
import { latency } from 'container/MetricsApplication/MetricsPageQueries/OverviewQueries';
|
import { latency } from 'container/MetricsApplication/MetricsPageQueries/OverviewQueries';
|
||||||
import { Card, GraphContainer } from 'container/MetricsApplication/styles';
|
import { Card, GraphContainer } from 'container/MetricsApplication/styles';
|
||||||
|
import useFeatureFlag from 'hooks/useFeatureFlag';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
@ -20,9 +22,13 @@ function ServiceOverview({
|
|||||||
selectedTraceTags,
|
selectedTraceTags,
|
||||||
selectedTimeStamp,
|
selectedTimeStamp,
|
||||||
tagFilterItems,
|
tagFilterItems,
|
||||||
|
topLevelOperationsRoute,
|
||||||
}: ServiceOverviewProps): JSX.Element {
|
}: ServiceOverviewProps): JSX.Element {
|
||||||
const { servicename } = useParams<IServiceName>();
|
const { servicename } = useParams<IServiceName>();
|
||||||
|
|
||||||
|
const isSpanMetricEnable = useFeatureFlag(FeatureKeys.USE_SPAN_METRICS)
|
||||||
|
?.active;
|
||||||
|
|
||||||
const latencyWidget = useMemo(
|
const latencyWidget = useMemo(
|
||||||
() =>
|
() =>
|
||||||
getWidgetQueryBuilder(
|
getWidgetQueryBuilder(
|
||||||
@ -32,13 +38,15 @@ function ServiceOverview({
|
|||||||
builder: latency({
|
builder: latency({
|
||||||
servicename,
|
servicename,
|
||||||
tagFilterItems,
|
tagFilterItems,
|
||||||
|
isSpanMetricEnable,
|
||||||
|
topLevelOperationsRoute,
|
||||||
}),
|
}),
|
||||||
clickhouse_sql: [],
|
clickhouse_sql: [],
|
||||||
id: uuid(),
|
id: uuid(),
|
||||||
},
|
},
|
||||||
GraphTitle.LATENCY,
|
GraphTitle.LATENCY,
|
||||||
),
|
),
|
||||||
[servicename, tagFilterItems],
|
[servicename, tagFilterItems, isSpanMetricEnable, topLevelOperationsRoute],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -79,6 +87,7 @@ interface ServiceOverviewProps {
|
|||||||
onDragSelect: (start: number, end: number) => void;
|
onDragSelect: (start: number, end: number) => void;
|
||||||
handleGraphClick: (type: string) => ClickHandlerType;
|
handleGraphClick: (type: string) => ClickHandlerType;
|
||||||
tagFilterItems: TagFilterItem[];
|
tagFilterItems: TagFilterItem[];
|
||||||
|
topLevelOperationsRoute: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ServiceOverview;
|
export default ServiceOverview;
|
||||||
|
@ -3,7 +3,12 @@ export const legend = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const QUERYNAME_AND_EXPRESSION = ['A', 'B', 'C'];
|
export const QUERYNAME_AND_EXPRESSION = ['A', 'B', 'C'];
|
||||||
export const LETENCY_LEGENDS_AGGREGATEOPERATOR = ['p50', 'p90', 'p99'];
|
export const LATENCY_AGGREGATEOPERATOR = ['p50', 'p90', 'p99'];
|
||||||
|
export const LATENCY_AGGREGATEOPERATOR_SPAN_METRICS = [
|
||||||
|
'hist_quantile_50',
|
||||||
|
'hist_quantile_90',
|
||||||
|
'hist_quantile_99',
|
||||||
|
];
|
||||||
export const OPERATION_LEGENDS = ['Operations'];
|
export const OPERATION_LEGENDS = ['Operations'];
|
||||||
|
|
||||||
export enum FORMULA {
|
export enum FORMULA {
|
||||||
@ -35,6 +40,7 @@ export enum MetricsType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum WidgetKeys {
|
export enum WidgetKeys {
|
||||||
|
Name = 'name',
|
||||||
Address = 'address',
|
Address = 'address',
|
||||||
DurationNano = 'durationNano',
|
DurationNano = 'durationNano',
|
||||||
StatusCode = 'status_code',
|
StatusCode = 'status_code',
|
||||||
@ -50,4 +56,5 @@ export enum WidgetKeys {
|
|||||||
SignozCallsTotal = 'signoz_calls_total',
|
SignozCallsTotal = 'signoz_calls_total',
|
||||||
SignozExternalCallLatencyCount = 'signoz_external_call_latency_count',
|
SignozExternalCallLatencyCount = 'signoz_external_call_latency_count',
|
||||||
SignozExternalCallLatencySum = 'signoz_external_call_latency_sum',
|
SignozExternalCallLatencySum = 'signoz_external_call_latency_sum',
|
||||||
|
Signoz_latency_bucket = 'signoz_latency_bucket',
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user