Henry Oswald 11 лет назад
Родитель
Сommit
86416775fc
2 измененных файлов с 10 добавлено и 1 удалено
  1. 8 0
      services/spelling/app.coffee
  2. 2 1
      services/spelling/package.json

+ 8 - 0
services/spelling/app.coffee

@@ -24,6 +24,14 @@ server.get "/status", (req, res)->
 
 server.get "/health_check", HealthCheckController.healthCheck
 
+profiler = require "v8-profiler"
+server.get "/profile", (req, res) ->
+	time = parseInt(req.query.time || "1000")
+	profiler.startProfiling("test")
+	setTimeout () ->
+		profile = profiler.stopProfiling("test")
+		res.json(profile)
+	, time
 
 host = Settings.internal?.spelling?.host || "localhost"
 port = Settings.internal?.spelling?.port || 3005

+ 2 - 1
services/spelling/package.json

@@ -18,7 +18,8 @@
     "request": "^2.53.0",
     "restify": "2.5.1",
     "settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0",
-    "underscore": "1.4.4"
+    "underscore": "1.4.4",
+    "v8-profiler": "^5.2.4"
   },
   "devDependencies": {
     "bunyan": "^1.0.0",