prettier
This commit is contained in:
@@ -4,8 +4,6 @@ import { PrometheusDatasource } from './datasource';
|
||||
import { LabelsApiClient, processSeries, SeriesApiClient } from './resource_clients';
|
||||
import { PrometheusCacheLevel } from './types';
|
||||
|
||||
type MockDatasource = Pick<PrometheusDatasource, 'cacheLevel' | 'getAdjustedInterval' | 'getTimeRangeParams' | 'interpolateString'>;
|
||||
|
||||
const mockTimeRange: TimeRange = {
|
||||
from: dateTime(1681300292392),
|
||||
to: dateTime(1681300293392),
|
||||
|
||||
@@ -24,7 +24,11 @@ export interface ResourceApiClient {
|
||||
queryLabelValues: (timeRange: TimeRange, labelKey: string, match?: string, limit?: string) => Promise<string[]>;
|
||||
}
|
||||
|
||||
type RequestFn = (url: string, params?: Record<string, unknown>, options?: Partial<BackendSrvRequest>) => Promise<unknown>;
|
||||
type RequestFn = (
|
||||
url: string,
|
||||
params?: Record<string, unknown>,
|
||||
options?: Partial<BackendSrvRequest>
|
||||
) => Promise<unknown>;
|
||||
|
||||
const MATCH_ALL_LABELS = '{__name__!=""}';
|
||||
const METRIC_LABEL = '__name__';
|
||||
@@ -35,12 +39,20 @@ abstract class BaseResourceClient {
|
||||
protected readonly datasource: PrometheusDatasource
|
||||
) {}
|
||||
|
||||
protected async requestLabels(url: string, params?: Record<string, unknown>, options?: Partial<BackendSrvRequest>): Promise<PrometheusLabelsResponse> {
|
||||
protected async requestLabels(
|
||||
url: string,
|
||||
params?: Record<string, unknown>,
|
||||
options?: Partial<BackendSrvRequest>
|
||||
): Promise<PrometheusLabelsResponse> {
|
||||
const response = await this.request(url, params, options);
|
||||
return Array.isArray(response) ? response : [];
|
||||
}
|
||||
|
||||
protected async requestSeries(url: string, params?: Record<string, unknown>, options?: Partial<BackendSrvRequest>): Promise<PrometheusSeriesResponse> {
|
||||
protected async requestSeries(
|
||||
url: string,
|
||||
params?: Record<string, unknown>,
|
||||
options?: Partial<BackendSrvRequest>
|
||||
): Promise<PrometheusSeriesResponse> {
|
||||
const response = await this.request(url, params, options);
|
||||
return Array.isArray(response) ? response : [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user