Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cf_debug_server_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ func TestCfDebugServer(t *testing.T) {
var _ = SynchronizedBeforeSuite(func() []byte {
return nil
}, func(encodedBuiltArtifacts []byte) {
address = fmt.Sprintf("127.0.0.1:%d", 10000+GinkgoParallelNode())
address = fmt.Sprintf("127.0.0.1:%d", 10000+GinkgoParallelProcess())
})
10 changes: 7 additions & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ type DebugServerConfig struct {
DebugAddress string `json:"debug_address"`
}

type ReconfigurableSinkInterface interface {
SetMinLevel(level lager.LogLevel)
}

func AddFlags(flags *flag.FlagSet) {
flags.String(
DebugFlag,
Expand All @@ -38,11 +42,11 @@ func DebugAddress(flags *flag.FlagSet) string {
return dbgFlag.Value.String()
}

func Runner(address string, sink *lager.ReconfigurableSink) ifrit.Runner {
func Runner(address string, sink ReconfigurableSinkInterface) ifrit.Runner {
return http_server.New(address, Handler(sink))
}

func Run(address string, sink *lager.ReconfigurableSink) (ifrit.Process, error) {
func Run(address string, sink ReconfigurableSinkInterface) (ifrit.Process, error) {
p := ifrit.Invoke(Runner(address, sink))
select {
case <-p.Ready():
Expand All @@ -52,7 +56,7 @@ func Run(address string, sink *lager.ReconfigurableSink) (ifrit.Process, error)
return p, nil
}

func Handler(sink *lager.ReconfigurableSink) http.Handler {
func Handler(sink ReconfigurableSinkInterface) http.Handler {
mux := http.NewServeMux()
mux.Handle("/debug/pprof/", http.HandlerFunc(pprof.Index))
mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
Expand Down