Skip to content

Commit

Permalink
Ensure computed windowPeriod is an integer
Browse files Browse the repository at this point in the history
Also lowers the `DESIRED_POINTS_PER_GRAPH` constant so that queries
return faster. Once Flux becomes more efficient at windowing, we should
increase this constant again.
  • Loading branch information
chnn committed Jan 17, 2019
1 parent 46d1179 commit 1a60b18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/src/shared/utils/renderQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {DEFAULT_DURATION_MS, WINDOW_PERIOD} from 'src/shared/constants'
// Types
import {InfluxLanguage} from 'src/types/v2/dashboards'

const DESIRED_POINTS_PER_GRAPH = 1440
const DESIRED_POINTS_PER_GRAPH = 360
const FALLBACK_WINDOW_PERIOD = 15000

export async function renderQuery(
Expand Down Expand Up @@ -56,5 +56,5 @@ async function getAST(query: string): Promise<object> {
}

function getWindowInterval(durationMilliseconds: number = DEFAULT_DURATION_MS) {
return durationMilliseconds / DESIRED_POINTS_PER_GRAPH
return Math.round(durationMilliseconds / DESIRED_POINTS_PER_GRAPH)
}

0 comments on commit 1a60b18

Please sign in to comment.