Closed tifayuki closed 6 years ago
@stevvooe
can you please review this PR, I would like to use it in docker/distribution
to provide http prometheus metrics
cc @manishtomar
cc @nandhini915
cc @crosbymichael
Looks like this is copy pasted from https://github.com/prometheus/client_golang/blob/master/prometheus/http.go#L232. Why not use the standard layout?
Answered my own question in godoc: "- It uses Summaries rather than Histograms. Summaries are not useful if aggregation across multiple instances is required.".
Ok, this generally looks okay.
@cpuguy83 Did we instrument the moby api in prometheus yet? We should probably use this functions, if we can.
I'm not crazy about the API here.
Name at least should be a func argument in all cases, this would make the split WithOpts
and no-opts functions a bit more useful.
Should this panic if name is empty? Should this also be tied to a namespace rather than making the namespace optional?
I have pushed another commit with the following changes:
1) remove the .gitignore file
2) rename HttHandlerOpts
to HTTPHandlerOpts
3) add namespace paramenter to non-WithOpts
functions
4) panic if namespace or handlerName is not given
5) use handler name as constant label, avoiding use them as the name of a metrics
6) use register from go-metrics
instead of MustRegister
from prometheus/client-golang
@tifayuki I really meant that it would be good to bind the HTTP instrumentation helpers to the *Namespece
type and that is one less thing that needs to be passed in.
@tifayuki @cpuguy83 Yes, these should be a function of the namespace. All metrics should descend from the namespace, per this package.
If that is not done, it makes these additions a little redundant.
@stevvooe @cpuguy83 I have re-implemented the http handlers using namespace. Can you take a look?
@stevvooe
Can you please review the PR again? Need it to be merged so that we can use it to provide metrics in docker/distribution
Thank you
LGTM
In the latest prometheus go client, handlers provided before in
prometheus
package are deprecated. Instead,promhttp
package is recommended.This PR implements functions that wraps original methods in
promhttp
.It also fix the compilation error, when building against
prometheus/client-golang
master.