Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AA56011B00 for ; Fri, 29 Aug 2014 19:42:55 +0000 (UTC) Received: (qmail 53208 invoked by uid 500); 29 Aug 2014 19:42:55 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 53154 invoked by uid 500); 29 Aug 2014 19:42:55 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 53145 invoked by uid 99); 29 Aug 2014 19:42:55 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Aug 2014 19:42:55 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1321C9A896E; Fri, 29 Aug 2014 19:42:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rnewson@apache.org To: commits@couchdb.apache.org Message-Id: <6faa4ddcd5eb4453b62121a20774aa24@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: chttpd commit: updated refs/heads/master to 8f7a7a9 Date: Fri, 29 Aug 2014 19:42:55 +0000 (UTC) Repository: couchdb-chttpd Updated Branches: refs/heads/master 58020abb2 -> 8f7a7a912 Use a distinct namespace for chttpd stats Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/8f7a7a91 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/8f7a7a91 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/8f7a7a91 Branch: refs/heads/master Commit: 8f7a7a91256fad8213ea46a17baefb4ca7c68291 Parents: 58020ab Author: Robert Newson Authored: Fri Aug 29 20:13:35 2014 +0100 Committer: Robert Newson Committed: Fri Aug 29 20:17:45 2014 +0100 ---------------------------------------------------------------------- priv/stat_descriptions.cfg | 128 ++++++++++++++++++++++++++++++++++++++++ src/chttpd.erl | 14 ++--- src/chttpd_db.erl | 3 +- src/chttpd_view.erl | 6 +- 4 files changed, 140 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/8f7a7a91/priv/stat_descriptions.cfg ---------------------------------------------------------------------- diff --git a/priv/stat_descriptions.cfg b/priv/stat_descriptions.cfg new file mode 100644 index 0000000..eba12a7 --- /dev/null +++ b/priv/stat_descriptions.cfg @@ -0,0 +1,128 @@ +%% Licensed under the Apache License, Version 2.0 (the "License"); you may not +%% use this file except in compliance with the License. You may obtain a copy of +%% the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +%% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +%% License for the specific language governing permissions and limitations under +%% the License. + +% Style guide for descriptions: Start with a lowercase letter & do not add +% a trailing full-stop / period +% Please keep this in alphabetical order + +{[chttpd, auth_cache_hits], [ + {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, '500'], [ + {type, counter}, + {desc, <<"number of HTTP 500 Internal Server Error responses">>} +]}. http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/8f7a7a91/src/chttpd.erl ---------------------------------------------------------------------- diff --git a/src/chttpd.erl b/src/chttpd.erl index 760df2d..c5a6097 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([couchdb, request_time], RequestTime), + couch_stats:update_histogram([chttpd, request_time], RequestTime), case Result of {ok, _} -> - couch_stats:increment_counter([httpd, requests]), + couch_stats:increment_counter([chttpd, requests]), {ok, Resp}; {aborted, _, Reason} -> - couch_stats:increment_counter([httpd, aborted_requests]), + couch_stats:increment_counter([chttpd, 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([httpd_request_methods, Method]). + couch_stats:increment_counter([chttpd, 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([httpd_status_codes, Code]), + couch_stats:increment_counter([chttpd, 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([httpd_status_codes, Code]), + couch_stats:increment_counter([chttpd, 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([httpd_status_codes, Code]), + couch_stats:increment_counter([chttpd, 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/8f7a7a91/src/chttpd_db.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl index 1846e76..84f973e 100644 --- a/src/chttpd_db.erl +++ b/src/chttpd_db.erl @@ -73,6 +73,7 @@ handle_changes_req(#httpd{method='GET'}=Req, Db) -> ChangesArgs) end); Feed when Feed =:= "continuous"; Feed =:= "longpoll"; Feed =:= "eventsource" -> + couch_stats_process_tracker:track([chttpd, clients_requesting_changes]), fabric:changes(Db, fun changes_callback/2, {Feed, Req}, ChangesArgs); _ -> Msg = <<"Supported `feed` types: normal, continuous, longpoll, eventsource">>, @@ -314,7 +315,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([httpd, bulk_requests]), + couch_stats:increment_counter([chttpd, 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/8f7a7a91/src/chttpd_view.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_view.erl b/src/chttpd_view.erl index ffdfe2b..6a064e2 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([httpd, view_reads]), + couch_stats:increment_counter([chttpd, 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([httpd, view_reads]) || _I <- Queries], + [couch_stats:increment_counter([chttpd, view_reads]) || _I <- Queries], multi_query_view(Req, Db, DDoc, ViewName, Queries); {undefined, Keys} when is_list(Keys) -> - couch_stats:increment_counter([httpd, view_reads]), + couch_stats:increment_counter([chttpd, view_reads]), design_doc_view(Req, Db, DDoc, ViewName, Keys); {undefined, undefined} -> throw({