Closed roscopecoltran closed 6 years ago
Hello, thanks for reporting the issue.
First of all, can you confirm that your code works without the httpstats
wrapper? For example, if you comment out t.Transport = httpstats.NewTransport(t.Transport)
, does everything work as expected.
httpstats
does not do any serialization of the request body to JSON. The error you get on func() (io.ReadCloser, error)
probably comes from a different layer. The signature matches the signature of the GetBody
field on http.Request
// GetBody defines an optional func to return a new copy of
// Body. It is used for client requests when a redirect requires
// reading the body more than once. Use of GetBody still
// requires setting Body.
//
// For server requests it is unused.
GetBody func() (io.ReadCloser, error)
Is it possible that something is attempting to serialize the entire HTTP request object in JSON and fails when it reaches this field?
I would need to have access to a bit more code to understand the problem, at best a runnable program that highlights the issue so I can dig more.
As to producing to a TUI dashboard, there's no such thing in httpstats yet. There are multiple destinations supported to produce metrics to (like datdog, influxdb, etc...), so if you wanted to add a new one I'd be happy to review and accept a pull request.
Hi,
Thanks for the reply ! :-)
Repos:
Implementations:
Run:
Import Deps (Note: other deps are already available in the vendor dir)
cd $GOPATH/src/github.com/sniperkit/limo
go get -v github.com/sniperkit/httpcache
Register your github personal token (Note: Limit to 5000 requests)
cd $GOPATH/src/github.com/sniperkit/limo
go get -v github.com/sniperkit/httpcache
go run main.go login
Fetch your starred repo (Ref: https://github.com/sniperkit/limo/blob/httpstats/service/github.go#L54-L91)
go run main.go update
Notes:
Cheers, Richard
Hi,
I made another examples at:
Hope it will be more helpful !
Cheers, Richard
Hi,
You can close the issue. I have fixed the problem as it was on my side.
Ps. Have you been in Epitech Lyon ?
Cheers, Richard
Good to know.
I was at Epitech in Nice actually.
Hi guys,
Hope you are all well !
Global overview: I forked a small utility for managing my starred repositories on github.com called https://github.com/hoop33/limo.
I recently added some new go-github api calls, httpcache to make some conditional requests and optimize the use of the api rate limits. Also, i create my own backend to save all responses from the api and compress then with snappy into a badger KB datastore.
Why related to stats/httpstats ? I just wanted to benchmark and grab statistics of my http requests, and get a benchmark of the httpcache or the latency of some paginated http requests. And add some golbal statistics like described in this project https://github.com/jamiealquiza/tachymeter
What is the issues ? I tried to hijack the http.client transport for httpcache or github-go package but I get this error due to the httpstats transport wrapper.
httpstats triggers those alarms on Content-Types like "application/json" or "application/octet-stream"
Questions ?
Thanks in advance for any hints or help about this issue ^^.
Cheers, Richard