Flakiness Dashboard v2

Type safety, improved performance

12 July 2016

Nishanth Shanmugham

Topics

2

Improve HTTP router

3

Issues with old router

4

Middleware

func wrap(h middleware.Handler) httprouter.Handle {
    h = auth.Authenticate(h)
    h = templates.WithTemplates(h, tmpl)
    h = middleware.WithContextValue(h, configContextKey(0), &cfg)
    return base(h)
}

r.GET("/hello", wrap(helloPage))

Essentially

base(middleware.WithContextValue(templates.WithTemplates(auth.Authenticate(helloPage...

Reversed order.

5

Long handler signatures

func helloPage(c context.Context w http.ResponseWriter, r *http.Request, p httprouter.Params)
6

Summary

Can we do better?

7

New router

8

Middleware

Create middleware chain

mw := router.NewMiddlewareChain(
    base,
    middleware.WithContextValue(configContextKey(0), &cfg),
    templates.WithTemplates(tmpl),
    auth.Authenticate,
)

Register middleware and handler

r.GET("/hello", mw, helloPage)
9

Compare to old router

New

mw := router.NewMiddlewareChain(
    base,
    middleware.WithContextValue(configContextKey(0), &cfg),
    templates.WithTemplates(tmpl),
    auth.Authenticate
)

r.GET("/hello", mw, helloPage)

Old

func wrap(h middleware.Handler) httprouter.Handle {
    h = auth.Authenticate(h)
    h = templates.WithTemplates(h, tmpl)
    h = middleware.WithContextValue(h, configContextKey(0), &cfg)
    return base(h)
}

r.GET("/hello", wrap(helloPage))
10

Less verbose handler signature

func helloPage(c *router.Context)

type Context struct {
    Context context.Context
    Writer  http.ResponseWriter
    Request *http.Request
    Params  httprouter.Params
}
11

Compare to old router

New

func helloPage(c *router.Context)

Old

func helloPage(c context.Context w http.ResponseWriter, r *http.Request, p httprouter.Params)
12

New router

13

Flakiness Dashboard v2

14

Test Results server

test-results.appspot.com
test-results.appspot.com/dashboards/flakiness_dashboard.html

15

Test results and flakiness

Get results: /testilfe
Bots upload results: /testfile/upload

16

Test results and flakiness

17

Performance

/updatebuilders

chrome-build-extract.appspot.com/get_master/chromium.fyi
chrome-build-extract.appspot.com/get_builds?builder=CrWinAsan&master=chromium.fyi&num_builds=1
18

Performance (contd.)

/updatebuilders

2.5x faster, can compute builders information more frequently if needed

19

Fewer failures

Requests that failed on Python app no longer fail in Go app

/testfile?master=tryserver.chromium.win&builder=win_chromium_rel_ng&name=results.json&testlistjson=1&testtype=unit_tests%20(with%20patch)
20

21

22

Follow Google style guide (omit optional tags in HTML)

New

<!DOCTYPE html>
<title>Test Results</title>
<link rel="stylesheet" href="/stylesheets/testfile.css" />
<script>...</script>
<h1>Test Results
...

Old

<!DOCTYPE html>
<html>
<head>
<title>Test Results</title>
<link type="text/css" rel="stylesheet" href="/stylesheets/testfile.css" />
<script>...</script>
</head>
<body>
<h1>Test Results
...
23

Other improvements

24

What's next?

/testfile Done
/testfile/upload In progress
/builders In review
/updatebuilders In review
/builderstate In review
/updatebuilderstate In review
/internal/monitoring/upload (eventmon) In progress
25

Summary

26

Thank you

Nishanth Shanmugham