couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject chttpd commit: updated refs/heads/master to 6b372c6
Date Thu, 04 Sep 2014 12:13:47 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 549ebb4aa -> 6b372c641


Remove chttpd/couchdb stats split

The way that chttpd delegates to couch_httpd makes it difficult to
separate http states via 5984 vs 5986.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/6b372c64
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/6b372c64
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/6b372c64

Branch: refs/heads/master
Commit: 6b372c6419256ee2d3f352b6a08d99437c973bac
Parents: 549ebb4
Author: Robert Newson <rnewson@apache.org>
Authored: Thu Sep 4 13:12:24 2014 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Thu Sep 4 13:12:26 2014 +0100

----------------------------------------------------------------------
 priv/stats_descriptions.cfg | 128 +--------------------------------------
 src/chttpd.erl              |  14 ++---
 src/chttpd_auth_cache.erl   |   6 +-
 src/chttpd_db.erl           |   6 +-
 src/chttpd_view.erl         |   6 +-
 5 files changed, 18 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/6b372c64/priv/stats_descriptions.cfg
----------------------------------------------------------------------
diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg
index 7ffaa95..e6865b6 100644
--- a/priv/stats_descriptions.cfg
+++ b/priv/stats_descriptions.cfg
@@ -14,131 +14,7 @@
 % a trailing full-stop / period
 % Please keep this in alphabetical order
 
