26
26
from DIRAC .Core .Utilities .JEncode import decode , encode
27
27
from DIRAC .Core .Utilities .ReturnValues import isReturnStructure
28
28
from DIRAC .Core .Security .X509Chain import X509Chain # pylint: disable=import-error
29
- from DIRAC .FrameworkSystem .Client .MonitoringClient import MonitoringClient
30
29
from DIRAC .Resources .IdProvider .Utilities import getProvidersForInstance
31
30
from DIRAC .Resources .IdProvider .IdProviderFactory import IdProviderFactory
32
31
@@ -273,11 +272,6 @@ def _authzMYAUTH(self):
273
272
# Lock to make sure that two threads are not initializing at the same time
274
273
__init_lock = threading .RLock ()
275
274
276
- # MonitoringClient, we don't use gMonitor which is not thread-safe
277
- # We also need to add specific attributes for each service
278
- # See __initMonitoring method for the details.
279
- _monitor = None
280
-
281
275
# Definition of identity providers, used to authorize requests with access tokens
282
276
_idps = IdProviderFactory ()
283
277
_idp = {}
@@ -291,17 +285,13 @@ def _authzMYAUTH(self):
291
285
# Developer can overwrite this
292
286
# if your handler is outside the DIRAC system package (src/DIRAC/XXXSystem/<path to your handler>)
293
287
SYSTEM_NAME = None
294
- COMPONENT_NAME = None
295
288
296
289
# Base system URL. If defined, it is added as a prefix to the handler generated.
297
290
BASE_URL = None
298
291
299
292
# Base handler URL
300
293
DEFAULT_LOCATION = "/"
301
294
302
- # Type of component, see MonitoringClient class
303
- MONITORING_COMPONENT = MonitoringClient .COMPONENT_WEB
304
-
305
295
# Prefix of the target methods names if need to use a special prefix. By default its "export_".
306
296
METHOD_PREFIX = "export_"
307
297
@@ -379,27 +369,6 @@ def __initMonitoring(cls, fullComponentName: str, fullUrl: str) -> dict:
379
369
:param componentName: relative URL ``/<System>/<Component>``
380
370
:param fullUrl: full URl like ``https://<host>:<port>/<System>/<Component>``
381
371
"""
382
-
383
- # Init extra bits of monitoring
384
-
385
- cls ._monitor = MonitoringClient ()
386
- cls ._monitor .setComponentType (cls .MONITORING_COMPONENT )
387
-
388
- cls ._monitor .initialize ()
389
-
390
- if tornado .process .task_id () is None : # Single process mode
391
- cls ._monitor .setComponentName ("Tornado/%s" % fullComponentName )
392
- else :
393
- cls ._monitor .setComponentName ("Tornado/CPU%d/%s" % (tornado .process .task_id (), fullComponentName ))
394
-
395
- cls ._monitor .setComponentLocation (fullUrl )
396
-
397
- cls ._monitor .registerActivity ("Queries" , "Queries served" , "Framework" , "queries" , MonitoringClient .OP_RATE )
398
-
399
- cls ._monitor .setComponentExtraParam ("DIRACVersion" , DIRAC .version )
400
- cls ._monitor .setComponentExtraParam ("platform" , DIRAC .getPlatform ())
401
- cls ._monitor .setComponentExtraParam ("startTime" , datetime .utcnow ())
402
-
403
372
cls ._stats = {"requests" : 0 , "monitorLastStatsUpdate" : time .time ()}
404
373
405
374
return S_OK ()
@@ -544,10 +513,7 @@ def _monitorRequest(self) -> None:
544
513
"""Monitor action for each request.
545
514
CAN be implemented by developer.
546
515
"""
547
- self ._monitor .setComponentLocation (self .request .path )
548
516
self ._stats ["requests" ] += 1
549
- self ._monitor .setComponentExtraParam ("queries" , self ._stats ["requests" ])
550
- self ._monitor .addMark ("Queries" )
551
517
552
518
def _getMethod (self ):
553
519
"""Parse method name from incoming request.
0 commit comments