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,
|
Gauge: metricsGaugeSpaceAggregateOperatorOptions,
|
||||||
Histogram: metricsHistogramSpaceAggregateOperatorOptions,
|
Histogram: metricsHistogramSpaceAggregateOperatorOptions,
|
||||||
ExponentialHistogram: metricsHistogramSpaceAggregateOperatorOptions,
|
ExponentialHistogram: metricsHistogramSpaceAggregateOperatorOptions,
|
||||||
|
Summary: metricsGaugeSpaceAggregateOperatorOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mapOfQueryFilters: Record<DataSource, QueryAdditionalFilter[]> = {
|
export const mapOfQueryFilters: Record<DataSource, QueryAdditionalFilter[]> = {
|
||||||
@ -372,6 +373,7 @@ export enum ATTRIBUTE_TYPES {
|
|||||||
GAUGE = 'Gauge',
|
GAUGE = 'Gauge',
|
||||||
HISTOGRAM = 'Histogram',
|
HISTOGRAM = 'Histogram',
|
||||||
EXPONENTIAL_HISTOGRAM = 'ExponentialHistogram',
|
EXPONENTIAL_HISTOGRAM = 'ExponentialHistogram',
|
||||||
|
SUMMARY = 'Summary',
|
||||||
}
|
}
|
||||||
|
|
||||||
export type IQueryBuilderState = 'search';
|
export type IQueryBuilderState = 'search';
|
||||||
|
|||||||
@ -203,6 +203,10 @@ export const useQueryOperations: UseQueryOperations = ({
|
|||||||
case ATTRIBUTE_TYPES.EXPONENTIAL_HISTOGRAM:
|
case ATTRIBUTE_TYPES.EXPONENTIAL_HISTOGRAM:
|
||||||
setSpaceAggregationOptions(metricsHistogramSpaceAggregateOperatorOptions);
|
setSpaceAggregationOptions(metricsHistogramSpaceAggregateOperatorOptions);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ATTRIBUTE_TYPES.SUMMARY:
|
||||||
|
setSpaceAggregationOptions(metricsGaugeSpaceAggregateOperatorOptions);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
setSpaceAggregationOptions(metricsUnknownSpaceAggregateOperatorOptions);
|
setSpaceAggregationOptions(metricsUnknownSpaceAggregateOperatorOptions);
|
||||||
break;
|
break;
|
||||||
@ -235,11 +239,17 @@ export const useQueryOperations: UseQueryOperations = ({
|
|||||||
} else if (newQuery.aggregateAttribute?.type === ATTRIBUTE_TYPES.GAUGE) {
|
} else if (newQuery.aggregateAttribute?.type === ATTRIBUTE_TYPES.GAUGE) {
|
||||||
newQuery.aggregateOperator = MetricAggregateOperator.AVG;
|
newQuery.aggregateOperator = MetricAggregateOperator.AVG;
|
||||||
newQuery.timeAggregation = 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 {
|
} else {
|
||||||
newQuery.timeAggregation = '';
|
newQuery.timeAggregation = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newQuery.aggregateAttribute?.type !== ATTRIBUTE_TYPES.SUMMARY) {
|
||||||
newQuery.spaceAggregation = '';
|
newQuery.spaceAggregation = '';
|
||||||
|
}
|
||||||
|
|
||||||
// Handled query with unknown metric to avoid 400 and 500 errors
|
// Handled query with unknown metric to avoid 400 and 500 errors
|
||||||
// With metric value typed and not available then - time - 'avg', space - 'avg'
|
// With metric value typed and not available then - time - 'avg', space - 'avg'
|
||||||
@ -285,6 +295,15 @@ export const useQueryOperations: UseQueryOperations = ({
|
|||||||
spaceAggregation: '',
|
spaceAggregation: '',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
} else if (newQuery.aggregateAttribute?.type === ATTRIBUTE_TYPES.SUMMARY) {
|
||||||
|
newQuery.aggregations = [
|
||||||
|
{
|
||||||
|
timeAggregation: MetricAggregateOperator.MAX,
|
||||||
|
metricName: newQuery.aggregateAttribute?.key || '',
|
||||||
|
temporality: '',
|
||||||
|
spaceAggregation: MetricAggregateOperator.MAX,
|
||||||
|
},
|
||||||
|
];
|
||||||
} else {
|
} else {
|
||||||
newQuery.aggregations = [
|
newQuery.aggregations = [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,6 +29,10 @@ export const getMetricsOperatorsByAttributeType = ({
|
|||||||
if (aggregateAttributeType === ATTRIBUTE_TYPES.GAUGE) {
|
if (aggregateAttributeType === ATTRIBUTE_TYPES.GAUGE) {
|
||||||
return metricsOperatorsByType.Gauge;
|
return metricsOperatorsByType.Gauge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aggregateAttributeType === ATTRIBUTE_TYPES.SUMMARY) {
|
||||||
|
return metricsOperatorsByType.Gauge;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataSource === DataSource.METRICS && isEmpty(aggregateAttributeType)) {
|
if (dataSource === DataSource.METRICS && isEmpty(aggregateAttributeType)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user