Sfoglia il codice sorgente

Revert "Revert "log clsi concurrency (#19651)" (#19655)" (#19656)

This reverts commit 3719f468a6336ff4bf5126f3e5d79dcde172b7ea.

GitOrigin-RevId: 6f4809f3c607c62892fc1e110eeaa2a1e7a124a4
Liangjun Song 2 anni fa
parent
commit
e2d87f4821
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      services/clsi/app/js/LockManager.js

+ 6 - 0
services/clsi/app/js/LockManager.js

@@ -1,6 +1,7 @@
 const logger = require('@overleaf/logger')
 const logger = require('@overleaf/logger')
 const Errors = require('./Errors')
 const Errors = require('./Errors')
 const RequestParser = require('./RequestParser')
 const RequestParser = require('./RequestParser')
+const Metrics = require('@overleaf/metrics')
 
 
 // The lock timeout should be higher than the maximum end-to-end compile time.
 // The lock timeout should be higher than the maximum end-to-end compile time.
 // Here, we use the maximum compile timeout plus 2 minutes.
 // Here, we use the maximum compile timeout plus 2 minutes.
@@ -19,6 +20,8 @@ function acquire(key) {
     }
     }
   }
   }
 
 
+  Metrics.gauge('concurrent_compile_requests', LOCKS.size)
+
   const lock = new Lock(key)
   const lock = new Lock(key)
   LOCKS.set(key, lock)
   LOCKS.set(key, lock)
   return lock
   return lock
@@ -39,6 +42,9 @@ class Lock {
     if (!lockWasActive) {
     if (!lockWasActive) {
       logger.error({ key: this.key }, 'Lock was released twice')
       logger.error({ key: this.key }, 'Lock was released twice')
     }
     }
+    if (this.isExpired()) {
+      Metrics.inc('compile_lock_expired_before_release')
+    }
   }
   }
 }
 }