summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-07-16 11:07:22 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-08-12 11:18:50 -0400
commit134dc2c24f08ef7487fcdf5c5d751603a5ed14a6 (patch)
tree1df6dabd7ab83ff8bf8aa210e6616c6b6d95a9a7
parent299d9d924c9aa40d5f327b0fc2848eccae20d8a4 (diff)
measure all get_db_info calls
-rw-r--r--src/chttpd_db.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 22ca7fe6..bd11683b 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -174,7 +174,11 @@ do_db_req(#httpd{path_parts=[DbName|_]}=Req, Fun) ->
Fun(Req, #db{name=DbName}).
db_req(#httpd{method='GET',path_parts=[DbName]}=Req, _Db) ->
+ % measure the time required to generate the etag, see if it's worth it
+ T0 = now(),
{ok, DbInfo} = fabric:get_db_info(DbName),
+ DeltaT = timer:now_diff(now(), T0) / 1000,
+ couch_stats_collector:record({couchdb, dbinfo}, DeltaT),
send_json(Req, {cloudant_util:customer_db_info(Req, DbInfo)});
db_req(#httpd{method='POST', path_parts=[DbName], user_ctx=Ctx}=Req, Db) ->