storage: add readme on / Change-Id: I04949398205be2eaf5e462bdd65282f23419e85d Reviewed-on: https://go-review.googlesource.com/36027 Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/storage/app/app.go b/storage/app/app.go index 3db5b7f..af6698a 100644 --- a/storage/app/app.go +++ b/storage/app/app.go
@@ -38,6 +38,12 @@ // RegisterOnMux registers the app's URLs on mux. func (a *App) RegisterOnMux(mux *http.ServeMux) { // TODO(quentin): Should we just make the App itself be an http.Handler? + mux.HandleFunc("/", a.index) mux.HandleFunc("/upload", a.upload) mux.HandleFunc("/search", a.search) } + +// index serves the readme on / +func (a *App) index(w ResponseWriter, r *http.Request) { + http.ServeFile(w, r, "static/index.html") +}
diff --git a/storage/appengine/static/index.html b/storage/appengine/static/index.html new file mode 100644 index 0000000..096a293 --- /dev/null +++ b/storage/appengine/static/index.html
@@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html> + <head> + <title>Go Performance Data Server</title> + </head> + <body> + <h1>Go Performance Data Server</h1> + <p>The Go Performance Data Server allows upload and querying of benchmark results in the <a href="https://github.com/golang/proposal/blob/master/design/14313-benchmark-format.md">standard benchmark data format</a>. It provides a RESTful API to upload benchmark results and query individual results.</p> + <h2>API Documentation</h2> + + <h3>POST /upload</h3> + <p>A POST request to this URL with multipart/form-data contents. The form should contain a single field, "file", and the other MIME components are the uploaded files in benchmark format. The request is authenticated with OAuth. Upon success, it will return a JSON body that identifies the uploaded records:</p> + + <pre> +{ + "uploadid": "arbitrary-string", + "fileids": [ + "arbitrary-string-1", + "arbitrary-string-2" + ], + "viewurl": "https://foo/bar", +} + </pre> + + <p>The upload ID may be used in a query as "upload:$uploadid" to find the uploaded data, and each file ID may be used in a query as "upload-part:$fileid". The view URL is optional and if present points to a human-readable page for analysing the uploaded benchmark data.</p> + + <p>Errors will be returned as HTTP errors with a plain text error message.</p> + + <p>As a convenience for testing, GET on /upload will render an HTML form that can be used for initiating an upload.</p> + + <h3>GET https://perfdata.golang.org/search?q=$search</h3> + <p>A GET request to this URL will return a text file with synthesized benchmark results matching the search. The search string contains space-separated "key:value" pairs which limits the results to only records containing those exact fields. Every "key:value" pair is ANDed together, and each value must be matched exactly, with no regexes or substring matches supported. Range queries will be supported for prespecified date fields. Example searches:</p> + + <ul> + <li>by:rsc pkg:compress/flate commit:1234</li> + <li>upload-part:4567</li> + <li>upload:123</li> + <li>commit-time>2016-12-01</li> + </ul> + </body> +</html>