-
Notifications
You must be signed in to change notification settings - Fork 164
add variadic counterOpts funcs to server and client metrics constructor #25
Conversation
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
=========================================
- Coverage 79.45% 77.4% -2.05%
=========================================
Files 7 8 +1
Lines 258 270 +12
=========================================
+ Hits 205 209 +4
- Misses 45 52 +7
- Partials 8 9 +1
Continue to review full report at Codecov.
|
Hi grpc-ecosystem-team, is there a way to get this PR reviewed/merged? I'd be glad to receive feedback - ideally a PR approval. Best, Christoph |
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it
… Am 29.09.2017 um 16:57 schrieb googlebot ***@***.***>:
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
📝 Please visit https://cla.developers.google.com/ <https://cla.developers.google.com/> to sign.
Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.
If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data <https://cla.developers.google.com/clas> and verify that your email is set on your git commits <https://help.github.com/articles/setting-your-email-in-git/>.
If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#25 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AFz_9rGJw3NRwnCDsP3QBaF3F0I-_Zoiks5snQV0gaJpZM4PfXVt>.
|
CLAs look good, thanks! |
server_metrics.go
Outdated
@@ -61,6 +62,24 @@ func WithHistogramBuckets(buckets []float64) HistogramOption { | |||
return func(o *prom.HistogramOpts) { o.Buckets = buckets } | |||
} | |||
|
|||
func WithHistogramConstLabels(labels prom.Labels) HistogramOption { |
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 this function is not in metric_options.go and not used?
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 found the other WithXXX() HistogramOption
functions in server_metrics.go
, so I decided to put my one here too. You are right, they are all not specific to server instrumentation, so I would move all funcs returning a
HistogramOption
to metric_options.go if you agree.
Why they're not used? I hope I get your question right: all of the WithXXX()
functions are not used. They are functions a package user can use to configure the metrics.
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 see. I prefer to move all WithXXX() option to metric_options.go.
Writing these functions in this file feels confusing.
I asked you why not used this function because I only saw New{Sever,Client}Metrics function. I got now, it is wrong comment. Sorry.
@atetubou I moved the HistogramOption type and option setters (WithXXX) to |
Can't you achieve it with a separate Registry that will add your namespace? @brancz is probably better placed for this |
Unfortunately the Prometheus golang client doesn't implement Aside from that, I wonder why you want to prefix these metrics additionally, it would mean that dashboards, alerting rules etc. all have to be duplicated because of that prefix, while the queries are actually the same. |
Actually this PR is more about adding const labels. As stated in the original PR adding namespace and subsystem opts was done as a convenience. We can remove this if they concern you. We only care about the const labels. |
In that case I think those should be removed as proper support in the golang client is already being worked on, the additional labels make sense though (although this could also be something that could be addressed by the golang client but haven’t heard it being discussed so far). |
I removed the |
@mwitkow can I do something to close (preferably with a merge ;) ) this issue? anything missing? |
lgtm 👍 |
Thanks! Sorry it took so long, I went a little dark on my open source contrib work. |
thanks @mwitkow! |
we have the use case that we need to add const label pairs to the metrics. We are exposing a gRPC service w/ and w/o TLS and we want to partition the metrics on a label "schema". So I added a variadic option func to the metric constructors. As the options don't have many fields, I added option funcs for Namespace, Subsystem and Namespace as well.
If it makes sense to you, I would add some documentation for the option functions.