Typescript: Removes implicit anys (#17625)

* Chore: Remove implicit anys from ResultProcessor and tests

* Chore: Removes implicit anys for /loki/**/*.ts

* Chore: Removes implicit anys for prometheus/**/*
This commit is contained in:
Hugo Häggmark
2019-06-18 11:01:12 +02:00
committed by GitHub
parent d6ee96ee64
commit 3424b64299
19 changed files with 226 additions and 167 deletions

View File

@@ -1,12 +1,12 @@
import _ from 'lodash';
import { QueryHint } from '@grafana/ui/src/types';
import { QueryHint, QueryFix } from '@grafana/ui/src/types';
/**
* Number of time series results needed before starting to suggest sum aggregation hints
*/
export const SUM_HINT_THRESHOLD_COUNT = 20;
export function getQueryHints(query: string, series?: any[], datasource?: any): QueryHint[] {
export function getQueryHints(query: string, series?: any[], datasource?: any): QueryHint[] | null {
const hints = [];
// ..._bucket metric needs a histogram_quantile()
@@ -22,7 +22,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: any):
type: 'ADD_HISTOGRAM_QUANTILE',
query,
},
},
} as QueryFix,
});
}
@@ -44,7 +44,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: any):
if (increasing && monotonic) {
const simpleMetric = query.trim().match(/^\w+$/);
let label = 'Time series is monotonically increasing.';
let fix;
let fix: QueryFix;
if (simpleMetric) {
fix = {
label: 'Fix by adding rate().',
@@ -52,7 +52,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: any):
type: 'ADD_RATE',
query,
},
};
} as QueryFix;
} else {
label = `${label} Try applying a rate() function.`;
}
@@ -83,14 +83,14 @@ export function getQueryHints(query: string, series?: any[], datasource?: any):
hints.push({
type: 'EXPAND_RULES',
label,
fix: {
fix: ({
label: 'Expand rules',
action: {
type: 'EXPAND_RULES',
query,
mapping: mappingForQuery,
},
},
} as any) as QueryFix,
});
}
}
@@ -108,7 +108,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: any):
query: query,
preventSubmit: true,
},
},
} as QueryFix,
});
}
}