Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Support sending raw messages to statsd daemon #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/statsd.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,16 @@ Client.prototype.send = function (stat, value, type, sampleRate, tags, callback)
if(merged_tags.length > 0){
message += '|#' + merged_tags.join(',');
}

this.sendMessage(message, callback);
};

/**
* Sends a raw message across to statsd server
* @param message {String} The message to send
* @param callback {Function=} Callback when message is done being delivered. Optional.
*/
Client.prototype.sendMessage = function (message, callback) {
// Only send this stat if we're not a mock Client.
if(!this.mock) {
buf = new Buffer(message);
Expand All @@ -224,7 +233,7 @@ Client.prototype.send = function (stat, value, type, sampleRate, tags, callback)
callback(null, 0);
}
}
};
}

/**
* Close the underlying socket and stop listening for data on it.
Expand Down