New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

memsql-statsd

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memsql-statsd - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

6

example_config.js

@@ -12,4 +12,6 @@ {

password: "",
database: "dashboard"
}
database: "dashboard",
whitelist: [],
blacklist: []
},
}

@@ -59,3 +59,3 @@ /*

var AnalyticsCache = function(logger, database_name, connection_pool, prefix) {
var AnalyticsCache = function(logger, database_name, connection_pool, prefix, whitelist, blacklist) {
this._logger = logger;

@@ -67,5 +67,37 @@ this._database_name = database_name;

this._seen_classifiers = [];
if (whitelist) { this._whitelist_regex = this._compile_filter_re(whitelist); }
if (blacklist) { this._blacklist_regex = this._compile_filter_re(blacklist); }
};
AnalyticsCache.prototype._regex_escape = function(s) {
// From:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
return s.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
};
AnalyticsCache.prototype._compile_filter_re = function(filters) {
if (!filters) { return; }
var c = [];
var re = '^';
var i, il;
for (i = 0, il = filters.length; i < il; ++i) {
c.push(this._regex_escape(filters[i]).replace(/\\\*/g, '[^.]*?'))
}
re += (c.length ? c.join('|') : '') + '(\.|$)';
return new RegExp(re);
};
AnalyticsCache.prototype._should_store = function(key) {
var store = true;
if (this._whitelist_regex) { store = this._whitelist_regex.test(key); }
if (store && this._blacklist_regex) { store = !this._blacklist_regex.test(key); }
return store;
};
AnalyticsCache.prototype.record = function(key, value, timestamp) {
if (!this._should_store(key)) { return; }
if (!_.isUndefined(this._prefix)) { key = this._prefix + key; }

@@ -72,0 +104,0 @@ this._pending.push(new AnalyticsRow(key, value, timestamp));

@@ -38,3 +38,3 @@ /*

this.pool = new AggregatorsPool(this.logger, this.config.host, this.config.port, this.config.user, this.config.password);
this.cache = new AnalyticsCache(this.logger, this.config.database, this.pool, this.config.prefix);
this.cache = new AnalyticsCache(this.logger, this.config.database, this.pool, this.config.prefix, this.config.whitelist, this.config.blacklist);
this.stats = {

@@ -75,2 +75,3 @@ exception_count: 0,

if (_.has(this.config, 'prefix') && !_.isString(this.config.prefix)) { throw new Error('MemSQL prefix must be a string.'); }
};

@@ -77,0 +78,0 @@

@@ -5,3 +5,3 @@ {

"description": "A StatsD backend for MemSQL Ops",
"version": "0.4.0",
"version": "0.4.1",
"homepage": "https://github.com/memsql/memsql-statsd",

@@ -8,0 +8,0 @@ "repository": {

@@ -63,2 +63,2 @@ # MemSQL StatsD Backend

[statsd]: https://github.com/etsy/statsd
[ops]: http://www.memsql.com/features#dashboard
[ops]: http://www.memsql.com/ops

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc