File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 5
5
"crypto/tls"
6
6
"crypto/x509"
7
7
"database/sql"
8
+ "expvar"
8
9
"flag"
9
10
"fmt"
10
11
"io"
@@ -561,6 +562,10 @@ func New(options *Options) *API {
561
562
562
563
derpHandler := derphttp .Handler (api .DERPServer )
563
564
derpHandler , api .derpCloseFunc = tailnet .WithWebsocketSupport (api .DERPServer , derpHandler )
565
+ // Register DERP on expvar HTTP handler, which we serve below in the router, c.f. expvar.Handler()
566
+ // These are the metrics the DERP server exposes.
567
+ // TODO:
568
+ expvar .Publish ("derp" , api .DERPServer .ExpVar ())
564
569
cors := httpmw .Cors (options .DeploymentValues .Dangerous .AllowAllCors .Value ())
565
570
prometheusMW := httpmw .Prometheus (options .PrometheusRegistry )
566
571
@@ -1038,6 +1043,10 @@ func New(options *Options) *API {
1038
1043
r .Use (httpmw .ExtractUserParam (options .Database ))
1039
1044
r .Get ("/debug-link" , api .userDebugOIDC )
1040
1045
})
1046
+ r .Route ("/derp" , func (r chi.Router ) {
1047
+ r .Get ("/traffic" , options .DERPServer .ServeDebugTraffic )
1048
+ })
1049
+ r .Mount ("/expvar" , expvar .Handler ()) // contains DERP metrics as well as cmdline and memstats
1041
1050
})
1042
1051
})
1043
1052
You can’t perform that action at this time.
0 commit comments