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

feat: inc metrics for each command ran #14

Merged
merged 4 commits into from
Dec 19, 2022
Merged

feat: inc metrics for each command ran #14

merged 4 commits into from
Dec 19, 2022

Conversation

caarlos0
Copy link
Member

this will be particularly useful for wishlist, but other apps might take advantage of it too...

This adds a command label to all metrics, and a way to customize what that value should be. By default, we get the first field of session.Command.

Signed-off-by: Carlos A Becker <[email protected]>
Signed-off-by: Carlos A Becker <[email protected]>
@caarlos0 caarlos0 added the enhancement New feature or request label Dec 19, 2022
@caarlos0 caarlos0 self-assigned this Dec 19, 2022
Signed-off-by: Carlos A Becker <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2022

Codecov Report

Merging #14 (b7c251c) into main (3474078) will increase coverage by 1.52%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #14      +/-   ##
==========================================
+ Coverage   86.88%   88.40%   +1.52%     
==========================================
  Files           1        1              
  Lines          61       69       +8     
==========================================
+ Hits           53       61       +8     
  Misses          6        6              
  Partials        2        2              
Impacted Files Coverage Δ
main.go 88.40% <100.00%> (+1.52%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@aymanbagabas aymanbagabas left a comment

Choose a reason for hiding this comment

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

It would be cool to have a way to add custom metrics to the middleware.

@caarlos0
Copy link
Member Author

It would be cool to have a way to add custom metrics to the middleware.

you can! You can simply add a new middleware that does what you want, or just register your metrics wherever you think it makes sense, so long they are added to the same registerer, everything should work :D

@caarlos0 caarlos0 merged commit d808d1f into main Dec 19, 2022
@caarlos0 caarlos0 deleted the app branch December 19, 2022 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants