summaryrefslogtreecommitdiffhomepage
path: root/tsweb
AgeCommit message (Collapse)AuthorFilesLines
2021-02-01tsweb: add num_goroutines expvarJosh Bleecher Snyder1-0/+1
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-01-26net/interfaces: remove IsTailscaleIP, make callers use tsaddr.David Anderson1-3/+7
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-01-14tsweb: export VarzHandlerBrad Fitzpatrick1-3/+3
2020-12-08tsweb: add an endpoint to manually trigger a GC.David Anderson1-0/+10
Signed-off-by: David Anderson <danderson@tailscale.com>
2020-11-10tsweb: refactor JSONHandler to take status code from error if it is present ↵chungdaniel2-23/+68
(#905) This change is to make JSONHandler error handling intuitive, as before there would be two sources of HTTP status code when HTTPErrors were generated: one as the first return value of the handler function, and one nested inside the HTTPError. Previously, it took the first return value as the status code, and ignored the code inside the HTTPError. Now, it should expect the first return value to be 0 if there is an error, and it takes the status code of the HTTPError to set as the response code. Signed-off-by: Daniel Chung <daniel@tailscale.com>
2020-10-30tsweb: add StatusCodeCounters to HandlerOptionsJosh Bleecher Snyder1-0/+9
This lets servers using tsweb register expvars that will track the number of requests ending in 200s/300s/400s/500s. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-10-30tsweb: add StdHandlerOpts that accepts an options structJosh Bleecher Snyder2-17/+29
I'm about to add yet another StdHandler option. Time to refactor. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-09-17tsweb: when unwrapping HTTPError, record the user-facing message also in the logDavid Crawshaw3-3/+12
There's often some useful piece of information in there not already repeated in the internal error. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-09-17tsweb: make JSONHandlerFunc implement ReturnHandler, not http.HandlerDavid Crawshaw2-22/+31
This way something is capable of logging errors on the server. Fixes #766 Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-08-18tsweb: rewrite JSONHandler without using reflect (#684)halulu2-201/+119
Closes #656 #657 Signed-off-by: Zijie Lu <zijie@tailscale.com>
2020-07-14tsweb: jsonhandler: fix content typeZijie Lu2-1/+5
Signed-off-by: Zijie Lu <zijie@tailscale.com>
2020-06-09tsweb: JSONHandler: supports HTTPErrorZijie Lu2-9/+29
Signed-off-by: Zijie Lu <zijie@tailscale.com>
2020-06-08tsweb: fix JSONHandler nil responseZijie Lu2-1/+24
Signed-off-by: Zijie Lu <zijie@tailscale.com>
2020-06-05tsweb: JSONHandler using reflect (#437)halulu2-0/+300
Updates #395 #437 Signed-off-by: Zijie Lu <zijie@tailscale.com>
2020-04-28tstest: rename from testy.David Anderson1-2/+2
Signed-off-by: David Anderson <danderson@tailscale.com>
2020-04-22tsweb: add ReturnHandlerFunc.David Anderson1-0/+11
Signed-off-by: David Anderson <danderson@tailscale.com>
2020-04-05tsweb: add some BenchmarksBrad Fitzpatrick1-0/+32
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-05tsweb: rename Handler to ReturnHandlerBrad Fitzpatrick2-40/+37
The name's been bugging me for a long time. I liked neither the overlap between tsweb.Handler and http.Handler, nor the name "ServeHTTPErr" which sounds like it's an error being returned, like it's an error handler and not sometimes a happy path. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-05tsweb: fix tests.David Anderson1-1/+1
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-05tsweb: add a StdHandler that doesn't log 200 responses.David Anderson1-4/+15
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-04tsweb: don't flush, treat no-op Handler as 200, like GoBrad Fitzpatrick2-29/+16
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-03tsweb: add a test case for nil child errors in tsweb.Error.David Anderson1-0/+16
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-03tsweb: don't panic if we get a tsweb.Error with no embedded error.David Anderson1-1/+3
It's technically weird to return a tsweb.Error with no child err, but it's a sensible thing to want to do, and we shouldn't panic if it happens. Signed-off-by: David Anderson <dave@natulte.net>
2020-03-19tsweb: use a ResponseWriter wrapper to log more accurately.David Anderson3-60/+426
Also adds tests, because the logging handler is acquiring a fair number of branches. Signed-off-by: David Anderson <dave@natulte.net>
2020-03-18tsweb: move some comments, add a TODOBrad Fitzpatrick1-13/+22
2020-03-18tsweb: adjust names and docs of the "handler with errors" functions.David Anderson2-24/+35
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-17tsweb: add a Handler type.David Anderson2-4/+63
Handler is like http.Handler, but returns errors. ErrHandler converts back to an http.Handler, with added error handling and logging. Signed-off-by: David Anderson <dave@natulte.net>
2020-03-17tsweb: add copyright headerBrad Fitzpatrick1-2/+5
And fix an unlikely but potential crash.
2020-03-17tsweb: pull in tlog data structures from corp repo.David Anderson1-0/+56
This is a prelude to having logging helpers in tsweb. Signed-off-by: David Anderson <dave@natulte.net>
2020-03-10wgengine/monitor: don't call LinkChange when interfaces look unchangedBrad Fitzpatrick1-1/+1
Basically, don't trust the OS-level link monitor to only tell you interesting things. Sanity check it. Also, move the interfaces package into the net directory now that we have it.
2020-03-06tsweb: don't double import expvar; appease staticcheckBrad Fitzpatrick1-1/+0
2020-03-06tsweb: export runtime.MemStats var in Prometheus formatBrad Fitzpatrick1-1/+29
2020-03-05tsweb: let expvar.Ints be gauges tooBrad Fitzpatrick1-13/+17
2020-03-04tsweb: add /debug/ access via &debugkey + TS_DEBUG_KEY_PATHBrad Fitzpatrick1-2/+17
2020-03-04tsweb: quote label values to comply with Prometheus format.David Anderson1-1/+1
2020-03-04metrics: add a LabelMap type for variables with 1 label dimension.David Anderson1-11/+24
This lets us publish sets of vars that are breakdowns along one dimension in a format that Prometheus and Grafana natively know how to do useful things with. Signed-off-by: David Anderson <dave@natulte.net>
2020-03-03tsweb, derp: add expvar http.Handler for Prometheus's formatBrad Fitzpatrick1-6/+73
And add some opinions. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-25tsweb, cmd/derper: move common web/debug stuff from derper to new tswebBrad Fitzpatrick1-0/+116
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>