-{[chttpd, auth_cache_hits], [
+{[couchdb, httpd, aborted_requests], [
     {type, counter},
-    {desc, <<"number of authentication cache hits">>}
-]}.
-{[chttpd, auth_cache_misses], [
-    {type, counter},
-    {desc, <<"number of authentication cache misses">>}
-]}.
-{[chttpd, bulk_requests], [
-    {type, counter},
-    {desc, <<"number of bulk requests">>}
-]}.
-{[chttpd, requests], [
-    {type, counter},
-    {desc, <<"number of HTTP requests">>}
-]}.
-{[chttpd, temporary_view_reads], [
-    {type, counter},
-    {desc, <<"number of temporary view reads">>}
-]}.
-{[chttpd, view_reads], [
-    {type, counter},
-    {desc, <<"number of view reads">>}
-]}.
-{[chttpd, clients_requesting_changes], [
-    {type, counter},
-    {desc, <<"number of clients for continuous _changes">>}
-]}.
-{[chttpd, request_methods, 'COPY'], [
-    {type, counter},
-    {desc, <<"number of HTTP COPY requests">>}
-]}.
-{[chttpd, request_methods, 'DELETE'], [
-    {type, counter},
-    {desc, <<"number of HTTP DELETE requests">>}
-]}.
-{[chttpd, request_methods, 'GET'], [
-    {type, counter},
-    {desc, <<"number of HTTP GET requests">>}
-]}.
-{[chttpd, request_methods, 'HEAD'], [
-    {type, counter},
-    {desc, <<"number of HTTP HEAD requests">>}
-]}.
-{[chttpd, request_methods, 'POST'], [
-    {type, counter},
-    {desc, <<"number of HTTP POST requests">>}
-]}.
-{[chttpd, request_methods, 'PUT'], [
-    {type, counter},
-    {desc, <<"number of HTTP PUT requests">>}
-]}.
-{[chttpd, request_time], [
-    {type, histogram},
-    {desc, <<"length of a request inside CouchDB without MochiWeb">>}
-]}.
-{[chttpd, status_codes, 200], [
-    {type, counter},
-    {desc, <<"number of HTTP 200 OK responses">>}
-]}.
-{[chttpd, status_codes, 201], [
-    {type, counter},
-    {desc, <<"number of HTTP 201 Created responses">>}
-]}.
-{[chttpd, status_codes, 202], [
-    {type, counter},
-    {desc, <<"number of HTTP 202 Accepted responses">>}
-]}.
-{[chttpd, status_codes, 301], [
-    {type, counter},
-    {desc, <<"number of HTTP 301 Moved Permanently responses">>}
-]}.
-{[chttpd, status_codes, 302], [
-    {type, counter},
-    {desc, <<"number of HTTP 302 Found responses">>}
-]}.
-{[chttpd, status_codes, 304], [
-    {type, counter},
-    {desc, <<"number of HTTP 304 Not Modified responses">>}
-]}.
-{[chttpd, status_codes, 400], [
-    {type, counter},
-    {desc, <<"number of HTTP 400 Bad Request responses">>}
-]}.
-{[chttpd, status_codes, 401], [
-    {type, counter},
-    {desc, <<"number of HTTP 401 Unauthorized responses">>}
-]}.
-{[chttpd, status_codes, 403], [
-    {type, counter},
-    {desc, <<"number of HTTP 403 Forbidden responses">>}
-]}.
-{[chttpd, status_codes, 404], [
-    {type, counter},
-    {desc, <<"number of HTTP 404 Not Found responses">>}
-]}.
-{[chttpd, status_codes, 405], [
-    {type, counter},
-    {desc, <<"number of HTTP 405 Method Not Allowed responses">>}
-]}.
-{[chttpd, status_codes, 409], [
-    {type, counter},
-    {desc, <<"number of HTTP 409 Conflict responses">>}
-]}.
-{[chttpd, status_codes, 412], [
-    {type, counter},
-    {desc, <<"number of HTTP 412 Precondition Failed responses">>}
-]}.
-{[chttpd, status_codes, 413], [
-    {type, counter},
-    {desc, <<"number of HTTP 413 Request Entity Too Long responses">>}
-]}.
-{[chttpd, status_codes, 414], [
-    {type, counter},
-    {desc, <<"number of HTTP 414 Request URI Too Long responses">>}
-]}.
-{[chttpd, status_codes, 415], [
-    {type, counter},
-    {desc, <<"number of HTTP 415 Unsupported Media Type responses">>}
-]}.
-{[chttpd, status_codes, 416], [
-    {type, counter},
-    {desc, <<"number of HTTP 416 Requested Range Not Satisfiable responses">>}
-]}.
-{[chttpd, status_codes, 500], [
-    {type, counter},
-    {desc, <<"number of HTTP 500 Internal Server Error responses">>}
+    {desc, <<"number of aborted requests">>}
 ]}.

http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/6b372c64/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index c5a6097..32b12c8 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -255,13 +255,13 @@ handle_request(MochiReq) ->
     Host = MochiReq:get_header_value("Host"),
     couch_log:notice("~s ~s ~s ~s ~s ~B ~p ~B", [get(nonce), Peer, Host,
         atom_to_list(Method1), RawUri, Code, Status, round(RequestTime)]),
-    couch_stats:update_histogram([chttpd, request_time], RequestTime),
+    couch_stats:update_histogram([couchdb, request_time], RequestTime),
     case Result of
     {ok, _} ->
-        couch_stats:increment_counter([chttpd, requests]),
+        couch_stats:increment_counter([couchdb, httpd, requests]),
         {ok, Resp};
     {aborted, _, Reason} ->
-        couch_stats:increment_counter([chttpd, aborted_requests]),
+        couch_stats:increment_counter([couchdb, httpd, aborted_requests]),
         couch_log:error("Response abnormally terminated: ~p", [Reason]),
         exit(normal)
     end.
@@ -355,7 +355,7 @@ authenticate_request(Response, _AuthFuns) ->
     Response.
 
 increment_method_stats(Method) ->
-    couch_stats:increment_counter([chttpd, request_methods, Method]).
+    couch_stats:increment_counter([couchdb, httpd_request_methods, Method]).
 
 url_handler("") ->              fun chttpd_misc:handle_welcome_req/1;
 url_handler("favicon.ico") ->   fun chttpd_misc:handle_favicon_req/1;
@@ -557,7 +557,7 @@ verify_is_server_admin(#httpd{user_ctx=#user_ctx{roles=Roles}}) ->
     end.
 
 start_response_length(#httpd{mochi_req=MochiReq}=Req, Code, Headers0, Length) ->
-    couch_stats:increment_counter([chttpd, status_codes, Code]),
+    couch_stats:increment_counter([couchdb, httpd_status_codes, Code]),
     Headers = Headers0 ++ server_header() ++
 	couch_httpd_auth:cookie_auth_header(Req, Headers0),
     Resp = MochiReq:start_response_length({Code,
@@ -573,7 +573,7 @@ send(Resp, Data) ->
     {ok, Resp}.
 
 start_chunked_response(#httpd{mochi_req=MochiReq}=Req, Code, Headers0) ->
-    couch_stats:increment_counter([chttpd, status_codes, Code]),
+    couch_stats:increment_counter([couchdb, httpd_status_codes, Code]),
     Headers = Headers0 ++ server_header() ++
         couch_httpd_auth:cookie_auth_header(Req, Headers0),
     Resp = MochiReq:respond({Code, chttpd_cors:headers(Req, Headers),
@@ -589,7 +589,7 @@ send_chunk(Resp, Data) ->
     {ok, Resp}.
 
 send_response(#httpd{mochi_req=MochiReq}=Req, Code, Headers0, Body) ->
-    couch_stats:increment_counter([chttpd, status_codes, Code]),
+    couch_stats:increment_counter([couchdb, httpd_status_codes, Code]),
     Headers = Headers0 ++ server_header() ++
 	[timing(), reqid() | couch_httpd_auth:cookie_auth_header(Req, Headers0)],
     {ok, MochiReq:respond({Code, Headers, Body})}.

http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/6b372c64/src/chttpd_auth_cache.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_auth_cache.erl b/src/chttpd_auth_cache.erl
index 55f746e..a78ab9e 100644
--- a/src/chttpd_auth_cache.erl
+++ b/src/chttpd_auth_cache.erl
@@ -52,18 +52,18 @@ get_user_creds(UserName) when is_binary(UserName) ->
 get_from_cache(UserName) ->
     try ets_lru:lookup_d(?CACHE, UserName) of
 	{ok, Props} ->
-	    couch_stats:increment_counter([chttpd, auth_cache_hits]),
+	    couch_stats:increment_counter([couchdb, auth_cache_hits]),
 	    couch_log:debug("cache hit for ~s", [UserName]),
 	    Props;
 	_ ->
 	    Props = load_user_from_db(UserName),
-	    couch_stats:increment_counter([chttpd, auth_cache_misses]),
+	    couch_stats:increment_counter([couchdb, auth_cache_misses]),
 	    couch_log:debug("cache miss for ~s", [UserName]),
 	    ets_lru:insert(?CACHE, UserName, Props),
 	    Props
     catch
 	error:badarg ->
-	    couch_stats:increment_counter([chttpd, auth_cache_misses]),
+	    couch_stats:increment_counter([couchdb, auth_cache_misses]),
 	    couch_log:debug("cache miss for ~s", [UserName]),
 	    load_user_from_db(UserName)
     end.

http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/6b372c64/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index b6ed459..0ab3286 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -73,11 +73,11 @@ handle_changes_req(#httpd{method='GET'}=Req, Db) ->
                 ChangesArgs)
         end);
     Feed when Feed =:= "continuous"; Feed =:= "longpoll"; Feed =:= "eventsource"  ->
-        couch_stats:increment_counter([chttpd, clients_requesting_changes]),
+        couch_stats:increment_counter([couchdb, httpd, clients_requesting_changes]),
         try
             fabric:changes(Db, fun changes_callback/2, {Feed, Req}, ChangesArgs)
         after
-            couch_stats:decrement_counter([chttpd, clients_requesting_changes])
+            couch_stats:decrement_counter([couchdb, httpd, clients_requesting_changes])
         end;
     _ ->
         Msg = <<"Supported `feed` types: normal, continuous, longpoll, eventsource">>,
@@ -319,7 +319,7 @@ db_req(#httpd{path_parts=[_,<<"_ensure_full_commit">>]}=Req,
_Db) ->
     send_method_not_allowed(Req, "POST");
 
 db_req(#httpd{method='POST',path_parts=[_,<<"_bulk_docs">>], user_ctx=Ctx}=Req,
Db) ->
-    couch_stats:increment_counter([chttpd, bulk_requests]),
+    couch_stats:increment_counter([couchdb, httpd, bulk_requests]),
     couch_httpd:validate_ctype(Req, "application/json"),
     {JsonProps} = chttpd:json_body_obj(Req),
     DocsArray = case couch_util:get_value(<<"docs">>, JsonProps) of

http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/6b372c64/src/chttpd_view.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_view.erl b/src/chttpd_view.erl
index 6a064e2..fb421a4 100644
--- a/src/chttpd_view.erl
+++ b/src/chttpd_view.erl
@@ -63,7 +63,7 @@ design_doc_view(Req, Db, DDoc, ViewName, Keys) ->
 
 handle_view_req(#httpd{method='GET',
         path_parts=[_, _, _, _, ViewName]}=Req, Db, DDoc) ->
-    couch_stats:increment_counter([chttpd, view_reads]),
+    couch_stats:increment_counter([couchdb, httpd, view_reads]),
     Keys = chttpd:qs_json_value(Req, "keys", undefined),
     design_doc_view(Req, Db, DDoc, ViewName, Keys);
 
@@ -74,10 +74,10 @@ handle_view_req(#httpd{method='POST',
     Queries = couch_mrview_util:get_view_queries(Props),
     case {Queries, Keys} of
         {Queries, undefined} when is_list(Queries) ->
-            [couch_stats:increment_counter([chttpd, view_reads]) || _I <- Queries],
+            [couch_stats:increment_counter([couchdb, httpd, view_reads]) || _I <- Queries],
             multi_query_view(Req, Db, DDoc, ViewName, Queries);
         {undefined, Keys} when is_list(Keys) ->
-            couch_stats:increment_counter([chttpd, view_reads]),
+            couch_stats:increment_counter([couchdb, httpd, view_reads]),
             design_doc_view(Req, Db, DDoc, ViewName, Keys);
         {undefined, undefined} ->
             throw({


Mime
View raw message