diff --git a/experimental/tracer/README.md b/experimental/tracer/README.md
index 7a077cee8..23cc29f33 100644
--- a/experimental/tracer/README.md
+++ b/experimental/tracer/README.md
@@ -3,7 +3,9 @@ Run tracer:
- ./tracer.sh start
TODO:
-- need to stich traces together
+- need to stich traces together
- deal with persistant connections
- make it work for goroutines
- test with jvm based app
+- find way to get local ip address for an incoming connection
+- make the container/process trace start/stop more reliable
diff --git a/experimental/tracer/main/http.go b/experimental/tracer/main/http.go
index 53ca11d0c..9ebdae3b4 100644
--- a/experimental/tracer/main/http.go
+++ b/experimental/tracer/main/http.go
@@ -7,8 +7,8 @@ import (
"mime"
"net/http"
"strconv"
+ "strings"
- dockerClient "github.com/fsouza/go-dockerclient"
"github.com/gorilla/mux"
"github.com/weaveworks/scope/probe/docker"
@@ -45,13 +45,31 @@ func (t *tracer) pidsForContainer(id string) ([]int, error) {
return pidTree.GetChildren(container.PID())
}
+type Container struct {
+ Id string
+ Name string
+ PIDs []int
+}
+
func (t *tracer) http(port int) {
router := mux.NewRouter()
router.Methods("GET").Path("/container").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- containers := []*dockerClient.Container{}
+ pidTree, err := process.NewTree(process.NewWalker("/proc"))
+ if err != nil {
+ respondWith(w, http.StatusBadRequest, err.Error())
+ return
+ }
+
+ containers := []Container{}
t.docker.WalkContainers(func(container docker.Container) {
- containers = append(containers, container.Container())
+ children, _ := pidTree.GetChildren(container.PID())
+ out := Container{
+ Name: strings.TrimPrefix(container.Container().Name, "/"),
+ Id: container.ID(),
+ PIDs: children,
+ }
+ containers = append(containers, out)
})
respondWith(w, http.StatusOK, containers)
diff --git a/experimental/tracer/main/store.go b/experimental/tracer/main/store.go
index ad8c137db..a47cfbd57 100644
--- a/experimental/tracer/main/store.go
+++ b/experimental/tracer/main/store.go
@@ -95,7 +95,6 @@ func (t *trace) addChild(child *trace) {
// Fix up some fields
child.ClientDetails = candidate.ClientDetails
- child.PID = candidate.PID
IncrementLevel(child, t.Level+1)
// Overwrite old record
diff --git a/experimental/tracer/ui/index.html b/experimental/tracer/ui/index.html
index 35e0b32da..ca99672fd 100644
--- a/experimental/tracer/ui/index.html
+++ b/experimental/tracer/ui/index.html
@@ -220,14 +220,14 @@