Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cueball

Package Overview
Dependencies
Maintainers
4
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cueball - npm Package Compare versions

Comparing version 2.5.2 to 2.6.0

11

lib/agent.js

@@ -6,3 +6,3 @@ /*

*
* Copyright (c) 2017, Joyent, Inc.
* Copyright (c) 2018, Joyent, Inc.
*/

@@ -43,2 +43,4 @@

this.collector = mod_utils.createErrorMetrics(options);
EventEmitter.call(this);

@@ -143,3 +145,4 @@

log: this.log,
recovery: this.cba_recovery
recovery: this.cba_recovery,
collector: this.collector
};

@@ -497,2 +500,6 @@ function constructSocket(backend) {

CueBallAgent.prototype.isStopped = function () {
return (this.cba_stopped);
};
function CueBallHttpAgent(options) {

@@ -499,0 +506,0 @@ options.protocol = 'http';

@@ -6,3 +6,3 @@ /*

*
* Copyright 2017 Joyent, Inc.
* Copyright 2018 Joyent, Inc.
*/

@@ -159,2 +159,4 @@

this.p_collector = mod_utils.createErrorMetrics(options);
mod_assert.number(options.spares, 'options.spares');

@@ -224,6 +226,13 @@ mod_assert.number(options.maximum, 'options.maximum');

mod_assert.optionalFinite(options.decoherenceInterval,
'options.decoherenceInterval');
var shuffleIntvl = options.decoherenceInterval;
if (shuffleIntvl === undefined || shuffleIntvl === null ||
shuffleIntvl < 60) {
shuffleIntvl = 60;
}
this.p_shuffleTimer = new EventEmitter();
this.p_shuffleTimerInst = setInterval(function () {
self.p_shuffleTimer.emit('timeout');
}, 60000);
}, shuffleIntvl * 1000);
this.p_shuffleTimerInst.unref();

@@ -252,2 +261,3 @@

CueBallConnectionPool.prototype._incrCounter = function (counter) {
mod_utils.updateErrorMetrics(this.p_collector, this.p_uuid, counter);
if (this.p_counters[counter] === undefined)

@@ -254,0 +264,0 @@ this.p_counters[counter] = 0;

5

lib/set.js

@@ -6,3 +6,3 @@ /*

*
* Copyright 2017 Joyent, Inc.
* Copyright 2018 Joyent, Inc.
*/

@@ -65,2 +65,4 @@

this.cs_collector = mod_utils.createErrorMetrics(options);
mod_assert.number(options.target, 'options.target');

@@ -612,2 +614,3 @@ mod_assert.number(options.maximum, 'options.maximum');

CueBallConnectionSet.prototype._incrCounter = function (counter) {
mod_utils.updateErrorMetrics(this.cs_collector, this.cs_uuid, counter);
if (this.cs_counters[counter] === undefined)

@@ -614,0 +617,0 @@ this.cs_counters[counter] = 0;

@@ -6,3 +6,3 @@ /*

*
* Copyright (c) 2016, Joyent, Inc.
* Copyright (c) 2018, Joyent, Inc.
*/

@@ -18,11 +18,33 @@

stackTracesEnabled: stackTracesEnabled,
maybeCaptureStackTrace: maybeCaptureStackTrace
maybeCaptureStackTrace: maybeCaptureStackTrace,
createErrorMetrics: createErrorMetrics,
updateErrorMetrics: updateErrorMetrics
};
const mod_assert = require('assert-plus');
const mod_artedi = require('artedi');
const mod_os = require('os');
stackTracesEnabled.ENABLED = false;
var mod_dtrace, dtProvider, dtProbe;
var METRIC_CUEBALL_EVENT_COUNTER = 'cueball_events';
/*
* This table is intended to contain a list of cueball error-related events that
* we intend to track. Currently, it is consumed by `updateErrorMetrics()' and
* if the error string supplied by the caller is not part of this table, it
* will not be tracked.
*/
var array_metrics_err = [
'timeout-during-connect',
'error-during-connect',
'close-during-connect',
'timeout-during-connect',
'error-while-connected',
'retries-exhausted',
'claim-timeout',
'error-while-claimed',
'failed-state'];
/*
* Returns true if cueball should collect stack traces at every claim() and

@@ -367,1 +389,52 @@ * release() from a Pool.

}
function createErrorMetrics(options)
{
var collector;
mod_assert.optionalObject(options.collector, 'options.collector');
if (options.collector === undefined || options.collector === null) {
collector = mod_artedi.createCollector({
labels: {component: 'cueball'}
});
} else {
collector = options.collector;
}
/*
* This is idempotent, so if we're performing this on a collector that
* already has this counter (like one created in the cueball agent
* and then passed to a set or pool), there's no harm done.
*/
collector.counter({
name: METRIC_CUEBALL_EVENT_COUNTER,
help: 'Total number of cueball error events'
});
return (collector);
}
function updateErrorMetrics(collector, uuid, errStr)
{
var errors;
mod_assert.object(collector, 'collector');
mod_assert.uuid(uuid, 'uuid');
mod_assert.string(errStr, 'errStr');
/*
* If the error string supplied by the caller is not part of
* `array_metrics_err', then we aren't tracking it -- at least not as
* an error.
*/
if (array_metrics_err.indexOf(errStr) < 0)
return;
errors = collector.getCollector(METRIC_CUEBALL_EVENT_COUNTER);
errors.increment({
hostname: mod_os.hostname(),
uuid: uuid,
type: 'error',
evt: errStr
});
}
{
"name": "cueball",
"version": "2.5.2",
"version": "2.6.0",
"description": "manage a pool of connections to a multi-node service where nodes are listed in DNS",
"main": "lib/index.js",
"dependencies": {
"artedi": "1.3.0",
"assert-plus": ">=1.0.0 <2.0.0",

@@ -8,0 +9,0 @@ "bunyan": ">=1.5.1 <2.0.0",

Sorry, the diff of this file is not supported yet

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