diff options
author | Justin Clark-Casey (justincc) | 2012-09-21 00:09:17 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-09-21 00:09:17 +0100 |
commit | e29d563557bbe3a5a8f3aaf883ca92770a586e10 (patch) | |
tree | 67dcb36166c891819b127b244d170f69ccc1cc6f /OpenSim/Framework/Servers | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-e29d563557bbe3a5a8f3aaf883ca92770a586e10.zip opensim-SC_OLD-e29d563557bbe3a5a8f3aaf883ca92770a586e10.tar.gz opensim-SC_OLD-e29d563557bbe3a5a8f3aaf883ca92770a586e10.tar.bz2 opensim-SC_OLD-e29d563557bbe3a5a8f3aaf883ca92770a586e10.tar.xz |
Add request number counting to incoming HTTP requests in the same way that this was already being done for outgoing HTTP requests.
This allows us to associate debug logging messages with the right request.
It also allows us to put a request number on 'long request' logging even if other debug logging is not enabled, which gives us some idea of whether every request is suffering this problem or only some.
This is a separate internal number not associated with any incoming number in the opensim-request-id header, this will be clarified when logging of this incoming request number is re-enabled.
This commit also adds port number to HTTP IN logging to allow us to distinguish between different request numbers on different ports.
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 4e04dd8..05c2d53 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -62,6 +62,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
62 | /// </value> | 62 | /// </value> |
63 | public int DebugLevel { get; set; } | 63 | public int DebugLevel { get; set; } |
64 | 64 | ||
65 | /// <summary> | ||
66 | /// Request number for diagnostic purposes. | ||
67 | /// </summary> | ||
68 | /// <remarks> | ||
69 | /// This is an internal number. In some debug situations an external number may also be supplied in the | ||
70 | /// opensim-request-id header but we are not currently logging this. | ||
71 | /// </remarks> | ||
72 | public int RequestNumber { get; private set; } | ||
73 | |||
65 | private volatile int NotSocketErrors = 0; | 74 | private volatile int NotSocketErrors = 0; |
66 | public volatile bool HTTPDRunning = false; | 75 | public volatile bool HTTPDRunning = false; |
67 | 76 | ||
@@ -302,6 +311,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
302 | 311 | ||
303 | private void OnRequest(object source, RequestEventArgs args) | 312 | private void OnRequest(object source, RequestEventArgs args) |
304 | { | 313 | { |
314 | RequestNumber++; | ||
315 | |||
305 | try | 316 | try |
306 | { | 317 | { |
307 | IHttpClientContext context = (IHttpClientContext)source; | 318 | IHttpClientContext context = (IHttpClientContext)source; |
@@ -411,7 +422,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
411 | string requestMethod = request.HttpMethod; | 422 | string requestMethod = request.HttpMethod; |
412 | string uriString = request.RawUrl; | 423 | string uriString = request.RawUrl; |
413 | 424 | ||
414 | // string reqnum = "unknown"; | ||
415 | int requestStartTick = Environment.TickCount; | 425 | int requestStartTick = Environment.TickCount; |
416 | 426 | ||
417 | // Will be adjusted later on. | 427 | // Will be adjusted later on. |
@@ -535,8 +545,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
535 | 545 | ||
536 | if (DebugLevel >= 3) | 546 | if (DebugLevel >= 3) |
537 | m_log.DebugFormat( | 547 | m_log.DebugFormat( |
538 | "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}", | 548 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", |
539 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); | 549 | RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); |
540 | 550 | ||
541 | buffer = HandleHTTPRequest(request, response); | 551 | buffer = HandleHTTPRequest(request, response); |
542 | break; | 552 | break; |
@@ -547,8 +557,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
547 | 557 | ||
548 | if (DebugLevel >= 3) | 558 | if (DebugLevel >= 3) |
549 | m_log.DebugFormat( | 559 | m_log.DebugFormat( |
550 | "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}", | 560 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", |
551 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); | 561 | RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); |
552 | 562 | ||
553 | buffer = HandleLLSDRequests(request, response); | 563 | buffer = HandleLLSDRequests(request, response); |
554 | break; | 564 | break; |
@@ -641,7 +651,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
641 | if (tickdiff > 3000) | 651 | if (tickdiff > 3000) |
642 | { | 652 | { |
643 | m_log.InfoFormat( | 653 | m_log.InfoFormat( |
644 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", | 654 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", |
655 | RequestNumber, | ||
645 | requestMethod, | 656 | requestMethod, |
646 | uriString, | 657 | uriString, |
647 | requestHandler != null ? requestHandler.Name : "", | 658 | requestHandler != null ? requestHandler.Name : "", |
@@ -652,12 +663,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
652 | else if (DebugLevel >= 4) | 663 | else if (DebugLevel >= 4) |
653 | { | 664 | { |
654 | m_log.DebugFormat( | 665 | m_log.DebugFormat( |
655 | "[BASE HTTP SERVER]: HTTP IN {0} {1} {2} {3} from {4} took {5}ms", | 666 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} took {2}ms", |
656 | requestMethod, | 667 | RequestNumber, |
657 | uriString, | 668 | Port, |
658 | requestHandler != null ? requestHandler.Name : "", | ||
659 | requestHandler != null ? requestHandler.Description : "", | ||
660 | request.RemoteIPEndPoint, | ||
661 | tickdiff); | 669 | tickdiff); |
662 | } | 670 | } |
663 | } | 671 | } |
@@ -666,8 +674,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
666 | private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) | 674 | private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler) |
667 | { | 675 | { |
668 | m_log.DebugFormat( | 676 | m_log.DebugFormat( |
669 | "[BASE HTTP SERVER]: HTTP IN stream handler {0} {1} {2} {3} from {4}", | 677 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} stream handler {2} {3} {4} {5} from {6}", |
670 | request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description, request.RemoteIPEndPoint); | 678 | RequestNumber, |
679 | Port, | ||
680 | request.HttpMethod, | ||
681 | request.Url.PathAndQuery, | ||
682 | requestHandler.Name, | ||
683 | requestHandler.Description, | ||
684 | request.RemoteIPEndPoint); | ||
671 | 685 | ||
672 | if (DebugLevel >= 5) | 686 | if (DebugLevel >= 5) |
673 | LogIncomingInDetail(request); | 687 | LogIncomingInDetail(request); |
@@ -676,8 +690,13 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
676 | private void LogIncomingToContentTypeHandler(OSHttpRequest request) | 690 | private void LogIncomingToContentTypeHandler(OSHttpRequest request) |
677 | { | 691 | { |
678 | m_log.DebugFormat( | 692 | m_log.DebugFormat( |
679 | "[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}", | 693 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", |
680 | request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); | 694 | RequestNumber, |
695 | Port, | ||
696 | request.ContentType, | ||
697 | request.HttpMethod, | ||
698 | request.Url.PathAndQuery, | ||
699 | request.RemoteIPEndPoint); | ||
681 | 700 | ||
682 | if (DebugLevel >= 5) | 701 | if (DebugLevel >= 5) |
683 | LogIncomingInDetail(request); | 702 | LogIncomingInDetail(request); |
@@ -686,8 +705,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
686 | private void LogIncomingToXmlRpcHandler(OSHttpRequest request) | 705 | private void LogIncomingToXmlRpcHandler(OSHttpRequest request) |
687 | { | 706 | { |
688 | m_log.DebugFormat( | 707 | m_log.DebugFormat( |
689 | "[BASE HTTP SERVER]: HTTP IN assumed generic XMLRPC request {0} {1} from {2}", | 708 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} assumed generic XMLRPC request {2} {3} from {4}", |
690 | request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); | 709 | RequestNumber, |
710 | Port, | ||
711 | request.HttpMethod, | ||
712 | request.Url.PathAndQuery, | ||
713 | request.RemoteIPEndPoint); | ||
691 | 714 | ||
692 | if (DebugLevel >= 5) | 715 | if (DebugLevel >= 5) |
693 | LogIncomingInDetail(request); | 716 | LogIncomingInDetail(request); |