Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expvar: export http.Handler #15030

Closed
captncraig opened this issue Mar 30, 2016 · 5 comments
Closed

expvar: export http.Handler #15030

captncraig opened this issue Mar 30, 2016 · 5 comments
Milestone

Comments

@captncraig
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go1.6
  2. What operating system and processor architecture are you using (go env)?
    darwin amd64
  3. If not using http's default serveMux, import _ "expvar" cannot add the appropriate handler for me. The handler added by the init function adds an http handler that does a bit of logic I would like to have. I can make it work a couple of different ways:
  • Copy expvarHandler into my application and attach it to my mux.
  • myMux.Handle("/debug/vars", http.DefaultServeMux), which sort of works, but doesn't help me if I want it at another path or anything like this.

Simply exporting expvarHandler would allow me to do myMux.HandleFunc("/whatever/route/I/want", expvar.Handler).

Would the go team consider a change to that effect?

@bradfitz
Copy link
Contributor

Sure, feel free to send a change adding:

// Handler returns the expvar HTTP Handler.
//
// This is only needed to install the handler in a non-standard location. 
func Handler() http.Handler {
   return http.HandlerFunc(expvarHandler)
}

@bradfitz bradfitz added this to the Unplanned milestone Mar 30, 2016
@bradfitz bradfitz changed the title export expvarHandler from expvar package expvar: export http.Handler Mar 31, 2016
@thraxil
Copy link
Contributor

thraxil commented Jul 3, 2016

I ran into this issue myself and didn't see any followup here, so I submitted a CL: https://go-review.googlesource.com/#/c/24722/

@gopherbot
Copy link

CL https://golang.org/cl/24722 mentions this issue.

@palaiya
Copy link

palaiya commented Aug 1, 2016

Any updates on the issue?

@bradfitz
Copy link
Contributor

bradfitz commented Aug 1, 2016

We're in a freeze for Go 1.7. The CL above was tagged as R=go1.8 for review during the Go 1.8 dev cycle, opening soon.

@bradfitz bradfitz modified the milestones: Go1.8, Unplanned Aug 1, 2016
miguelff pushed a commit to github/freno that referenced this issue Mar 16, 2017
As expvar.Handler is not exported anymore:

See golang/go#15030
@golang golang locked and limited conversation to collaborators Sep 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants