Comparing version 6.8.4 to 6.8.5
CHANGELOG | ||
========= | ||
## 6.8.5 (2019-12-19) | ||
* @bdeitte Fix for socket on reading when cacheDns and udp in use | ||
## 6.8.4 (2019-12-18) | ||
@@ -5,0 +8,0 @@ * @bdeitte Fix cacheDns with udp |
@@ -44,2 +44,5 @@ const util = require('util'), | ||
this.protocol = (options.protocol && options.protocol.toLowerCase()); | ||
if (! this.protocol) { | ||
this.protocol = PROTOCOL.UDP; | ||
} | ||
this.host = options.host || process.env.DD_AGENT_HOST || 'localhost'; | ||
@@ -81,25 +84,11 @@ this.port = options.port || parseInt(process.env.DD_DOGSTATSD_PORT, 10) || 8125; | ||
this.socket = options.socket; | ||
} else if (options.cacheDns === true) { | ||
dns.lookup(this.host, (err, address) => { | ||
if (err === null) { | ||
this.host = address; | ||
} else { | ||
this.dnsError = err; | ||
} | ||
this.socket = createTransport(this, { | ||
host: this.host, | ||
path: options.path, | ||
port: this.port, | ||
protocol: this.protocol, | ||
stream: options.stream | ||
}); | ||
}); | ||
} else { | ||
if (options.useDefaultRoute) { | ||
const defaultRoute = helpers.getDefaultRoute(); | ||
if (defaultRoute) { | ||
console.log(`Got ${defaultRoute} for the system's default route`); | ||
this.host = defaultRoute; | ||
} | ||
} else if (options.useDefaultRoute) { | ||
const defaultRoute = helpers.getDefaultRoute(); | ||
if (defaultRoute) { | ||
console.log(`Got ${defaultRoute} for the system's default route`); | ||
this.host = defaultRoute; | ||
} | ||
} | ||
if (! this.socket) { | ||
this.socket = createTransport(this, { | ||
@@ -114,2 +103,14 @@ host: this.host, | ||
if (options.cacheDns === true && this.protocol === PROTOCOL.UDP) { | ||
dns.lookup(this.host, (err, address) => { | ||
if (err === null) { | ||
this.host = address; | ||
// update for uds to use for each send call | ||
this.socket.setHost = this.host; | ||
} else { | ||
this.dnsError = err; | ||
} | ||
}); | ||
} | ||
if (!options.isChild && options.errorHandler) { | ||
@@ -364,3 +365,3 @@ this.socket.on('error', options.errorHandler); | ||
if (!this.socket) { | ||
return callback(new Error('No protocol set. Check previous errors for details.')); | ||
return callback(new Error('Socket not created properly. Check previous errors for details.')); | ||
} | ||
@@ -367,0 +368,0 @@ |
@@ -46,2 +46,3 @@ const assert = require('assert'); | ||
return { | ||
updateHost: (newHost) => { args.host = newHost; }, | ||
emit: socket.emit.bind(socket), | ||
@@ -48,0 +49,0 @@ on: socket.on.bind(socket), |
{ | ||
"name": "hot-shots", | ||
"description": "Node.js client for StatsD, DogStatsD, and Telegraf", | ||
"version": "6.8.4", | ||
"version": "6.8.5", | ||
"author": "Steve Ivy", | ||
@@ -6,0 +6,0 @@ "types": "./types.d.ts", |
@@ -38,3 +38,4 @@ # hot-shots | ||
* `globalize`: Expose this StatsD instance globally. `default: false` | ||
* `cacheDns`: Cache the initial dns lookup to *host* `default: false` | ||
* `cacheDns`: Cache the initial dns lookup to *host* , only used | ||
when protocol is `uds`, `default: false` | ||
* `mock`: Create a mock StatsD instance, sending no stats to | ||
@@ -41,0 +42,0 @@ the server and allowing data to be read from mockBuffer. Note that |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73258
271