diff --git a/arangod/Actions/RestActionHandler.cpp b/arangod/Actions/RestActionHandler.cpp index a759b0079d..deb5990864 100644 --- a/arangod/Actions/RestActionHandler.cpp +++ b/arangod/Actions/RestActionHandler.cpp @@ -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()); diff --git a/lib/Admin/RestVersionHandler.cpp b/lib/Admin/RestVersionHandler.cpp index 5de9958028..d8f3e4f1a3 100644 --- a/lib/Admin/RestVersionHandler.cpp +++ b/lib/Admin/RestVersionHandler.cpp @@ -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; diff --git a/lib/Statistics/StatisticsAgent.h b/lib/Statistics/StatisticsAgent.h index 4e899fdc4d..462c5db957 100644 --- a/lib/Statistics/StatisticsAgent.h +++ b/lib/Statistics/StatisticsAgent.h @@ -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 //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/Statistics/statistics.cpp b/lib/Statistics/statistics.cpp index 98aef4119d..20dde6d94a 100644 --- a/lib/Statistics/statistics.cpp +++ b/lib/Statistics/statistics.cpp @@ -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 diff --git a/lib/Statistics/statistics.h b/lib/Statistics/statistics.h index d371ea2bf3..84e8eb3391 100644 --- a/lib/Statistics/statistics.h +++ b/lib/Statistics/statistics.h @@ -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;