Comparing version 6.1.1 to 6.2.0
@@ -170,3 +170,2 @@ module.exports = { | ||
"no-plusplus": "off", | ||
"no-process-env": "error", | ||
"no-process-exit": "error", | ||
@@ -173,0 +172,0 @@ "no-proto": "error", |
CHANGELOG | ||
========= | ||
## 6.2.0 (2019-4-10) | ||
* @ahmed-mez Add support for env variables DD_AGENT_HOST, | ||
DD_DOGSTATSD_PORT, and DD_ENTITY_ID | ||
* @JamesMGreene Fix syntax in README example | ||
## 6.1.1 (2019-1-8) | ||
@@ -5,0 +10,0 @@ * @bdeitte Fix errorHandler to only happen again on errors |
@@ -113,3 +113,4 @@ const fs = require('fs'); | ||
formatDate: formatDate, | ||
getDefaultRoute: getDefaultRoute | ||
getDefaultRoute: getDefaultRoute, | ||
sanitizeTags: sanitizeTags | ||
}; |
@@ -64,4 +64,4 @@ const dgram = require('dgram'), | ||
this.protocol = (options.protocol && options.protocol.toLowerCase()); | ||
this.host = options.host || 'localhost'; | ||
this.port = options.port || 8125; | ||
this.host = options.host || process.env.DD_AGENT_HOST || 'localhost'; | ||
this.port = options.port || parseInt(process.env.DD_DOGSTATSD_PORT, 10) || 8125; | ||
this.prefix = options.prefix || ''; | ||
@@ -77,2 +77,8 @@ this.suffix = options.suffix || ''; | ||
helpers.formatTags(options.globalTags, options.telegraf) : []; | ||
if (process.env.DD_ENTITY_ID) { | ||
this.globalTags = this.globalTags.filter((item) => { | ||
return item.indexOf('dd.internal.entity_id:') !== 0; | ||
}); | ||
this.globalTags.push('dd.internal.entity_id:'.concat(helpers.sanitizeTags(process.env.DD_ENTITY_ID))); | ||
} | ||
this.telegraf = options.telegraf || false; | ||
@@ -79,0 +85,0 @@ this.maxBufferSize = options.maxBufferSize || 0; |
{ | ||
"name": "hot-shots", | ||
"description": "Node.js client for StatsD, DogStatsD, and Telegraf", | ||
"version": "6.1.1", | ||
"version": "6.2.0", | ||
"author": "Steve Ivy", | ||
@@ -6,0 +6,0 @@ "types": "./types.d.ts", |
@@ -31,4 +31,4 @@ # hot-shots | ||
Parameters (specified as one object passed into hot-shots): | ||
* `host`: The host to send stats to `default: localhost` | ||
* `port`: The port to send stats to `default: 8125` | ||
* `host`: The host to send stats to, if not set, the constructor tries to retrieve it from the `DD_AGENT_HOST` environment variable, `default: localhost` | ||
* `port`: The port to send stats to, if not set, the constructor tries to retrieve it from the `DD_DOGSTATSD_PORT` environment variable, `default: 8125` | ||
* `prefix`: What to prefix each stat name with `default: ''` | ||
@@ -39,3 +39,3 @@ * `suffix`: What to suffix each stat name with `default: ''` | ||
* `mock`: Create a mock StatsD instance, sending no stats to the server and allowing data to be read from mockBuffer? `default: false` | ||
* `globalTags`: Tags that will be added to every metric. Can be either an object or list of tags. `default: {}` | ||
* `globalTags`: Tags that will be added to every metric. Can be either an object or list of tags. The *Datadog* `dd.internal.entity_id` tag is appended to `globalTags` from the `DD_ENTITY_ID` environment variable if the latter is set. `default: {}` | ||
* `maxBufferSize`: If larger than 0, metrics will be buffered and only sent when the string length is greater than the size. `default: 0` | ||
@@ -89,3 +89,3 @@ * `bufferFlushInterval`: If buffering is in use, this is the time in ms to always flush any buffered metrics. `default: 1000` | ||
var StatsD = require('hot-shots'), | ||
client = new StatsD({ port: 8020, globalTags: { env: process.env.NODE_ENV, errorHandler: errorHandler }); | ||
client = new StatsD({ port: 8020, globalTags: { env: process.env.NODE_ENV }, errorHandler: errorHandler }); | ||
@@ -92,0 +92,0 @@ // Timing: sends a timing command with the specified milliseconds |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances 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
64508
1237
3
5