rakyll / gom

A visual interface to work with runtime profiling data for Go
Apache License 2.0
1.29k stars 42 forks source link

Error when doing the json parsing. #17

Open kalashnikov opened 8 years ago

kalashnikov commented 8 years ago

Hi,

I got following error message and it looks strange.

error fetching stats: json: cannot unmarshal number into Go value of type main.stats

2__t0__ssh_

Using Go1.5 with Martini and invoke by gom -target "http://localhost:3000". Ubuntu 14.04.


I found that's because it cannot get the pprofstats info.

After updating, I got new message.

error fetching stats: invalid character '<' looking for beginning of value

2__t0__ssh_

Any suggestion to debug?

rakyll commented 8 years ago

Related to https://github.com/rakyll/gom/pull/15/.

rakyll commented 8 years ago

You need to manually register gom/http.Handler() to respond to /debug/_gom.

import gomhttp "github.com/rakyll/gom/http"

// ...
h := gomhttp.Handler()
m.Use(func(res http.ResponseWriter, req *http.Request) {
  if req.URL.Path == "/debug/_gom" {
    h(res, req)
  }
})
kalashnikov commented 8 years ago

I add as you suggested. But still get same error message.

error fetching stats: invalid character '<' looking for beginning of value

/debug/_gom shows below line

{"goroutine":28,"thread":9,"block":0,"timestamp":1452401805}

rakyll commented 8 years ago

I guess this is related to the body's being gzipped or not. I will try to reproduce and send out a fix soon.