1
0
Fork 0

added JavaScript APIs for query tracking

This commit is contained in:
Jan Steemann 2015-03-12 12:20:30 +01:00
parent 75c4451469
commit e67c82c8a4
3 changed files with 219 additions and 0 deletions

View File

@ -339,6 +339,27 @@ v2.5.0-beta1 (2015-02-23)
v2.4.5 (XXXX-XX-XX)
-------------------
* added AQL current and slow query tracking
This change enables retrieving the list of currently running AQL queries inside the selected database.
AQL queries with an execution time beyond a certain threshold can be moved to a "slow query" facility
and retrieved from there.
This change adds the following HTTP REST APIs:
- `GET /_api/query/current`: for retrieving the list of currently running queries
- `GET /_api/query/slow`: for retrieving the list of slow queries
- `DELETE /_api/query/slow`: for clearing the list of slow queries
- `GET /_api/query/properties`: for retrieving the properties for query tracking
- `PUT /_api/query/properties`: for adjusting the properties for query tracking
The following JavaScript APIs have been added:
- require("org/arangodb/aql/queries").current();
- require("org/arangodb/aql/queries").slow();
- require("org/arangodb/aql/queries").clearSlow();
- require("org/arangodb/aql/queries").properties();
* fixed issue #1265: arangod crashed with SIGSEGV
* fixed issue #1241: Wildcards in examples

View File

@ -0,0 +1,113 @@
/*global require, exports */
////////////////////////////////////////////////////////////////////////////////
/// @brief AQL query management
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2012 triagens GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
var internal = require("internal");
var arangosh = require("org/arangodb/arangosh");
// -----------------------------------------------------------------------------
// --SECTION-- module "org/arangodb/aql/queries"
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief clears the slow query log
////////////////////////////////////////////////////////////////////////////////
exports.clearSlow = function () {
'use strict';
var db = internal.db;
var requestResult = db._connection.DELETE("/_api/query/slow", "");
arangosh.checkRequestResult(requestResult);
return requestResult;
};
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the slow queries
////////////////////////////////////////////////////////////////////////////////
exports.slow = function () {
'use strict';
var db = internal.db;
var requestResult = db._connection.GET("/_api/query/slow", "");
arangosh.checkRequestResult(requestResult);
return requestResult;
};
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the current queries
////////////////////////////////////////////////////////////////////////////////
exports.current = function () {
'use strict';
var db = internal.db;
var requestResult = db._connection.GET("/_api/query/current", "");
arangosh.checkRequestResult(requestResult);
return requestResult;
};
////////////////////////////////////////////////////////////////////////////////
/// @brief configures the query tracking properties
////////////////////////////////////////////////////////////////////////////////
exports.properties = function (config) {
'use strict';
var db = internal.db;
var requestResult;
if (config === undefined) {
requestResult = db._connection.GET("/_api/query/properties");
}
else {
requestResult = db._connection.PUT("/_api/query/properties",
JSON.stringify(config));
}
arangosh.checkRequestResult(requestResult);
return requestResult;
};
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\|/\\*jslint"
// End:

View File

@ -0,0 +1,85 @@
/*global exports, AQL_QUERIES_SLOW, AQL_QUERIES_CURRENT, AQL_QUERIES_PROPERTIES */
////////////////////////////////////////////////////////////////////////////////
/// @brief AQL query management
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2012 triagens GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- module "org/arangodb/aql/queries"
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief clears the slow query log
////////////////////////////////////////////////////////////////////////////////
exports.clearSlow = function () {
'use strict';
AQL_QUERIES_SLOW(true);
};
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the slow queries
////////////////////////////////////////////////////////////////////////////////
exports.slow = function () {
'use strict';
return AQL_QUERIES_SLOW();
};
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the current queries
////////////////////////////////////////////////////////////////////////////////
exports.current = function () {
'use strict';
return AQL_QUERIES_CURRENT();
};
////////////////////////////////////////////////////////////////////////////////
/// @brief configures the query tracking properties
////////////////////////////////////////////////////////////////////////////////
exports.properties = function (config) {
'use strict';
if (config === undefined) {
return AQL_QUERIES_PROPERTIES();
}
return AQL_QUERIES_PROPERTIES(config);
};
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\|/\\*jslint"
// End: