Comparing version 9.0.0 to 9.1.0
CHANGELOG | ||
========= | ||
## 9.1.0 (2022-6-20) | ||
* @zhyu Append standard Datadog tags from env vars (DD_ENTITY_ID, DD_ENV, DD_SERVICE, and DD_VERSION) | ||
* @bdeitte Check if client is undefined before closing to fix error | ||
* @bdeitte Start using GitHub Actions for tests and remove now-broken travis file | ||
* @bdeitte Update testing dependencies | ||
## 9.0.0 (2021-10-31) | ||
@@ -5,0 +11,0 @@ * @cesarfd Add TCP reconnections, similar to how it's done for UDS. Enabled by default and configurable through tcpGracefulErrorHandling/tcpGracefulRestartRateLimit. |
@@ -15,2 +15,9 @@ const process = require('process'), | ||
const CACHE_DNS_TTL_DEFAULT = 60000; | ||
// DD_ENV_GLOBAL_TAGS_MAPPING is a mapping of each "DD_" prefixed environment variable to a specific tag name. | ||
const DD_ENV_GLOBAL_TAGS_MAPPING = { | ||
DD_ENTITY_ID: 'dd.internal.entity_id', // Client-side entity ID injection for container tagging. | ||
DD_ENV: 'env', // The name of the env in which the service runs. | ||
DD_SERVICE: 'service', // The name of the running service. | ||
DD_VERSION: 'version', // The current version of the running service. | ||
}; | ||
@@ -66,7 +73,7 @@ /** | ||
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))); | ||
const availableDDEnvs = Object.keys(DD_ENV_GLOBAL_TAGS_MAPPING).filter(key => process.env[key]); | ||
if (availableDDEnvs.length > 0) { | ||
this.globalTags = this.globalTags. | ||
filter((item) => !availableDDEnvs.some(env => item.startsWith(`${DD_ENV_GLOBAL_TAGS_MAPPING[env]}:`))). | ||
concat(availableDDEnvs.map(env => `${DD_ENV_GLOBAL_TAGS_MAPPING[env]}:${helpers.sanitizeTags(process.env[env])}`)); | ||
} | ||
@@ -431,2 +438,10 @@ this.telegraf = options.telegraf || false; | ||
Client.prototype._close = function (callback) { | ||
// If there was an error creating it, nothing to do here | ||
if (! this.socket) { | ||
if (callback) { | ||
callback(); | ||
} | ||
return; | ||
} | ||
// error function to use in callback and catch below | ||
@@ -533,3 +548,3 @@ let handledError = false; | ||
function protocolErrorHandler(client, protocol, err) { | ||
if (!err || !client.socket.createdAt) { | ||
if (!err || !client.socket || !client.socket.createdAt) { | ||
return; | ||
@@ -536,0 +551,0 @@ } |
{ | ||
"name": "hot-shots", | ||
"description": "Node.js client for StatsD, DogStatsD, and Telegraf", | ||
"version": "9.0.0", | ||
"version": "9.1.0", | ||
"author": "Steve Ivy", | ||
@@ -6,0 +6,0 @@ "types": "./types.d.ts", |
@@ -21,3 +21,3 @@ # hot-shots | ||
[![Build Status](https://secure.travis-ci.org/brightcove/hot-shots.png?branch=master)](http://travis-ci.org/brightcove/hot-shots) | ||
![Build Status](https://github.com/brightcove/hot-shots/actions/workflows/node.js.yml/badge.svg) | ||
@@ -50,3 +50,7 @@ ## Migrating from node-statsd | ||
mockBuffer will keep growing, so only use for testing or clear out periodically. `default: false` | ||
* `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: {}` | ||
* `globalTags`: Tags that will be added to every metric. Can be either an object or list of tags. `default: {}`. The following *Datadog* tags are appended to `globalTags` from the corresponding environment variable if the latter is set: | ||
* `dd.internal.entity_id` from `DD_ENTITY_ID` ([docs](https://docs.datadoghq.com/developers/dogstatsd/?tab=kubernetes#origin-detection-over-udp)) | ||
* `env` from `DD_ENV` ([docs](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/?tab=kubernetes#full-configuration)) | ||
* `service` from `DD_SERVICE` ([docs](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/?tab=kubernetes#full-configuration)) | ||
* `version` from `DD_VERSION` ([docs](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/?tab=kubernetes#full-configuration)) | ||
* `maxBufferSize`: If larger than 0, metrics will be buffered and only sent when the string length is greater than the size. `default: 0` | ||
@@ -53,0 +57,0 @@ * `bufferFlushInterval`: If buffering is in use, this is the time in ms to always flush any buffered metrics. `default: 1000` |
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 2 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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
90113
13
1607
307