-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict' | ||
|
||
var wrap = require('../shimmer').wrapMethod | ||
|
||
module.exports = initialize | ||
|
||
function initialize(agent, Q) { | ||
if (Q.nextTick) { | ||
wrap(Q, 'Q.nextTick', 'nextTick', function wrapUninstrumented(original, method) { | ||
return agent.tracer.wrapFunctionFirstNoSegment(original, method) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
'use strict' | ||
|
||
var test = require('tap').test | ||
var helper = require('../../lib/agent_helper') | ||
|
||
function QContext(test, agent) { | ||
this.agent = agent; | ||
this.test = test; | ||
} | ||
|
||
QContext.prototype.assertTransaction = function assertTransaction(transaction) { | ||
this.test.equal(this.agent.getTransaction(), transaction) | ||
this.test.equal(this.agent.getTransaction().trace.root.children.length, 0) | ||
} | ||
|
||
test('Q.ninvoke', function testQNInvoke(t) { | ||
var agent = setupAgent(t) | ||
var Q = require('q') | ||
var qContext = new QContext(t, agent) | ||
|
||
var firstTest = Q.defer() | ||
var secondTest = Q.defer() | ||
|
||
helper.runInTransaction(agent, function transactionWrapper(transaction) { | ||
Q.ninvoke(function anonymous() { | ||
qContext.assertTransaction(transaction) | ||
firstTest.resolve() | ||
}) | ||
}) | ||
|
||
helper.runInTransaction(agent, function transactionWrapper(transaction) { | ||
Q.ninvoke(function anonymous() { | ||
qContext.assertTransaction(transaction) | ||
secondTest.resolve() | ||
}) | ||
}) | ||
|
||
Q.all([firstTest, secondTest]) | ||
.then(function done() { | ||
t.end() | ||
}) | ||
}) | ||
|
||
test('Q.then', function testQNInvoke(t) { | ||
var agent = setupAgent(t) | ||
var Q = require('q') | ||
var qContext = new QContext(t, agent) | ||
|
||
var firstTest = Q.defer() | ||
var secondTest = Q.defer() | ||
|
||
helper.runInTransaction(agent, function transactionWrapper(transaction) { | ||
Q(true).then(function anonymous() { | ||
qContext.assertTransaction(transaction) | ||
firstTest.resolve() | ||
}) | ||
}) | ||
|
||
helper.runInTransaction(agent, function transactionWrapper(transaction) { | ||
Q(true).then(function anonymous() { | ||
qContext.assertTransaction(transaction) | ||
secondTest.resolve() | ||
}) | ||
}) | ||
|
||
Q.all([firstTest, secondTest]) | ||
.then(function done() { | ||
t.end() | ||
}) | ||
}) | ||
|
||
function setupAgent(t) { | ||
var agent = helper.instrumentMockedAgent() | ||
t.tearDown(function tearDown() { | ||
helper.unloadAgent(agent) | ||
}) | ||
|
||
return agent | ||
} |
efea1d5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch breaks Q in a major way. We have just hit this in our production server - after autoscaling and getting new EC2 instances (which automatically does
npm install
) we got the latest version ofnewrelic
module 1.25.2, all hell broke loose after this.efea1d5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.