node-dogstatsd
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -9,3 +9,3 @@ "use strict"; | ||
var Client = function(host, port, socket) { | ||
var Client = function(host, port, socket, options) { | ||
this.host = host || "localhost"; | ||
@@ -21,2 +21,5 @@ this.port = port || 8125; | ||
this.ephemeral_socket = this.last_used_timer = null; | ||
options = options || {}; | ||
this.global_tags = options.global_tags; | ||
}; | ||
@@ -114,2 +117,7 @@ | ||
Client.prototype.send = function(data, sample_rate, tags) { | ||
if (!tags && Array.isArray(sample_rate)) { | ||
tags = sample_rate; | ||
sample_rate = undefined; | ||
} | ||
if (!sample_rate) | ||
@@ -131,7 +139,17 @@ sample_rate = 1; | ||
if (tags && Array.isArray(tags)) { | ||
var tagStr = tags.join(","); | ||
if (this.global_tags || tags) { | ||
var merged_tags = []; | ||
for (stat in sampled_data) | ||
sampled_data[stat] = sampled_data[stat] + "|#" + tagStr; | ||
if (Array.isArray(this.global_tags)) | ||
merged_tags = merged_tags.concat(this.global_tags); | ||
if (Array.isArray(tags)) | ||
merged_tags = merged_tags.concat(tags); | ||
if (merged_tags.length > 0) { | ||
var merged_tags_str = merged_tags.join(','); | ||
for (stat in sampled_data) | ||
sampled_data[stat] = sampled_data[stat] + "|#" + merged_tags_str; | ||
} | ||
} | ||
@@ -138,0 +156,0 @@ |
{ | ||
"name" : "node-dogstatsd", | ||
"description" : "node client for extended StatsD server of Datadog", | ||
"version" : "0.0.5", | ||
"version" : "0.0.6", | ||
"author" : "Young Han Lee", | ||
@@ -13,3 +13,2 @@ "repository" : { | ||
}, | ||
"os" : [ "linux", "darwin", "freebsd" ], | ||
"directories" : { | ||
@@ -16,0 +15,0 @@ "lib" : "./lib/" |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20109
386
1