Commit 0c8ef3cb authored by Suhaimi Amir's avatar Suhaimi Amir

add jaeger tracer

parent 0a8b6f1d
Pipeline #1617 passed with stage
in 18 seconds
const configServer = require('cote-requester')('config', `${Math.random().toString(36).substring(7)} Config Lib : Reqs`);
const cote = require('cote');
const logger = require('logger');
const tracer = require('tracer').init('dx-config-plugin');
let configSubscriber = null;
exports.get = async (name) => {
setTimeout(() => {
if (typeof global.config[name] === 'undefined') {
logger.info(`Timed out while retrieving config "${name}", exiting...`);
process.exit();
}
}, 5000);
exports.get = async (name, spanContext = {}) => {
// setTimeout(() => {
// if (typeof global.config[name] === 'undefined') {
// logger.info(`Timed out while retrieving config "${name}", exiting...`);
// process.exit();
// }
// }, 5000);
const parentSpan = tracer.extract('text_map', spanContext);
const span = tracer.startSpan('get.config', { childOf: parentSpan, tags: { 'span.kind': 'server' } });
span.setTag('config.name', name);
logger.info(`Retrieving config file "${name}"...`);
await configServer.send('config.get', name)
return configServer.send('config.get', name)
.then((ret) => {
logger.info(`Retrieving config file "${name}"... SUCCESS`);
logger.debug(`${JSON.stringify(ret.data)}`);
......@@ -25,12 +29,16 @@ exports.get = async (name) => {
config = String(config);
}
global.config[name] = config;
span.setTag('success', true);
span.finish();
return config;
})
.catch((err) => {
logger.info(`Retrieving config file "${name}"... FAILED`);
logger.debug(`${JSON.stringify(err)}`);
return new Error(err.message);
span.setTag('success', false);
span.finish();
return Promise.reject(err);
});
};
......
{
"name": "config",
"version": "1.0.2",
"version": "1.0.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -115,6 +115,11 @@
"amp": "0.3.1"
}
},
"ansi-color": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/ansi-color/-/ansi-color-0.2.1.tgz",
"integrity": "sha1-PnXAN0dSF1RO12Oo21cJ+prlv5o="
},
"ansi-escapes": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
......@@ -226,6 +231,16 @@
"concat-map": "0.0.1"
}
},
"bufrw": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/bufrw/-/bufrw-1.2.1.tgz",
"integrity": "sha1-k/IiIptPX14s1VkjaJFAf5hTZjs=",
"requires": {
"ansi-color": "^0.2.1",
"error": "^7.0.0",
"xtend": "^4.0.0"
}
},
"callsite": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz",
......@@ -737,6 +752,15 @@
"resolved": "https://registry.npmjs.org/env-variable/-/env-variable-0.0.5.tgz",
"integrity": "sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA=="
},
"error": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/error/-/error-7.0.2.tgz",
"integrity": "sha1-pfdf/02ZJhJt2sDqXcOOaJFTywI=",
"requires": {
"string-template": "~0.2.1",
"xtend": "~4.0.0"
}
},
"error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
......@@ -1361,6 +1385,18 @@
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true
},
"jaeger-client": {
"version": "3.15.0",
"resolved": "https://registry.npmjs.org/jaeger-client/-/jaeger-client-3.15.0.tgz",
"integrity": "sha512-0SfuEE7E6XVLhu8th5JG/ACtnIWq4Tad0iSst3+De9HOMSz1RI0Tl1MLXzetudI670rqfCs4m37XCTMRgu8oxg==",
"requires": {
"node-int64": "^0.4.0",
"opentracing": "^0.13.0",
"thriftrw": "^3.5.0",
"uuid": "^3.2.1",
"xorshift": "^0.2.0"
}
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
......@@ -1430,9 +1466,9 @@
}
},
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
},
"logform": {
"version": "2.1.2",
......@@ -1453,6 +1489,11 @@
"winston": "^3.1.0"
}
},
"long": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/long/-/long-2.4.0.tgz",
"integrity": "sha1-n6GAux2VAM3CnEFWdmoZleH0Uk8="
},
"mime-db": {
"version": "1.40.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
......@@ -1522,6 +1563,11 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
"node-int64": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
"integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs="
},
"normalize-package-data": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
......@@ -1592,6 +1638,11 @@
"mimic-fn": "^1.0.0"
}
},
"opentracing": {
"version": "0.13.0",
"resolved": "https://registry.npmjs.org/opentracing/-/opentracing-0.13.0.tgz",
"integrity": "sha1-ajQUQvCdfYZrwR7QPeHjgo49aqs="
},
"optionator": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
......@@ -2060,6 +2111,11 @@
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
},
"string-template": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/string-template/-/string-template-0.2.1.tgz",
"integrity": "sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0="
},
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
......@@ -2159,6 +2215,16 @@
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
"dev": true
},
"thriftrw": {
"version": "3.11.3",
"resolved": "https://registry.npmjs.org/thriftrw/-/thriftrw-3.11.3.tgz",
"integrity": "sha512-mnte80Go5MCfYyOQ9nk6SljaEicCXlwLchupHR+/zlx0MKzXwAiyt38CHjLZVvKtoyEzirasXuNYtkEjgghqCw==",
"requires": {
"bufrw": "^1.2.1",
"error": "7.0.2",
"long": "^2.4.0"
}
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
......@@ -2179,6 +2245,14 @@
"resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz",
"integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA="
},
"tracer": {
"version": "git+https://gitlab.delyva.com/shared-lib/tracer.git#b1f201fa6248918576010c3f51ad3d8cc50227a9",
"from": "git+https://gitlab.delyva.com/shared-lib/tracer.git",
"requires": {
"jaeger-client": "^3.15.0",
"logger": "git+https://gitlab.delyva.com/shared-lib/logger.git"
}
},
"triple-beam": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
......@@ -2340,6 +2414,16 @@
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz",
"integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4="
},
"xorshift": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/xorshift/-/xorshift-0.2.1.tgz",
"integrity": "sha1-/NgiZ+k1HBPw+5xzMH8lMx0pxjo="
},
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
},
"yeast": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
......
......@@ -12,7 +12,8 @@
"dependencies": {
"cote": "^0.20.0",
"cote-requester": "git+https://gitlab.delyva.com/shared-lib/cote-requester.git",
"logger": "git+https://gitlab.delyva.com/shared-lib/logger.git"
"logger": "git+https://gitlab.delyva.com/shared-lib/logger.git",
"tracer": "git+https://gitlab.delyva.com/shared-lib/tracer.git"
},
"devDependencies": {
"eslint-config-airbnb": "^17.1.0",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment