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

Add HTTP multiplexor wrapper for automatic telemetry. #6

Merged
merged 1 commit into from
Apr 2, 2013

Conversation

matttproud
Copy link
Member

No description provided.

@ghost ghost assigned juliusv Mar 28, 2013
}

funcDelegator struct {
delegate func(http.ResponseWriter, *http.Request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delegate http.HandlerFunc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch.

@peterbourgon
Copy link
Contributor

You said you're not 100% happy with the API, but can you expand on that a bit? If DefaultCoarseMux should be a dropin replacement for DefaultServeMux, I guess I don't see how the "API" presented here could be any different...

@matttproud
Copy link
Member Author

@peterbourgon, yeah, what I am not so happy about is how to conveniently and with the least overhead provide a simple means for someone to wrap their existing exports and get standardized telemetry for that. In looking into using the Mux case further, I am uncertain that this is the route I want to continue in. I'll issue a follow-up revision to outline a few ideas.

@matttproud
Copy link
Member Author

@peterbourgon and @juliusv, please go ahead and give this version a look. I am unsure as to whether the drop-in-replacement model is really the thing to do, but I am willing to expand the interface around this and publicize:

  1. funcDelegator to WrapHandlerFunc(h http.HandlerFunc) http.HandlerFunc
  2. handlerDelegator to WrapHandler(h http.Handler) http.Handler

This would enable folks to get standardized Prometheus telemetry for multiple HTTP server multiplexors. Let me ask you this, what would you and the lazy like to use?

)

func init() {
flag.StringVar(&listeningAddress, "listeningAddress", ":8080", "The address to listen to requests on.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var (
    listen = flag.String("listen", ":8080", "address to listen to requests")
)

Maybe: more compact, less stuttering, no less clarity, and more idiomatic to boot (I think).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I'll refresh this throughout.

@peterbourgon
Copy link
Contributor

Discussion about 'exp' notwithstanding, ⛵

@matttproud
Copy link
Member Author

Cool. Those package refactorings will occur in a follow-up.

@ghost ghost assigned discordianfish Apr 2, 2013
@discordianfish
Copy link
Member

Really nice and looks good to me 👍

matttproud added a commit that referenced this pull request Apr 2, 2013
Add HTTP multiplexor wrapper for automatic telemetry.
@matttproud matttproud merged commit a087e01 into master Apr 2, 2013
@matttproud matttproud deleted the feature/user-love/http-mux-wrapper branch April 2, 2013 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants