Skip to content

Commit f58a405

Browse files
authored
Merge pull request #6932 from chaen/v8.0_FIX_restMonitoring
[8.0] fix (tornadoREST): disable activityMonitor for TornadoREST
2 parents e597157 + 96b4e46 commit f58a405

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/DIRAC/Core/Tornado/Server/TornadoREST.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ def options_job(self):
152152
METHOD_PREFIX = None
153153
DEFAULT_LOCATION = "/"
154154

155+
# Never use the activity monitoring here
156+
activityMonitoringReporter = False
157+
155158
@classmethod
156159
def _pre_initialize(cls) -> list:
157160
"""This method is run by the Tornado server to prepare the handler for launch

src/DIRAC/Core/Tornado/Server/private/BaseRequestHandler.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ def _authzMYAUTH(self):
317317
encode = staticmethod(encode)
318318
decode = staticmethod(decode)
319319

320+
# Class instance of monitoringReporter to use
321+
# It is initialized in __initialize
322+
# If it is set to False, do not instanciate it
323+
activityMonitoringReporter = None
324+
320325
@classmethod
321326
def __pre_initialize(cls) -> list:
322327
"""This method is run by the Tornado server to prepare the handler for launch,
@@ -477,8 +482,9 @@ def __initialize(cls, request):
477482

478483
cls.initializeHandler(cls._componentInfoDict)
479484

480-
cls.activityMonitoringReporter = None
481-
if "Monitoring" in Operations().getMonitoringBackends(monitoringType="ServiceMonitoring"):
485+
if cls.activityMonitoringReporter is not False and "Monitoring" in Operations().getMonitoringBackends(
486+
monitoringType="ServiceMonitoring"
487+
):
482488
from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter
483489

484490
cls.activityMonitoringReporter = MonitoringReporter(monitoringType="ServiceMonitoring")
@@ -703,7 +709,7 @@ def on_finish(self):
703709
"Location": self.request.uri,
704710
"ResponseTime": elapsedTime,
705711
# Take the method name from the POST call
706-
"MethodName": self.request.arguments.get("method", ["Unknown"])[0].decode(),
712+
"MethodName": self.request.arguments.get("method", [b"Unknown"])[0].decode(),
707713
"Protocol": "https",
708714
"Status": monitoringRetStatus,
709715
}

0 commit comments

Comments
 (0)