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

cmd/thanos/bucket: expose metrics #1702

Merged
merged 1 commit into from
Oct 31, 2019
Merged

Conversation

squat
Copy link
Member

@squat squat commented Oct 31, 2019

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.

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>
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))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change these specifically?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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

Copy link
Contributor

@metalmatze metalmatze left a comment

Choose a reason for hiding this comment

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

lgtm

@brancz brancz merged commit 08b3dc6 into thanos-io:master Oct 31, 2019
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

🚅 AWESOME (:

@squat squat deleted the bucketwebmetrics branch November 4, 2019 14:38
squat added a commit to squat/thanos that referenced this pull request Nov 4, 2019
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>
bwplotka pushed a commit that referenced this pull request Nov 4, 2019
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>
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.

5 participants