mirror of https://gitee.com/bigwinds/arangodb
added ignore for certain API calls (version & aardvark)
This commit is contained in:
parent
9596b7d9c0
commit
3db2475d1c
|
@ -107,6 +107,13 @@ std::string const& RestActionHandler::queue () const {
|
|||
HttpHandler::status_t RestActionHandler::execute () {
|
||||
TRI_action_result_t result;
|
||||
|
||||
// check the request path
|
||||
if (_request->databaseName() == "_system") {
|
||||
if (TRI_IsPrefixString(_request->requestPath(), "/_admin/aardvark")) {
|
||||
RequestStatisticsAgentSetIgnore(this);
|
||||
}
|
||||
}
|
||||
|
||||
// need an action
|
||||
if (_action == 0) {
|
||||
generateNotImplemented(_request->requestPath());
|
||||
|
|
|
@ -134,6 +134,8 @@ string const& RestVersionHandler::queue () const {
|
|||
HttpHandler::status_t RestVersionHandler::execute () {
|
||||
TRI_json_t result;
|
||||
|
||||
RequestStatisticsAgentSetIgnore(this);
|
||||
|
||||
TRI_InitArray2Json(TRI_CORE_MEM_ZONE, &result, 3);
|
||||
|
||||
TRI_json_t server;
|
||||
|
|
|
@ -467,6 +467,28 @@ namespace triagens {
|
|||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets ignore flag
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef TRI_ENABLE_FIGURES
|
||||
|
||||
#define RequestStatisticsAgentSetIgnore(a) \
|
||||
do { \
|
||||
if (TRI_ENABLE_STATISTICS) { \
|
||||
if ((a)->RequestStatisticsAgent::_statistics != 0) { \
|
||||
(a)->RequestStatisticsAgent::_statistics->_ignore = true; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define RequestStatisticsAgentSetIgnore(a) while (0)
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief adds bytes received
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -97,29 +97,31 @@ TRI_request_statistics_t* TRI_AcquireRequestStatistics () {
|
|||
void TRI_ReleaseRequestStatistics (TRI_request_statistics_t* statistics) {
|
||||
STATISTICS_LOCK(&RequestListLock);
|
||||
|
||||
TRI_TotalRequestsStatistics.incCounter();
|
||||
if (! statistics->_ignore) {
|
||||
TRI_TotalRequestsStatistics.incCounter();
|
||||
|
||||
if (statistics->_async) {
|
||||
TRI_AsyncRequestsStatistics.incCounter();
|
||||
}
|
||||
|
||||
TRI_MethodRequestsStatistics[(int) statistics->_requestType].incCounter();
|
||||
|
||||
// check the request was completely received and transmitted
|
||||
if (statistics->_readStart != 0.0 && statistics->_writeEnd != 0.0) {
|
||||
double totalTime = statistics->_writeEnd - statistics->_readStart;
|
||||
TRI_TotalTimeDistributionStatistics->addFigure(totalTime);
|
||||
|
||||
double requestTime = statistics->_requestEnd - statistics->_requestStart;
|
||||
TRI_RequestTimeDistributionStatistics->addFigure(requestTime);
|
||||
|
||||
if (statistics->_queueStart != 0.0 && statistics->_queueEnd != 0.0) {
|
||||
double queueTime = statistics->_queueEnd - statistics->_queueStart;
|
||||
TRI_QueueTimeDistributionStatistics->addFigure(queueTime);
|
||||
if (statistics->_async) {
|
||||
TRI_AsyncRequestsStatistics.incCounter();
|
||||
}
|
||||
|
||||
TRI_BytesSentDistributionStatistics->addFigure(statistics->_sentBytes);
|
||||
TRI_BytesReceivedDistributionStatistics->addFigure(statistics->_receivedBytes);
|
||||
TRI_MethodRequestsStatistics[(int) statistics->_requestType].incCounter();
|
||||
|
||||
// check the request was completely received and transmitted
|
||||
if (statistics->_readStart != 0.0 && statistics->_writeEnd != 0.0) {
|
||||
double totalTime = statistics->_writeEnd - statistics->_readStart;
|
||||
TRI_TotalTimeDistributionStatistics->addFigure(totalTime);
|
||||
|
||||
double requestTime = statistics->_requestEnd - statistics->_requestStart;
|
||||
TRI_RequestTimeDistributionStatistics->addFigure(requestTime);
|
||||
|
||||
if (statistics->_queueStart != 0.0 && statistics->_queueEnd != 0.0) {
|
||||
double queueTime = statistics->_queueEnd - statistics->_queueStart;
|
||||
TRI_QueueTimeDistributionStatistics->addFigure(queueTime);
|
||||
}
|
||||
|
||||
TRI_BytesSentDistributionStatistics->addFigure(statistics->_sentBytes);
|
||||
TRI_BytesReceivedDistributionStatistics->addFigure(statistics->_receivedBytes);
|
||||
}
|
||||
}
|
||||
|
||||
// clear statistics and put back an the free list
|
||||
|
|
|
@ -63,23 +63,24 @@ TRI_statistics_list_t;
|
|||
typedef struct TRI_request_statistics_s {
|
||||
void* _next;
|
||||
|
||||
double _readStart;
|
||||
double _readEnd;
|
||||
double _queueStart;
|
||||
double _queueEnd;
|
||||
double _requestStart;
|
||||
double _requestEnd;
|
||||
double _writeStart;
|
||||
double _writeEnd;
|
||||
double _readStart;
|
||||
double _readEnd;
|
||||
double _queueStart;
|
||||
double _queueEnd;
|
||||
double _requestStart;
|
||||
double _requestEnd;
|
||||
double _writeStart;
|
||||
double _writeEnd;
|
||||
|
||||
double _receivedBytes;
|
||||
double _sentBytes;
|
||||
double _receivedBytes;
|
||||
double _sentBytes;
|
||||
|
||||
triagens::rest::HttpRequest::HttpRequestType _requestType;
|
||||
|
||||
bool _async;
|
||||
bool _tooLarge;
|
||||
bool _executeError;
|
||||
bool _async;
|
||||
bool _tooLarge;
|
||||
bool _executeError;
|
||||
bool _ignore;
|
||||
}
|
||||
TRI_request_statistics_t;
|
||||
|
||||
|
|
Loading…
Reference in New Issue