Graphite: Use TimeRange with applied fiscalYearStartMonth (#51623)

* Parse date with fiscalYearStartMonth in graphite ds

* Use precalculated timeranges

* Always use precalculated values

* Modify test
This commit is contained in:
Victor Marin 2022-07-06 09:27:09 +03:00 committed by GitHub
parent e4bf7ddefe
commit 5b058d617d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -113,7 +113,7 @@ describe('graphiteDatasource', () => {
const query = {
panelId: 3,
dashboardId: 5,
range: { raw: { from: 'now-1h', to: 'now' } },
range: { from: dateTime('2022-04-01T00:00:00'), to: dateTime('2022-07-01T00:00:00') },
targets: [{ target: 'prod1.count' }, { target: 'prod2.count' }],
maxDataPoints: 500,
};
@ -157,8 +157,8 @@ describe('graphiteDatasource', () => {
const params = requestOptions.data.split('&');
expect(params).toContain('target=prod1.count');
expect(params).toContain('target=prod2.count');
expect(params).toContain('from=-1h');
expect(params).toContain('until=now');
expect(params).toContain('from=1648789200');
expect(params).toContain('until=1656655200');
});
it('should exclude undefined params', () => {

View File

@ -179,8 +179,8 @@ export class GraphiteDatasource
query(options: DataQueryRequest<GraphiteQuery>): Observable<DataQueryResponse> {
const graphOptions = {
from: this.translateTime(options.range.raw.from, false, options.timezone),
until: this.translateTime(options.range.raw.to, true, options.timezone),
from: this.translateTime(options.range.from, false, options.timezone),
until: this.translateTime(options.range.to, true, options.timezone),
targets: options.targets,
format: (options as any).format,
cacheTimeout: options.cacheTimeout || this.cacheTimeout,