mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Use specified time range, default to class value (#80557)
This commit is contained in:
@@ -706,10 +706,12 @@ export class PrometheusDatasource
|
||||
const expr = promQueryModeller.renderLabels(labelFilters);
|
||||
|
||||
if (this.hasLabelsMatchAPISupport()) {
|
||||
return (await this.languageProvider.fetchSeriesValuesWithMatch(options.key, expr)).map((v) => ({
|
||||
value: v,
|
||||
text: v,
|
||||
}));
|
||||
return (await this.languageProvider.fetchSeriesValuesWithMatch(options.key, expr, options.timeRange)).map(
|
||||
(v) => ({
|
||||
value: v,
|
||||
text: v,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const params = this.getTimeRangeParams(options.timeRange ?? getDefaultTimeRange());
|
||||
|
||||
@@ -239,11 +239,16 @@ export default class PromQlLanguageProvider extends LanguageProvider {
|
||||
* Fetches all values for a label, with optional match[]
|
||||
* @param name
|
||||
* @param match
|
||||
* @param timeRange
|
||||
*/
|
||||
fetchSeriesValuesWithMatch = async (name: string, match?: string): Promise<string[]> => {
|
||||
fetchSeriesValuesWithMatch = async (
|
||||
name: string,
|
||||
match?: string,
|
||||
timeRange: TimeRange = this.timeRange
|
||||
): Promise<string[]> => {
|
||||
const interpolatedName = name ? this.datasource.interpolateString(name) : null;
|
||||
const interpolatedMatch = match ? this.datasource.interpolateString(match) : null;
|
||||
const range = this.datasource.getAdjustedInterval(this.timeRange);
|
||||
const range = this.datasource.getAdjustedInterval(timeRange);
|
||||
const urlParams = {
|
||||
...range,
|
||||
...(interpolatedMatch && { 'match[]': interpolatedMatch }),
|
||||
|
||||
Reference in New Issue
Block a user