You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2014/08/29 22:46:05 UTC
[05/13] couchdb commit: updated refs/heads/1963-eunit-bigcouch to
36bd96a
requestStats takes an array
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/13fa1e3f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/13fa1e3f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/13fa1e3f
Branch: refs/heads/1963-eunit-bigcouch
Commit: 13fa1e3faf8e3022bff6e0baab2ec41ff2ac734c
Parents: 4b44ebc
Author: Robert Newson <rn...@apache.org>
Authored: Fri Aug 29 13:36:54 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Fri Aug 29 13:36:54 2014 +0100
----------------------------------------------------------------------
share/www/script/couch.js | 4 ++--
share/www/script/test/auth_cache.js | 4 ++--
share/www/script/test/changes.js | 4 ++--
share/www/spec/couch_js_class_methods_spec.js | 8 ++++----
4 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/13fa1e3f/share/www/script/couch.js
----------------------------------------------------------------------
diff --git a/share/www/script/couch.js b/share/www/script/couch.js
index 31b3830..7e4eeed 100644
--- a/share/www/script/couch.js
+++ b/share/www/script/couch.js
@@ -432,13 +432,13 @@ CouchDB.request = function(method, uri, options) {
return req;
};
-CouchDB.requestStats = function(module, key, test) {
+CouchDB.requestStats = function(path, test) {
var query_arg = "";
if(test !== null) {
query_arg = "?flush=true";
}
- var url = "/_stats/" + module + "/" + key + query_arg;
+ var url = "/_stats/" + path.join("/") + query_arg;
var stat = CouchDB.request("GET", url).responseText;
return JSON.parse(stat);
};
http://git-wip-us.apache.org/repos/asf/couchdb/blob/13fa1e3f/share/www/script/test/auth_cache.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/auth_cache.js b/share/www/script/test/auth_cache.js
index 2229c20..17cb70f 100644
--- a/share/www/script/test/auth_cache.js
+++ b/share/www/script/test/auth_cache.js
@@ -51,13 +51,13 @@ couchTests.auth_cache = function(debug) {
function hits() {
- var hits = CouchDB.requestStats("couchdb", "auth_cache_hits", true);
+ var hits = CouchDB.requestStats(["couchdb", "auth_cache_hits"], true);
return hits.current || 0;
}
function misses() {
- var misses = CouchDB.requestStats("couchdb", "auth_cache_misses", true);
+ var misses = CouchDB.requestStats(["couchdb", "auth_cache_misses"], true);
return misses.current || 0;
}
http://git-wip-us.apache.org/repos/asf/couchdb/blob/13fa1e3f/share/www/script/test/changes.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/changes.js b/share/www/script/test/changes.js
index b034a0b..d1c0c02 100644
--- a/share/www/script/test/changes.js
+++ b/share/www/script/test/changes.js
@@ -609,9 +609,9 @@ couchTests.changes = function(debug) {
TEquals("0", resp.results[0].id);
TEquals("1", resp.results[1].id);
- TEquals(0, CouchDB.requestStats('httpd', 'clients_requesting_changes').current);
+ TEquals(0, CouchDB.requestStats(['couchdb', 'httpd', 'clients_requesting_changes']).value);
CouchDB.request("GET", "/" + db.name + "/_changes");
- TEquals(0, CouchDB.requestStats('httpd', 'clients_requesting_changes').current);
+ TEquals(0, CouchDB.requestStats(['couchdb', 'httpd', 'clients_requesting_changes']).value);
// COUCHDB-1256
T(db.deleteDb());
http://git-wip-us.apache.org/repos/asf/couchdb/blob/13fa1e3f/share/www/spec/couch_js_class_methods_spec.js
----------------------------------------------------------------------
diff --git a/share/www/spec/couch_js_class_methods_spec.js b/share/www/spec/couch_js_class_methods_spec.js
index 7eac234..6b64c19 100644
--- a/share/www/spec/couch_js_class_methods_spec.js
+++ b/share/www/spec/couch_js_class_methods_spec.js
@@ -292,19 +292,19 @@ describe 'CouchDB class'
end
describe '.requestStats'
- it 'should get the stats for specified module and key'
- var stats = CouchDB.requestStats('couchdb', 'open_databases', null);
+ it 'should get the stats for specified path'
+ var stats = CouchDB.requestStats(['couchdb', 'open_databases'], null);
stats.description.should.eql 'number of open databases'
stats.current.should.be_a Number
end
it 'should add flush true to the request when there is a test argument'
CouchDB.should.receive("request", "once").with_args("GET", "/_stats/httpd/requests?flush=true")
- CouchDB.requestStats('httpd', 'requests', 'test');
+ CouchDB.requestStats(['httpd', 'requests'], 'test');
end
it 'should still work when there is a test argument'
- var stats = CouchDB.requestStats('httpd_status_codes', '200', 'test');
+ var stats = CouchDB.requestStats(['httpd_status_codes', '200'], 'test');
stats.description.should.eql 'number of HTTP 200 OK responses'
stats.sum.should.be_a Number
end