-
Notifications
You must be signed in to change notification settings - Fork 118
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
Enhanced Gauge API (#106) #107
base: master
Are you sure you want to change the base?
Conversation
|
6f3c35b
to
732f603
Compare
732f603
to
65711ac
Compare
1 similar comment
@robskillington, can you please review this PR? |
@robskillington & @mway, will you please review or tag the persons who can review? |
No problem, thank you for the PR! At a high level, I have two concerns with this change:
It might help if you give a little more info about your use case and the problem you're trying to solve - there may be another solution, or we may be able to incorporate this into our design considerations for the redesign we're planning right now. Let us know! |
Thanks, @mway for the reply.
Let's say we want to produce the metric for There are multiple ways to solve it: A1. By using Counter with tags/labels i.e. type=request and type=response : To graph it, we query like {type=request} - {type=response} A2. Gauge with existing API, user will maintain the value and calls A3. Using gauge(provided it has Add and Sub functions): use Add(1) on every request arrival and Sub(1) on every reply Now, the ask is: "We want to produce total active requests per client/region". We need to add the tag "client" and it's value will be known during runtime. For every client value, library will allocate and maintain the metric value. Now let's discuss dis-advantages: A1. To maintain time series data at server side, the space needed is twice. Application is also allocating 2 counters(uint64) per client-type. A2. User have to dynamically create and maintain the variables for every client type. On every request, it will first update it's variable value and then call Gauge.Update to update the underlying gauge metric value. This leads to 2 ops. Similar to A1, Application is still allocating/maintaining 2 float64 type. Though time-series server will not need extra space compared to A1. Apart from metrics code, services also have logging and tracing related code. These increases monitoring related code foot-print as well. Also, the focus should be more towards writing business logic. Here, they also have to take care of these variables and updating them appropriately. About redesign proposal, can you please send me the reference to participate in it? i have some suggestions which can be discussed in that forum.
I will change the destination branch for this PR to future-release(Can you please refer the branch name?). I raised against master as I couldn't find any 4.x.x tag and assumed that it will be cut out from master.
Based on the implementation, on every specified interval it publishes all the registered metrics-values to the reporter. From user's perspective, these changes don't force the deviation from existing. In Add/Sub functions, it invokes Update method(which just updates value of float64 atomically). |
@mway @robskillington , |
Added below functions for Gauge Metric:
Add(float64)
Sub(float64)