-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Add new CollectorFunc utility #1724
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
feat: Add new CollectorFunc utility #1724
Conversation
Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com>
Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com>
…/Saumya40-codes/client_golang into implement-new-collectorfunc-util
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.
Thanks! Amazing 💪🏽
Can we also add one example to https://github.com/prometheus/client_golang/blob/main/prometheus/examples_test.go ?
Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com>
Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com>
Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com>
I've added an example related to CollectorFunc there, can you PTAL? |
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.
Thanks!
* feat: add CollectorFunc utility Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com> * update Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com> * added license to the test Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com> * address req changes Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com> * update license part in test file Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com> * add collectorFunc example to prometheus/examples_test.go Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com> --------- Signed-off-by: Saumyacodes-40 <saumyabshah90@gmail.com>
Issue it is resolving
Resolves #1701
Description of changes
CollectorFunc
utility inpromethues
package.Collect
andDescribe
functions,CollectorFunc
just requires to haveCollect
logic in it. Thus reducing extraboilerplate
code (under certain scenerios)CollectorFunc
function that it leverages theDescribeByCollector
functionTesting
collectorfunc_test.go
(more test might be needed)cc: @bwplotka