diff options
| author | Rider Linden <rider@lindenlab.com> | 2017-08-08 09:04:32 -0700 | 
|---|---|---|
| committer | Rider Linden <rider@lindenlab.com> | 2017-08-08 09:04:32 -0700 | 
| commit | 1038633526330cf931ba097dbafdd270b5bb56e3 (patch) | |
| tree | bf5b1a2517d31d1ed3daa9213104b36b6901f99c /indra/llcorehttp | |
| parent | 57d5744f2c064ccb7bf8dd3dca2a24f6755297ac (diff) | |
MAINT-7634: Logging and instrumentation canges to narrow down viewer crashes.
Diffstat (limited to 'indra/llcorehttp')
| -rw-r--r-- | indra/llcorehttp/_httpoprequest.cpp | 19 | ||||
| -rw-r--r-- | indra/llcorehttp/_httppolicy.cpp | 2 | ||||
| -rw-r--r-- | indra/llcorehttp/httprequest.cpp | 10 | ||||
| -rw-r--r-- | indra/llcorehttp/httprequest.h | 13 | ||||
| -rw-r--r-- | indra/llcorehttp/httpresponse.h | 10 | ||||
| -rw-r--r-- | indra/llcorehttp/httpstats.cpp | 34 | ||||
| -rw-r--r-- | indra/llcorehttp/httpstats.h | 4 | 
7 files changed, 65 insertions, 27 deletions
| diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index f35f9848ff..36955f3797 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -247,6 +247,25 @@ void HttpOpRequest::visitNotifier(HttpRequest * request)  		response->setHeaders(mReplyHeaders);          response->setRequestURL(mReqURL); +        std::string method("UNKNOWN"); + +        if (mReqMethod == HOR_COPY) +            method = "COPY"; +        else if (mReqMethod == HOR_DELETE) +            method = "DELETE"; +        else if (mReqMethod == HOR_GET) +            method = "GET"; +        else if (mReqMethod == HOR_MOVE) +            method = "MOVE"; +        else if (mReqMethod == HOR_PATCH) +            method = "PATCH"; +        else if (mReqMethod == HOR_POST) +            method = "POST"; +        else if (mReqMethod == HOR_PUT) +            method = "PUT"; + +        response->setRequestMethod(method); +          if (mReplyOffset || mReplyLength)  		{  			// Got an explicit offset/length in response diff --git a/indra/llcorehttp/_httppolicy.cpp b/indra/llcorehttp/_httppolicy.cpp index 628a5c79e1..a302db8b46 100644 --- a/indra/llcorehttp/_httppolicy.cpp +++ b/indra/llcorehttp/_httppolicy.cpp @@ -450,7 +450,7 @@ bool HttpPolicy::stageAfterCompletion(const HttpOpRequest::ptr_t &op)  	op->stageFromActive(mService); -    HTTPStats::instance().recordResultCode(op->mStatus.getStatus()); +    HTTPStats::instance().recordResultCode(op->mStatus.getType());  	return false;						// not active  } diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index d9662c1232..2687f77217 100644 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -52,7 +52,6 @@ namespace LLCore  // ====================================  // HttpRequest Implementation  // ==================================== -HttpRequest::Statistics HttpRequest::mStatistics;  HttpRequest::HttpRequest() @@ -64,11 +63,7 @@ HttpRequest::HttpRequest()  	mReplyQueue.reset( new HttpReplyQueue() ); -    ++mStatistics.mCurrentRequests; -    ++mStatistics.mTotalRequests; - -     -    LL_WARNS("HTTPRequest") << "New HttpRequest created (outstanding: " << mStatistics.mCurrentRequests << " total: " << mStatistics.mTotalRequests << ")" << LL_ENDL; +    HTTPStats::instance().recordHTTPRequest();  } @@ -81,9 +76,6 @@ HttpRequest::~HttpRequest()  	}      mReplyQueue.reset(); -    --mStatistics.mCurrentRequests; - -    LL_WARNS("HTTPRequest") << "HttpRequest destroyed (outstanding: " << mStatistics.mCurrentRequests << " total: " << mStatistics.mTotalRequests << ")" << LL_ENDL;  } diff --git a/indra/llcorehttp/httprequest.h b/indra/llcorehttp/httprequest.h index c958132ae2..a418eb6a7a 100644 --- a/indra/llcorehttp/httprequest.h +++ b/indra/llcorehttp/httprequest.h @@ -681,19 +681,6 @@ private:  	// End Global State  	// ==================================== -    struct Statistics -    { -        Statistics(): -            mTotalRequests(0), -            mCurrentRequests(0) -        {} - -        S32 mTotalRequests; -        S32 mCurrentRequests; -    }; - -    static Statistics mStatistics; -  };  // end class HttpRequest diff --git a/indra/llcorehttp/httpresponse.h b/indra/llcorehttp/httpresponse.h index 0bfa4585c7..b834085e5c 100644 --- a/indra/llcorehttp/httpresponse.h +++ b/indra/llcorehttp/httpresponse.h @@ -204,6 +204,15 @@ public:              return mRequestUrl;          } +    void setRequestMethod(const std::string &method) +        { +            mRequestMethod = method; +        } + +    const std::string &getRequestMethod() const +        { +            return mRequestMethod; +        }  protected:  	// Response data here @@ -217,6 +226,7 @@ protected:  	unsigned int		mRetries;  	unsigned int		m503Retries;      std::string         mRequestUrl; +    std::string         mRequestMethod;  	TransferStats::ptr_t	mStats;  }; diff --git a/indra/llcorehttp/httpstats.cpp b/indra/llcorehttp/httpstats.cpp index 467d364885..b2de7f51ff 100644 --- a/indra/llcorehttp/httpstats.cpp +++ b/indra/llcorehttp/httpstats.cpp @@ -44,6 +44,7 @@ void HTTPStats::resetStats()      mResutCodes.clear();      mDataDown.reset();      mDataUp.reset(); +    mRequests = 0;  } @@ -60,16 +61,41 @@ void HTTPStats::recordResultCode(S32 code)  } +namespace +{ +    std::string byte_count_converter(F32 bytes) +    { +        static const char unit_suffix[] = { 'B', 'K', 'M', 'G' }; + +        F32 value = bytes; +        int suffix = 0; + +        while ((value > 1024.0) && (suffix < 3)) +        { +            value /= 1024.0; +            ++suffix; +        } + +        std::stringstream out; + +        out << std::setprecision(4) << value << unit_suffix[suffix]; + +        return out.str(); +    } +} +  void HTTPStats::dumpStats()  {      std::stringstream out; -    out << "HTTPCore Stats" << std::endl; -    out << "Bytes Sent: " << mDataUp.getSum() << std::endl; -    out << "Bytes Recv: " << mDataDown.getSum() << std::endl; +    out << "HTTP DATA SUMMARY" << std::endl; +    out << "HTTP Transfer counts:" << std::endl; +    out << "Data Sent: " << byte_count_converter(mDataUp.getSum()) << "   (" << mDataUp.getSum() << ")" << std::endl; +    out << "Data Recv: " << byte_count_converter(mDataDown.getSum()) << "   (" << mDataDown.getSum() << ")" << std::endl; +    out << "Total requests: " << mRequests << "(request objects created)" << std::endl; +    out << std::endl;      out << "Result Codes:" << std::endl << "--- -----" << std::endl; -      for (std::map<S32, S32>::iterator it = mResutCodes.begin(); it != mResutCodes.end(); ++it)      {           out << (*it).first << " " << (*it).second << std::endl; diff --git a/indra/llcorehttp/httpstats.h b/indra/llcorehttp/httpstats.h index d4460bcfae..2c713cb548 100644 --- a/indra/llcorehttp/httpstats.h +++ b/indra/llcorehttp/httpstats.h @@ -55,6 +55,8 @@ namespace LLCore              mDataUp.push(bytes);          } +        void    recordHTTPRequest() { ++mRequests; } +          void    recordResultCode(S32 code);          void    dumpStats(); @@ -62,6 +64,8 @@ namespace LLCore          StatsAccumulator mDataDown;          StatsAccumulator mDataUp; +        S32              mRequests; +          std::map<S32, S32> mResutCodes;      }; | 
