-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: expvarHandler should use json.Marshal to encode vars #1684
Labels
Comments
Owner changed to @dsymonds. Status changed to Accepted. |
I can take this bug and submit a patch, but their would likely be an api change. The api would be simplified to the following functions and remove the automatic registration of the handler: // Publish the variable to name. func Publish(name string, v interface{}) // Get returns the value registered under name func Get(name string) interface{} // Published returns a slice of the currently published keys func Published() []string // Register the default vars object with the default http server. Place this in your // package or commands's init function to register the handler automatically. This // function is guarded by a sync.Once object. func Register() Published does present a possible race condition, so that may need to be changed. The structure that implements the above functions, called Exporter, would be exposed in case one wants to mount the handler at a different location or has some specific use case. This structure would implement http.Handler and json.Marshaler. |
This issue was closed by revision 57d0c26. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: