summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2018-01-06 13:44:12 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2018-01-06 13:44:12 +0100
commita2ffb39e7ba6b83fd778bccf802f9148afd3b4ba (patch)
tree776151f364b9fe3fdc7f0918e80e8c7f8762d3b3
parent9aea76aba4c2e8dfb8b2402a5cbd2a93da79238c (diff)
downloadprocessor-a2ffb39e7ba6b83fd778bccf802f9148afd3b4ba.tar.gz
processor-a2ffb39e7ba6b83fd778bccf802f9148afd3b4ba.zip
add datadog
-rw-r--r--package-lock.json5
-rw-r--r--package.json1
-rw-r--r--worker.js8
3 files changed, 14 insertions, 0 deletions
diff --git a/package-lock.json b/package-lock.json
index d94b725..0cb9fa2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -838,6 +838,11 @@
}
}
},
+ "winston-datadog": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/winston-datadog/-/winston-datadog-1.1.0.tgz",
+ "integrity": "sha512-f3r1dsqXrK9o5nBRKFWaROf5QkoqJHGY6k0RMuwm4L+Oaab0JnQPGPkVxvJi9E1ylffGOrGFF/d9YCv2IP+IVg=="
+ },
"winston-loggly-bulk": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/winston-loggly-bulk/-/winston-loggly-bulk-2.0.1.tgz",
diff --git a/package.json b/package.json
index eec97dc..450cc30 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"sequelize": "^4.10.2",
"uuid": "^3.1.0",
"winston": "^2.3.1",
+ "winston-datadog": "^1.1.0",
"winston-loggly-bulk": "^2.0.1"
},
"devDependencies": {},
diff --git a/worker.js b/worker.js
index cdb76f3..e95f1ca 100644
--- a/worker.js
+++ b/worker.js
@@ -12,6 +12,7 @@ const amqp = require("amqplib"),
Promise = require("bluebird"),
uuidV4 = require("uuid/v4"),
winston = require("winston"),
+ datadog = require("winston-datadog"),
loggly = require("winston-loggly-bulk"),
_snakecase = require("lodash/snakeCase"),
Seq = require("sequelize"),
@@ -21,6 +22,7 @@ const RABBITMQ_URI = process.env.RABBITMQ_URI,
DATABASE_URI = process.env.DATABASE_URI,
QUEUE = process.env.QUEUE || "process",
LOGGLY_TOKEN = process.env.LOGGLY_TOKEN,
+ DATADOG_TOKEN = process.env.DATADOG_TOKEN,
// matches + players, 5 players with 50 matches as default
BATCHSIZE = parseInt(process.env.BATCHSIZE) || 5 * (50 + 1),
// maximum number of elements to be inserted in one statement
@@ -49,6 +51,12 @@ if (LOGGLY_TOKEN)
json: true
});
+// datadog integration
+if (DATADOG_TOKEN)
+ logger.add(new datadog({
+ api_key: DATADOG_TOKEN
+ }), null, true);
+
// MadGlory API uses snakeCase, our db uses camel_case
function snakeCaseKeys(obj) {
Object.keys(obj).forEach((key) => {