From 7e359c9df2955a4499bcfcc3629f6de6e79a857a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 16 Oct 2018 17:19:21 +0100 Subject: [PATCH] add trace and debug agent to metrics --- libraries/metrics/metrics.coffee | 21 ++++++++++++++++++++- libraries/metrics/package.json | 4 +++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libraries/metrics/metrics.coffee b/libraries/metrics/metrics.coffee index d23f3ec06d..1da51b63b9 100644 --- a/libraries/metrics/metrics.coffee +++ b/libraries/metrics/metrics.coffee @@ -14,11 +14,30 @@ destructors = [] require "./uv_threadpool_size" + +traceAgent = require('@google-cloud/trace-agent') +debugAgent = require('@google-cloud/debug-agent') + +.start({ + serviceContext: { + allowExpressions: true, + service: 'filestore-readonly', + version: '0.0.1' + } +}); + module.exports = Metrics = initialize: (_name) -> name = _name collectDefaultMetrics({ timeout: 5000, prefix: name }) - + traceAgent.start() + debugAgent.start({ + serviceContext: { + allowExpressions: true, + service: name, + version: '0.0.1' + } + }) registerDestructor: (func) -> destructors.push func diff --git a/libraries/metrics/package.json b/libraries/metrics/package.json index d3421a3619..648d4d627b 100644 --- a/libraries/metrics/package.json +++ b/libraries/metrics/package.json @@ -22,6 +22,8 @@ "grunt-execute": "^0.2.2", "grunt-mocha-test": "^0.11.0", "sandboxed-module": "", - "sinon": "" + "sinon": "", + "@google-cloud/debug-agent": "^3.0.0", + "@google-cloud/trace-agent": "^3.2.0" } }