diff --git a/libraries/metrics/metrics.coffee b/libraries/metrics/metrics.coffee index 95dad3a44f..17e85a5202 100644 --- a/libraries/metrics/metrics.coffee +++ b/libraries/metrics/metrics.coffee @@ -34,8 +34,19 @@ module.exports = Metrics = logger.log("starting google debug agent") debugAgent = require('@google-cloud/debug-agent') debugAgent.start({ + allowExpressions: true, + serviceContext: { + service: appname, + version: process.env['BUILD_VERSION'] + } + }) + + logger.log("ENABLE_PROFILER_AGENT set to #{process.env['ENABLE_PROFILER_AGENT']}") + if process.env['ENABLE_PROFILER_AGENT'] == "true" + logger.log("starting google profile agent") + profiler = require('@google-cloud/profiler') + profiler.start({ serviceContext: { - allowExpressions: true, service: appname, version: process.env['BUILD_VERSION'] } diff --git a/libraries/metrics/package.json b/libraries/metrics/package.json index bbfcaa7f9d..7e827f9e7e 100644 --- a/libraries/metrics/package.json +++ b/libraries/metrics/package.json @@ -12,6 +12,7 @@ "prom-client": "^11.1.3", "underscore": "~1.6.0", "@google-cloud/debug-agent": "^3.0.0", + "@google-cloud/profiler": "0.2.3", "@google-cloud/trace-agent": "^3.2.0" }, "devDependencies": {