Removes unused chart titles and increase scrape time
This commit is contained in:
parent
51685c55d9
commit
427a47d054
@ -49,7 +49,7 @@ func (a *App) renderChart(w http.ResponseWriter, c renderableChart) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeHistoryChart(title string, showLegend bool, points []ServerPoint) chart.Chart {
|
func makeHistoryChart(showLegend bool, points []ServerPoint) chart.Chart {
|
||||||
// TODO BUG: one day is missing randomly (usually the 3rd day in the range) in the chart
|
// TODO BUG: one day is missing randomly (usually the 3rd day in the range) in the chart
|
||||||
var xVals []time.Time
|
var xVals []time.Time
|
||||||
var yVals []float64
|
var yVals []float64
|
||||||
@ -107,7 +107,7 @@ func makeHistoryChart(title string, showLegend bool, points []ServerPoint) chart
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: The chart won't be renderable unless we've got at least two days of history
|
// NOTE: The chart won't be renderable unless we've got at least two days of history
|
||||||
func makeDayAverageChart(title string, points []ServerPoint) chart.BarChart {
|
func makeDayAverageChart(points []ServerPoint) chart.BarChart {
|
||||||
days := make(map[time.Weekday][]int)
|
days := make(map[time.Weekday][]int)
|
||||||
for _, p := range points {
|
for _, p := range points {
|
||||||
day := p.Time.Weekday()
|
day := p.Time.Weekday()
|
||||||
|
|||||||
@ -20,7 +20,7 @@ func main() {
|
|||||||
WebAddr: *flagAddr,
|
WebAddr: *flagAddr,
|
||||||
ReadTimeout: 30 * time.Second,
|
ReadTimeout: 30 * time.Second,
|
||||||
WriteTimeout: 30 * time.Second,
|
WriteTimeout: 30 * time.Second,
|
||||||
ScrapeTimeout: 10 * time.Minute,
|
ScrapeTimeout: 15 * time.Minute,
|
||||||
Storage: &ss13_se.StorageSqlite{
|
Storage: &ss13_se.StorageSqlite{
|
||||||
Path: *flagPath,
|
Path: *flagPath,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -70,7 +70,7 @@ func (a *App) pageDailyChart(w http.ResponseWriter, r *http.Request, vars handle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c := makeHistoryChart("Daily history", true, points)
|
c := makeHistoryChart(true, points)
|
||||||
return a.renderChart(w, c)
|
return a.renderChart(w, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ func (a *App) pageWeeklyChart(w http.ResponseWriter, r *http.Request, vars handl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c := makeHistoryChart("Weekly history", false, points)
|
c := makeHistoryChart(false, points)
|
||||||
return a.renderChart(w, c)
|
return a.renderChart(w, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +104,6 @@ func (a *App) pageAverageChart(w http.ResponseWriter, r *http.Request, vars hand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c := makeDayAverageChart("Average per day", points)
|
c := makeDayAverageChart(points)
|
||||||
return a.renderChart(w, c)
|
return a.renderChart(w, c)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user