diff --git a/packages/grafana-prometheus/src/query_hints.test.ts b/packages/grafana-prometheus/src/query_hints.test.ts index 34ceb13cf84..a5bd75b0f81 100644 --- a/packages/grafana-prometheus/src/query_hints.test.ts +++ b/packages/grafana-prometheus/src/query_hints.test.ts @@ -216,13 +216,11 @@ describe('getQueryHints()', () => { const datasource = mock as PrometheusDatasource; let hints = getQueryHints('foo', series, datasource); - expect(hints!.length).toBe(6); + expect(hints!.length).toBe(3); const hintsString = JSON.stringify(hints); expect(hintsString).toContain('ADD_HISTOGRAM_AVG'); expect(hintsString).toContain('ADD_HISTOGRAM_COUNT'); - expect(hintsString).toContain('ADD_HISTOGRAM_SUM'); - expect(hintsString).toContain('ADD_HISTOGRAM_FRACTION'); - expect(hintsString).toContain('ADD_HISTOGRAM_AVG'); + expect(hintsString).toContain('ADD_HISTOGRAM_QUANTILE'); }); it('returns no hints for native histogram when there are native histogram functions in the query', () => { diff --git a/packages/grafana-prometheus/src/query_hints.ts b/packages/grafana-prometheus/src/query_hints.ts index 15fb2fdede2..3fcdd66e0d2 100644 --- a/packages/grafana-prometheus/src/query_hints.ts +++ b/packages/grafana-prometheus/src/query_hints.ts @@ -50,9 +50,20 @@ export function getQueryHints(query: string, series?: unknown[], datasource?: Pr if (nativeHistogramNameMetric) { // add hints: - // histogram_avg, histogram_count, histogram_sum, histogram_fraction, histogram_stddev, histogram_stdvar + // histogram_quantile, histogram_avg, histogram_count const label = 'Selected metric is a native histogram.'; hints.push( + { + type: 'HISTOGRAM_QUANTILE', + label, + fix: { + label: 'Consider calculating aggregated quantile by adding histogram_quantile().', + action: { + type: 'ADD_HISTOGRAM_QUANTILE', + query, + }, + }, + }, { type: 'HISTOGRAM_AVG', label, @@ -74,52 +85,6 @@ export function getQueryHints(query: string, series?: unknown[], datasource?: Pr query, }, }, - }, - { - type: 'HISTOGRAM_SUM', - label, - fix: { - label: 'Consider calculating the sum of observations by adding histogram_sum().', - action: { - type: 'ADD_HISTOGRAM_SUM', - query, - }, - }, - }, - { - type: 'HISTOGRAM_FRACTION', - label, - fix: { - label: - 'Consider calculating the estimated fraction of observations between the provided lower and upper values by adding histogram_fraction().', - action: { - type: 'ADD_HISTOGRAM_FRACTION', - query, - }, - }, - }, - { - type: 'HISTOGRAM_STDDEV', - label, - fix: { - label: - 'Consider calculating the estimated standard deviation of observations by adding histogram_stddev().', - action: { - type: 'ADD_HISTOGRAM_STDDEV', - query, - }, - }, - }, - { - type: 'HISTOGRAM_STDVAR', - label, - fix: { - label: 'Consider calculating the estimated standard variance of observations by adding histogram_stdvar().', - action: { - type: 'ADD_HISTOGRAM_STDVAR', - query, - }, - }, } ); }