diff options
author | Adam Kocoloski <adam@cloudant.com> | 2010-06-11 13:59:17 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-08-12 11:18:45 -0400 |
commit | 7b0cef7802587e13df8c67f77fa591d869c14fc5 (patch) | |
tree | e0c192920c9933524f639b778715b625f141201e | |
parent | 5069e69317219a6dd4a93aecd79647f3237feca7 (diff) |
starting to move metrics hooks into chttpd
-rw-r--r-- | src/chttpd.erl | 7 | ||||
-rw-r--r-- | src/chttpd_db.erl | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/chttpd.erl b/src/chttpd.erl index 1cc15d7e..649b23bc 100644 --- a/src/chttpd.erl +++ b/src/chttpd.erl @@ -137,14 +137,17 @@ handle_request(MochiReq) -> end, RequestTime = round(timer:now_diff(now(), Begin)/1000), - showroom_log:message(notice, "~s ~s ~s ~s ~B ~B", [ + RequestInfo = [ MochiReq:get(peer), MochiReq:get_header_value("Host"), atom_to_list(Method1), RawUri, Resp:get(code), RequestTime - ]), + ], + Customer = cloudant_util:customer_name(HttpReq), + couch_metrics_req:notify({request, [Customer|RequestInfo]}), + showroom_log:message(notice, "~s ~s ~s ~s ~B ~B", RequestInfo), couch_stats_collector:record({couchdb, request_time}, RequestTime), couch_stats_collector:increment({httpd, requests}), {ok, Resp}. diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl index 306d6fea..9e04ffa1 100644 --- a/src/chttpd_db.erl +++ b/src/chttpd_db.erl @@ -143,6 +143,7 @@ create_db_req(#httpd{user_ctx=UserCtx}=Req, DbName) -> delete_db_req(#httpd{user_ctx=UserCtx}=Req, DbName) -> case fabric:delete_db(DbName, [{user_ctx, UserCtx}]) of ok -> + couch_metrics_disk:notify({db_delete, {UserCtx#user_ctx.name, DbName}}), send_json(Req, 200, {[{ok, true}]}); Error -> throw(Error) |