mirror of
https://github.com/grafana/grafana.git
synced 2024-11-24 09:50:29 -06:00
Update graphite datasource testing query (#54635)
* Provide from and to parameters when testing the datasource * Strongly typed test datasource query
This commit is contained in:
parent
c4d32dd687
commit
3ea9ece16e
@ -6667,8 +6667,8 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "49"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "50"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "51"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "52"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "53"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "52"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "53"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "54"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "55"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "56"],
|
||||
@ -6677,10 +6677,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "59"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "60"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "61"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "62"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "63"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "64"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "65"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "62"]
|
||||
],
|
||||
"public/app/plugins/datasource/graphite/datasource_integration.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
|
@ -17,6 +17,7 @@ import {
|
||||
QueryResultMetaStat,
|
||||
ScopedVars,
|
||||
TimeRange,
|
||||
TimeZone,
|
||||
toDataFrame,
|
||||
} from '@grafana/data';
|
||||
import { getBackendSrv } from '@grafana/runtime';
|
||||
@ -37,8 +38,8 @@ import {
|
||||
GraphiteMetricLokiMatcher,
|
||||
GraphiteOptions,
|
||||
GraphiteQuery,
|
||||
GraphiteQueryRequest,
|
||||
GraphiteQueryImportConfiguration,
|
||||
GraphiteQueryRequest,
|
||||
GraphiteQueryType,
|
||||
GraphiteType,
|
||||
MetricTankRequestMeta,
|
||||
@ -451,7 +452,7 @@ export class GraphiteDatasource
|
||||
return this.templateSrv.containsTemplate(target.target ?? '');
|
||||
}
|
||||
|
||||
translateTime(date: any, roundUp: any, timezone: any) {
|
||||
translateTime(date: any, roundUp: any, timezone: TimeZone) {
|
||||
if (isString(date)) {
|
||||
if (date === 'now') {
|
||||
return 'now';
|
||||
@ -855,15 +856,24 @@ export class GraphiteDatasource
|
||||
}
|
||||
|
||||
testDatasource() {
|
||||
const query = {
|
||||
const query: DataQueryRequest<GraphiteQuery> = {
|
||||
app: 'graphite',
|
||||
interval: '10ms',
|
||||
intervalMs: 10,
|
||||
requestId: 'reqId',
|
||||
scopedVars: {},
|
||||
startTime: 0,
|
||||
timezone: 'browser',
|
||||
panelId: 3,
|
||||
rangeRaw: { from: 'now-1h', to: 'now' },
|
||||
range: {
|
||||
from: dateTime('now-1h'),
|
||||
to: dateTime('now'),
|
||||
raw: { from: 'now-1h', to: 'now' },
|
||||
},
|
||||
targets: [{ target: 'constantLine(100)' }],
|
||||
targets: [{ refId: 'A', target: 'constantLine(100)' }],
|
||||
maxDataPoints: 300,
|
||||
} as unknown as DataQueryRequest<GraphiteQuery>;
|
||||
};
|
||||
|
||||
return lastValueFrom(this.query(query)).then(() => ({ status: 'success', message: 'Data source is working' }));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user