mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
fix: summary metric type works with query builder
This commit is contained in:
parent
101b3668b5
commit
be185bdda8
@ -97,6 +97,7 @@ export const metricsSpaceAggregationOperatorsByType = {
|
||||
Gauge: metricsGaugeSpaceAggregateOperatorOptions,
|
||||
Histogram: metricsHistogramSpaceAggregateOperatorOptions,
|
||||
ExponentialHistogram: metricsHistogramSpaceAggregateOperatorOptions,
|
||||
Summary: metricsGaugeSpaceAggregateOperatorOptions,
|
||||
};
|
||||
|
||||
export const mapOfQueryFilters: Record<DataSource, QueryAdditionalFilter[]> = {
|
||||
@ -372,6 +373,7 @@ export enum ATTRIBUTE_TYPES {
|
||||
GAUGE = 'Gauge',
|
||||
HISTOGRAM = 'Histogram',
|
||||
EXPONENTIAL_HISTOGRAM = 'ExponentialHistogram',
|
||||
SUMMARY = 'Summary',
|
||||
}
|
||||
|
||||
export type IQueryBuilderState = 'search';
|
||||
|
||||
@ -203,6 +203,10 @@ export const useQueryOperations: UseQueryOperations = ({
|
||||
case ATTRIBUTE_TYPES.EXPONENTIAL_HISTOGRAM:
|
||||
setSpaceAggregationOptions(metricsHistogramSpaceAggregateOperatorOptions);
|
||||
break;
|
||||
|
||||
case ATTRIBUTE_TYPES.SUMMARY:
|
||||
setSpaceAggregationOptions(metricsGaugeSpaceAggregateOperatorOptions);
|
||||
break;
|
||||
default:
|
||||
setSpaceAggregationOptions(metricsUnknownSpaceAggregateOperatorOptions);
|
||||
break;
|
||||
@ -235,11 +239,17 @@ export const useQueryOperations: UseQueryOperations = ({
|
||||
} else if (newQuery.aggregateAttribute?.type === ATTRIBUTE_TYPES.GAUGE) {
|
||||
newQuery.aggregateOperator = MetricAggregateOperator.AVG;
|
||||
newQuery.timeAggregation = MetricAggregateOperator.AVG;
|
||||
} else if (newQuery.aggregateAttribute?.type === ATTRIBUTE_TYPES.SUMMARY) {
|
||||
newQuery.aggregateOperator = MetricAggregateOperator.MAX;
|
||||
newQuery.timeAggregation = MetricAggregateOperator.MAX;
|
||||
newQuery.spaceAggregation = MetricAggregateOperator.MAX;
|
||||
} else {
|
||||
newQuery.timeAggregation = '';
|
||||
}
|
||||
|
||||
if (newQuery.aggregateAttribute?.type !== ATTRIBUTE_TYPES.SUMMARY) {
|
||||
newQuery.spaceAggregation = '';
|
||||
}
|
||||
|
||||
// Handled query with unknown metric to avoid 400 and 500 errors
|
||||
// With metric value typed and not available then - time - 'avg', space - 'avg'
|
||||
@ -285,6 +295,15 @@ export const useQueryOperations: UseQueryOperations = ({
|
||||
spaceAggregation: '',
|
||||
},
|
||||
];
|
||||
} else if (newQuery.aggregateAttribute?.type === ATTRIBUTE_TYPES.SUMMARY) {
|
||||
newQuery.aggregations = [
|
||||
{
|
||||
timeAggregation: MetricAggregateOperator.MAX,
|
||||
metricName: newQuery.aggregateAttribute?.key || '',
|
||||
temporality: '',
|
||||
spaceAggregation: MetricAggregateOperator.MAX,
|
||||
},
|
||||
];
|
||||
} else {
|
||||
newQuery.aggregations = [
|
||||
{
|
||||
|
||||
@ -29,6 +29,10 @@ export const getMetricsOperatorsByAttributeType = ({
|
||||
if (aggregateAttributeType === ATTRIBUTE_TYPES.GAUGE) {
|
||||
return metricsOperatorsByType.Gauge;
|
||||
}
|
||||
|
||||
if (aggregateAttributeType === ATTRIBUTE_TYPES.SUMMARY) {
|
||||
return metricsOperatorsByType.Gauge;
|
||||
}
|
||||
}
|
||||
|
||||
if (dataSource === DataSource.METRICS && isEmpty(aggregateAttributeType)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user