devapp: add documentation for /stats and /stats/svg

Now that the stats dashboard is (mostly) working, link it from the
homepage.

Change-Id: I5fa1c2f241151d809c2d9a6cf8f664dda14cf8b3
Reviewed-on: https://go-review.googlesource.com/28975
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Quentin Smith 2016-09-08 19:20:37 -04:00
Родитель 5936fd2fc1
Коммит ee5416da7c
4 изменённых файлов: 55 добавлений и 5 удалений

Просмотреть файл

@ -24,8 +24,9 @@ handlers:
secure: always secure: always
- url: /static - url: /static
static_dir: static static_dir: static
application_readable: true
secure: always secure: always
- url: /(|dash|release|cl|stats/raw|stats/svg.*) - url: /(|dash|release|cl|stats/raw|stats/svg)
script: _go_app script: _go_app
secure: always secure: always
- url: /update.* - url: /update.*

Просмотреть файл

@ -1,8 +1,10 @@
<!DOCTYPE html>
<html> <html>
<pre> <pre>
<a href="release">Go release dashboard</a> <a href="release">Go release dashboard</a>
<a href="cl">Go CL dashboard</a> <a href="cl">Go CL dashboard</a>
<a href="dash">Go development dashboard</a> <a href="dash">Go development dashboard</a>
<a href="stats">Go project health dashboard</a>
<b>About the Dashboards</b> <b>About the Dashboards</b>

44
devapp/static/svg.html Normal file
Просмотреть файл

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<body>
/stats/svg serves various graphs of issue statistics. Some of the supported query parameters are:
<ul>
<li><code>xscale</code>
<ul>
<li><code>xscale=log</code> - log scale</li>
<li><code>xscale=lin</code> - linear scale. Also supports <code>xmin</code> and <code>xmax</code> parameters.</li>
</ul></li>
<li><code>yscale</code> - same as xscale but for y axis</li>
<li><code>pivot</code> - predefined graphs
<ul>
<li><code>pivot=opencount</code> - plot number of open issues over time. With <code>group=release</code> plots the number of open issues by release over time.</li>
<li>Unspecified - plot number of issues by bucket
<ul>
<li><code>filter</code>
<ul>
<li><code>filter=open</code> - only open issues</li>
<li><code>filter=closed</code> - only closed issues</li>
</ul>
</li>
<li><code>column</code> - column to bucket issues by
<ul>
<li><code>column={Created,Closed,Updated}{,Day,Month,Year}</code> - time, day, month, or year the issue was created, closed, or updated</li>
<li><code>column=UpdateAge</code> - time since issue was last updated</li>
</ul>
</li>
<li><code>agg</code> - how to aggregate issues
<ul>
<li><code>agg=count</code> or unspecified - count of issues for each distinct value of <code>column</code></li>
<li><code>agg=ecdf</code> - CDF of values</li>
<li><code>agg=bin</code> - automatically chosen histogram bins</li>
<li><code>agg=density</code> - best fit PDF of values</li>
</ul>
</ul>
</li>
</ul>
</li>
</ul>
</body>
</html>

Просмотреть файл

@ -80,6 +80,11 @@ func rawHandler(w http.ResponseWriter, r *http.Request) {
} }
func svgHandler(w http.ResponseWriter, req *http.Request) { func svgHandler(w http.ResponseWriter, req *http.Request) {
if req.URL.RawQuery == "" {
http.ServeFile(w, req, "static/svg.html")
return
}
ctx := appengine.NewContext(req) ctx := appengine.NewContext(req)
req.ParseForm() req.ParseForm()
@ -237,10 +242,8 @@ func plot(w http.ResponseWriter, req *http.Request, stats table.Grouping) error
switch scale := req.Form.Get(aes + "scale"); scale { switch scale := req.Form.Get(aes + "scale"); scale {
case "log": case "log":
ls := gg.NewLogScaler(10) ls := gg.NewLogScaler(10)
if aes == "x" {
// Our plots tend to go to 0, which makes log scales unhappy. // Our plots tend to go to 0, which makes log scales unhappy.
ls.SetMin(1) ls.SetMin(1)
}
plot.SetScale(aes, ls) plot.SetScale(aes, ls)
case "lin": case "lin":
s := gg.NewLinearScaler() s := gg.NewLinearScaler()