зеркало из https://github.com/microsoft/statsd.git
Fix `prefixStats` global variable leaking
`prefixStats` is leaked through stats.js and was in global scope of event emitter without failing graphite backend by pure accident. Now it is read from config.
This commit is contained in:
Родитель
be056c5cb2
Коммит
b0bf253971
|
@ -32,6 +32,7 @@ var prefixTimer;
|
|||
var prefixGauge;
|
||||
var prefixSet;
|
||||
var globalSuffix;
|
||||
var prefixStats;
|
||||
|
||||
// set up namespaces
|
||||
var legacyNamespace = true;
|
||||
|
@ -188,6 +189,7 @@ exports.init = function graphite_init(startup_time, config, events, logger) {
|
|||
prefixSet = config.graphite.prefixSet;
|
||||
globalSuffix = config.graphite.globalSuffix;
|
||||
legacyNamespace = config.graphite.legacyNamespace;
|
||||
prefixStats = config.prefixStats;
|
||||
|
||||
// set defaults for prefixes & suffix
|
||||
globalPrefix = globalPrefix !== undefined ? globalPrefix : "stats";
|
||||
|
@ -195,6 +197,7 @@ exports.init = function graphite_init(startup_time, config, events, logger) {
|
|||
prefixTimer = prefixTimer !== undefined ? prefixTimer : "timers";
|
||||
prefixGauge = prefixGauge !== undefined ? prefixGauge : "gauges";
|
||||
prefixSet = prefixSet !== undefined ? prefixSet : "sets";
|
||||
prefixStats = prefixStats !== undefined ? prefixStats : "statsd";
|
||||
legacyNamespace = legacyNamespace !== undefined ? legacyNamespace : true;
|
||||
|
||||
// In order to unconditionally add this string, it either needs to be
|
||||
|
|
2
stats.js
2
stats.js
|
@ -151,7 +151,7 @@ config.configFile(process.argv[2], function (config, oldConfig) {
|
|||
l = new logger.Logger(config.log || {});
|
||||
|
||||
// setup config for stats prefix
|
||||
prefixStats = config.prefixStats;
|
||||
var prefixStats = config.prefixStats;
|
||||
prefixStats = prefixStats !== undefined ? prefixStats : "statsd";
|
||||
//setup the names for the stats stored in counters{}
|
||||
bad_lines_seen = prefixStats + ".bad_lines_seen";
|
||||
|
|
Загрузка…
Ссылка в новой задаче