Skip to content

Commit

Permalink
Add transaction-tracer instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
brycebaril committed Aug 19, 2014
1 parent c408090 commit f531bbc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ var net = require("net"),
default_port = 6379,
default_host = "127.0.0.1";

var tx = require("transaction-tracer");

// can set this to true to enable for all connections
exports.debug_mode = false;

Expand Down Expand Up @@ -669,6 +671,10 @@ RedisClient.prototype.return_reply = function (reply) {
this.should_buffer = false;
}

if (command_obj) {
tx.end(command_obj.id);
}

if (command_obj && !command_obj.sub_command) {
if (typeof command_obj.callback === "function") {
if (this.options.detect_buffers && command_obj.buffer_args === false) {
Expand Down Expand Up @@ -733,6 +739,7 @@ RedisClient.prototype.return_reply = function (reply) {
// This Command constructor is ever so slightly faster than using an object literal, but more importantly, using
// a named constructor helps it show up meaningfully in the V8 CPU profiler and in heap snapshots.
function Command(command, args, sub_command, buffer_args, callback) {
this.id = tx.start({module: "redis", query: command});
this.command = command;
this.args = args;
this.sub_command = sub_command;
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"repository": {
"type": "git",
"url": "git://github.com/mranney/node_redis.git"
},
"dependencies": {
"transaction-tracer": "~1.1.0"
}
}

0 comments on commit f531bbc

Please sign in to comment.