-
Notifications
You must be signed in to change notification settings - Fork 28
Add new metric (histogram) to track number of reads using _bulk_get #118
base: master
Are you sure you want to change the base?
Conversation
Why? When you have a line above: |
@kxepal ? I have asked the same question in 64560 and discussed it with Aaron. As per my understanding, counter gives a different perspective and probably easy to identify the spikes and trends? Can you add a comment to Aaron/Russel/Ops in 64560 and get his perspective on why this metric would help Operations? |
@brkolla Sorry, I can't since I'm not from Cloudant team. Can you ping them here or share the reason why? because I'm -1 on having two metrics that does the same thing while one of them (histogram) is actually what is really useful. |
I am actually asking Aaron about this in Slack. To be honest, I don't fully understand the difference between the histogram and the regular counter and if its possible to have one metric that does the both. Will ask around and find out more. |
@brkolla Histogram uses sliding time window and provides percentile-wise information about the recorded numbers. Just compare output of both these metrics to see the difference. |
Yeah I agree with @kxepal on this, using a histogram is the correct choice here. It looks like there was also some confusion on this issue as @rnewson snuck in the actual fix for this issue back in cloudant@a49c474. I do think it's worthwhile to also track the doc count in Also, we should get similar stats for quantify of docs returned and provided in _all_docs and views and what not. |
Oh, it also counts |
I think I have to revisit this and come up with a new metric to track the bulk gets and probably use one metric that tracks all the request that would result in bulk gets (_all_docs etc..) . We are still discussing on how we can do that. |
Yeah agreed, _bulk_get is sufficiently different we should track it separately. |
374476b
to
dab6b16
Compare
dab6b16
to
b9efb96
Compare
@chewbranca I have updated the code to add a new metric bulk_reads to track the number of doc reads done as part of the bulk_get. Can you review this code? |
@@ -448,6 +448,7 @@ db_req(#httpd{method='POST', path_parts=[_, <<"_bulk_get">>]}=Req, Db) -> | |||
undefined -> | |||
throw({bad_request, <<"Missing JSON list of 'docs'.">>}); | |||
Docs -> | |||
couch_stats:update_histogram([couchdb, httpd, bulk_reads], length(Docs)), |
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 think the name is confusing. If we want to count only "/_bulk_get" requests here, better give such name to the metric instead of generic bulk_reads. Otherwise, if you want to use "bulk_reads", should we count requests with include_docs=true to views and all_docs as bulk reads?
@kxepal I am not really sure, but this seems to be only used during the replication. I guess, we could change the name to bulk_get_docs? @chewbranca? |
@brkolla Not only. Replication is just a client for CouchDB. Other users may be this endpoint in own way (and for profit!). |
Add a new counter "bulk_request_docs" to track the number of documents being handled as part of the bulk request.
FogBugz 64560.