Skip to content
This repository was archived by the owner on Feb 1, 2018. It is now read-only.

Commit 2940200

Browse files
committed
update version, set content length properly (was testing on the wrong version)
1 parent af18773 commit 2940200

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/stackdriver.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,17 @@ StackdriverBackend.prototype.post_message_to_gateway = function(stackdriverMessa
9292
return;
9393
}
9494

95+
messageString = JSON.stringify(stackdriverMessage)
96+
9597
// setup the HTTPS request
9698
var options = {
9799
host : this.stackdriverHost,
98100
path : this.stackdriverPath,
99101
method : 'POST',
100102
headers : {
103+
"Content-Length" : messageString.length,
101104
"Content-Type" : "application/json; charset=utf-8",
102105
"x-stackdriver-apikey" : this.apiKey,
103-
"Content-Length" : stackdriverMessage.length,
104106
"User-Agent": "stackdriver-statsd-backend-0.1.2"
105107
}
106108
};
@@ -109,7 +111,7 @@ StackdriverBackend.prototype.post_message_to_gateway = function(stackdriverMessa
109111

110112
if (this.debug) {
111113
util.log("Message contents to be posted:");
112-
util.log(JSON.stringify(stackdriverMessage));
114+
util.log(messageString);
113115
}
114116

115117
// perform the HTTPS request
@@ -128,7 +130,7 @@ StackdriverBackend.prototype.post_message_to_gateway = function(stackdriverMessa
128130
util.log("STACKDRIVER GATEWAY RESPONSE: " + chunk);
129131
});
130132
});
131-
req.write(JSON.stringify(stackdriverMessage));
133+
req.write(messageString);
132134
req.end();
133135

134136
req.on('error', function(e) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stackdriver-statsd-backend",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Send metric data from statsd to Stackdriver",
55
"main": "lib/stackdriver.js",
66
"scripts": {

0 commit comments

Comments
 (0)