mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Update getTimeRangeParams to return start & end instead of from & to (#36268)
This commit is contained in:
parent
c3e26657e9
commit
abb1c10776
@ -289,7 +289,7 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
|
|||||||
|
|
||||||
getTimeRangeParams() {
|
getTimeRangeParams() {
|
||||||
const timeRange = this.timeSrv.timeRange();
|
const timeRange = this.timeSrv.timeRange();
|
||||||
return { from: timeRange.from.valueOf() * NS_IN_MS, to: timeRange.to.valueOf() * NS_IN_MS };
|
return { start: timeRange.from.valueOf() * NS_IN_MS, end: timeRange.to.valueOf() * NS_IN_MS };
|
||||||
}
|
}
|
||||||
|
|
||||||
async importQueries(queries: DataQuery[], originDataSource: DataSourceApi): Promise<LokiQuery[]> {
|
async importQueries(queries: DataQuery[], originDataSource: DataSourceApi): Promise<LokiQuery[]> {
|
||||||
|
@ -442,7 +442,7 @@ export default class LokiLanguageProvider extends LanguageProvider {
|
|||||||
*/
|
*/
|
||||||
fetchSeriesLabels = async (match: string): Promise<Record<string, string[]>> => {
|
fetchSeriesLabels = async (match: string): Promise<Record<string, string[]>> => {
|
||||||
const url = '/loki/api/v1/series';
|
const url = '/loki/api/v1/series';
|
||||||
const { from: start, to: end } = this.datasource.getTimeRangeParams();
|
const { start, end } = this.datasource.getTimeRangeParams();
|
||||||
|
|
||||||
const cacheKey = this.generateCacheKey(url, start, end, match);
|
const cacheKey = this.generateCacheKey(url, start, end, match);
|
||||||
let value = this.seriesCache.get(cacheKey);
|
let value = this.seriesCache.get(cacheKey);
|
||||||
@ -464,7 +464,7 @@ export default class LokiLanguageProvider extends LanguageProvider {
|
|||||||
*/
|
*/
|
||||||
fetchSeries = async (match: string): Promise<Array<Record<string, string>>> => {
|
fetchSeries = async (match: string): Promise<Array<Record<string, string>>> => {
|
||||||
const url = '/loki/api/v1/series';
|
const url = '/loki/api/v1/series';
|
||||||
const { from: start, to: end } = this.datasource.getTimeRangeParams();
|
const { start, end } = this.datasource.getTimeRangeParams();
|
||||||
const params = { match, start, end };
|
const params = { match, start, end };
|
||||||
return await this.request(url, params);
|
return await this.request(url, params);
|
||||||
};
|
};
|
||||||
@ -489,7 +489,7 @@ export default class LokiLanguageProvider extends LanguageProvider {
|
|||||||
async fetchLabelValues(key: string): Promise<string[]> {
|
async fetchLabelValues(key: string): Promise<string[]> {
|
||||||
const url = `/loki/api/v1/label/${key}/values`;
|
const url = `/loki/api/v1/label/${key}/values`;
|
||||||
const rangeParams = this.datasource.getTimeRangeParams();
|
const rangeParams = this.datasource.getTimeRangeParams();
|
||||||
const { from: start, to: end } = rangeParams;
|
const { start, end } = rangeParams;
|
||||||
|
|
||||||
const cacheKey = this.generateCacheKey(url, start, end, key);
|
const cacheKey = this.generateCacheKey(url, start, end, key);
|
||||||
const params = { start, end };
|
const params = { start, end };
|
||||||
|
Loading…
Reference in New Issue
Block a user