mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
e4bf7ddefe
commit
5b058d617d
@ -113,7 +113,7 @@ describe('graphiteDatasource', () => {
|
|||||||
const query = {
|
const query = {
|
||||||
panelId: 3,
|
panelId: 3,
|
||||||
dashboardId: 5,
|
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' }],
|
targets: [{ target: 'prod1.count' }, { target: 'prod2.count' }],
|
||||||
maxDataPoints: 500,
|
maxDataPoints: 500,
|
||||||
};
|
};
|
||||||
@ -157,8 +157,8 @@ describe('graphiteDatasource', () => {
|
|||||||
const params = requestOptions.data.split('&');
|
const params = requestOptions.data.split('&');
|
||||||
expect(params).toContain('target=prod1.count');
|
expect(params).toContain('target=prod1.count');
|
||||||
expect(params).toContain('target=prod2.count');
|
expect(params).toContain('target=prod2.count');
|
||||||
expect(params).toContain('from=-1h');
|
expect(params).toContain('from=1648789200');
|
||||||
expect(params).toContain('until=now');
|
expect(params).toContain('until=1656655200');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should exclude undefined params', () => {
|
it('should exclude undefined params', () => {
|
||||||
|
@ -179,8 +179,8 @@ export class GraphiteDatasource
|
|||||||
|
|
||||||
query(options: DataQueryRequest<GraphiteQuery>): Observable<DataQueryResponse> {
|
query(options: DataQueryRequest<GraphiteQuery>): Observable<DataQueryResponse> {
|
||||||
const graphOptions = {
|
const graphOptions = {
|
||||||
from: this.translateTime(options.range.raw.from, false, options.timezone),
|
from: this.translateTime(options.range.from, false, options.timezone),
|
||||||
until: this.translateTime(options.range.raw.to, true, options.timezone),
|
until: this.translateTime(options.range.to, true, options.timezone),
|
||||||
targets: options.targets,
|
targets: options.targets,
|
||||||
format: (options as any).format,
|
format: (options as any).format,
|
||||||
cacheTimeout: options.cacheTimeout || this.cacheTimeout,
|
cacheTimeout: options.cacheTimeout || this.cacheTimeout,
|
||||||
|
Loading…
Reference in New Issue
Block a user