-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Gauge that allows setting value #1126
Comments
To give another idea and/or help for someone who wants to work around this: If you are using spring boot actuator, their dropwizard wrapper does support updating a gauge: DropwizardMetricServices.java#L202 If you are not using the spring boot framework, you can still take a look at the implementation: There is a custom SimpleGauge class that implements dropwizards Gauge interface and provides a method to directly set the current Gauge value. |
@xiaochuanyu Would you be able to provide a pull request for this feature? |
@joschi |
Look around the code first - it's not complex at all. All things have their own place. Here is my suggestion, how you could go about it. You probably want to start with creating a newly documented interface that extends existing Things to think about. There are existing Gauge implementations that might need attention. Do they need to support new feature?
Hope this helps. Let me know if you are planning to work on this, if not I will be happy to pick it up. |
@the-thing thanks for the very detailed explanations. |
@xiaochuanyu Thanks for the raising the issue and making the changes. It'll be a useful update. @the-thing Seeing that the issue is tagged to 4.2.0 release, wonder if there is any estimated release date? Thanks. |
@xushiyan I'm not to say as I'm not a member of dropwizard. The pull requests requires reviews from members as well. Usually things get merged pretty fast as long as the approval comes in. |
@the-thing Thanks for the info! |
I find the current API for gauges awkward to use in certain situations where I simply just to want to set the gauge to arbitrary values. It is not always convenient to specify upfront a lambda or inner class required for providing values to a Gauge.
To illustrate, I extend the contrived example from the Getting Started page as follows:
In order to have an API like above I currently copy-paste around the classes from here:
https://github.com/signalfx/signalfx-java/tree/master/signalfx-codahale/src/main/java/com/signalfx/codahale/metrics
I'd like to propose in include this in the main library itself.
The text was updated successfully, but these errors were encountered: