-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
cmd/thanos/bucket: expose metrics #1702
Conversation
Currently, the bucket web command generates and registers metrics but they are never actually exposed. This commit ensures that the metrics are exposed and leverages the recently created server package for consistency. This cleanup also helps prepare for the upcoming changes for thanos-io#1657. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
5018c85
to
df3688b
Compare
r.Get("/", instrf("root", b.root)) | ||
r.Get("/static/*filepath", instrf("static", b.serveStaticAsset)) | ||
s.Handle("/", instrf("root", b.root)) | ||
s.Handle("/static/*filepath", instrf("static", b.serveStaticAsset)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change these specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:/ because the Server
type doesn't have a Get
method, only a Handle
and to be consistent internally, it simplifies things to re-use the server package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Server
is just a wrapper around http.Server
that why it resonates with its methods. However, since prometheus/common/route.Router
implements http.Handler
you can pass it down to the Server
, if you want to preserve behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could do that but I think it would just add an extra layer of complexity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚅 AWESOME (:
This commit fixes a regression introduced in thanos-io#1702, where the signature of the bucketui.Register method was changed. The bug was caused because one of the registered paths relied on the HTTP parameter variable support from github.com/julienschmidt/httprouter, which the standard library does not support. The fix is instead to implement the change recommended in thanos-io#1702 (comment). Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit fixes a regression introduced in #1702, where the signature of the bucketui.Register method was changed. The bug was caused because one of the registered paths relied on the HTTP parameter variable support from github.com/julienschmidt/httprouter, which the standard library does not support. The fix is instead to implement the change recommended in #1702 (comment). Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
Currently, the bucket web command generates and registers metrics but
they are never actually exposed. This commit ensures that the metrics
are exposed and leverages the recently created server package for
consistency.
This cleanup also helps prepare for the upcoming changes for
#1657.
Signed-off-by: Lucas Servén Marín lserven@gmail.com
Changelog entry is already covered by #1680
Verification
Launched bucket web component before and after change and ensured that metrics are exposed.