Skip to content

Commit

Permalink
use proc endpoint on daemons
Browse files Browse the repository at this point in the history
  • Loading branch information
muraty committed Oct 6, 2020
1 parent 64eb9e5 commit 80f1c32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (d *Daemon) parsePortParam(w http.ResponseWriter, req *http.Request) (uint3
return uint32(p), nil
}

func (d *Daemon) conns(w http.ResponseWriter, req *http.Request) {
func (d *Daemon) Process(w http.ResponseWriter, req *http.Request) {
// todo: cache result for a short period (10s? 30s?)
port, err := d.parsePortParam(w, req)
if err != nil {
Expand Down Expand Up @@ -100,7 +100,7 @@ func (d *Daemon) conns(w http.ResponseWriter, req *http.Request) {
}

func (d *Daemon) Run() error {
http.HandleFunc("/conns", d.conns)
http.HandleFunc("/proc", d.Process)
err := http.ListenAndServe(d.Config.ListenAddress, nil)
if err != nil {
log.Errorln(err.Error())
Expand Down
2 changes: 1 addition & 1 deletion server/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type KimoProcess struct {
func (kp *KimoProcess) FetchDaemonProcess(ctx context.Context, host string, port uint32) (*types.DaemonProcess, error) {
// todo: use request with context
var httpClient = NewHttpClient(kp.Server.Config.DaemonConnectTimeout*time.Second, kp.Server.Config.DaemonReadTimeout*time.Second)
url := fmt.Sprintf("http://%s:%d/conns?port=%d", host, kp.KimoRequest.Server.Config.DaemonPort, port)
url := fmt.Sprintf("http://%s:%d/proc?port=%d", host, kp.KimoRequest.Server.Config.DaemonPort, port)
log.Debugf("Requesting to %s\n", url)
response, err := httpClient.Get(url)
if err != nil {
Expand Down

0 comments on commit 80f1c32

Please sign in to comment.