Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[shim] Fix TypeError: segment.transaction.isActive is not a function #282

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions lib/shim/shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,9 @@ function getSegment(obj) {
*/
function getActiveSegment(obj) {
var segment = this.getSegment(obj)
if (segment && segment.transaction && segment.transaction.isActive()) {
if (segment && segment.transaction &&
Copy link

@gevertex gevertex Oct 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should else this with some instrumentation to send a stack trace and other diagnostics to NewRelic so that all of the instances of this problem can be aggregated and give NewRelic devs more information about how to fix this and the code paths involved. That way though the data does get dropped in these cases, we learn something each time it happens and it can be quantified.

I doubt the built in object can be used in these cases, so you might need to implement something more custom, or instantiate a new instance, or something like that. Dirty but temporary and probably very useful.

typeof segment.transaction.isActive === 'function' &&
segment.transaction.isActive()) {
return segment
}
return null
Expand Down Expand Up @@ -2024,7 +2026,7 @@ function _wrap(shim, original, name, spec, args) {
wrapped = arity.fixArity(original, wrapped)
}

// TODO: Once all wrapping is converted to proxies, we won't need to
// TODO: Once all wrapping is converted to proxies, we won't need to
// set this property as the trap on 'get' will return the original for
// __NR_original. For now, we have to prevent setting this on original.
if (!wrapped.__NR_original) {
Expand Down