newrelic 4.5.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEWS.md +153 -1
- package/api.js +8 -1
- package/bin/compare-bench-results.js +159 -0
- package/bin/run-bench.js +87 -44
- package/index.js +16 -8
- package/lib/agent.js +1 -1
- package/lib/collector/remote-method.js +12 -0
- package/lib/config/default.js +17 -0
- package/lib/config/env.js +4 -0
- package/lib/config/index.js +3 -0
- package/lib/db/tracer.js +15 -6
- package/lib/environment.js +1 -1
- package/lib/errors/index.js +1 -1
- package/lib/feature_flags.js +0 -1
- package/lib/harvest.js +36 -18
- package/lib/instrumentation/core/crypto.js +2 -1
- package/lib/instrumentation/core/fs.js +7 -2
- package/lib/instrumentation/core/globals.js +17 -1
- package/lib/instrumentation/core/http-outbound.js +102 -3
- package/lib/instrumentation/core/http.js +6 -96
- package/lib/instrumentation/mongodb.js +158 -115
- package/lib/metrics/recorders/http.js +1 -1
- package/lib/metrics/recorders/other.js +1 -1
- package/lib/priority-queue.js +5 -2
- package/lib/shim/message-shim.js +5 -4
- package/lib/shim/shim.js +14 -3
- package/lib/shim/specs/index.js +1 -0
- package/lib/shim/transaction-shim.js +3 -3
- package/lib/shimmer.js +3 -0
- package/lib/transaction/dt-payload.js +16 -0
- package/lib/transaction/handle.js +1 -1
- package/lib/transaction/index.js +8 -4
- package/lib/transaction/trace/index.js +31 -38
- package/package.json +3 -2
- package/.npmignore +0 -4
|
@@ -49,30 +49,48 @@ function Trace(transaction) {
|
|
|
49
49
|
* segments that support recording.
|
|
50
50
|
*/
|
|
51
51
|
Trace.prototype.end = function end() {
|
|
52
|
+
var segments = [this.root]
|
|
53
|
+
|
|
54
|
+
while (segments.length) {
|
|
55
|
+
var segment = segments.pop()
|
|
56
|
+
_softEndSegment(segment)
|
|
57
|
+
Array.prototype.push.apply(segments, segment.getChildren())
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Iterates over the trace tree and generates a span event for each segment.
|
|
63
|
+
*/
|
|
64
|
+
Trace.prototype.generateSpanEvents = function generateSpanEvents() {
|
|
52
65
|
var config = this.transaction.agent.config
|
|
53
|
-
var segments = []
|
|
54
|
-
var processFn
|
|
55
66
|
|
|
56
67
|
if (
|
|
57
68
|
this.transaction.sampled &&
|
|
58
69
|
config.span_events.enabled &&
|
|
59
|
-
config.
|
|
70
|
+
config.distributed_tracing.enabled
|
|
60
71
|
) {
|
|
72
|
+
var toProcess = []
|
|
61
73
|
// Root segment does not become a span, so we need to process it separately.
|
|
62
|
-
|
|
74
|
+
const spanAggregator = this.transaction.agent.spans
|
|
63
75
|
const children = this.root.getChildren()
|
|
64
76
|
for (let i = 0; i < children.length; ++i) {
|
|
65
|
-
|
|
77
|
+
toProcess.push(new DTTraceNode(children[i], this.transaction.parentSpanId))
|
|
66
78
|
}
|
|
67
|
-
processFn = makeDTNodeProcessor(this.transaction.agent.spans)
|
|
68
|
-
} else {
|
|
69
|
-
segments.push(this.root)
|
|
70
|
-
processFn = processNode
|
|
71
|
-
}
|
|
72
79
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
while (toProcess.length) {
|
|
81
|
+
var segmentInfo = toProcess.pop()
|
|
82
|
+
var segment = segmentInfo.segment
|
|
83
|
+
|
|
84
|
+
// Even though at some point we might want to stop adding events
|
|
85
|
+
// because all the priorities should be the same, we need to count
|
|
86
|
+
// the spans as seen.
|
|
87
|
+
spanAggregator.addSegment(segment, segmentInfo.parentId)
|
|
88
|
+
|
|
89
|
+
Array.prototype.push.apply(
|
|
90
|
+
toProcess,
|
|
91
|
+
segment.getChildren().map(child => new DTTraceNode(child, segment.id))
|
|
92
|
+
)
|
|
93
|
+
}
|
|
76
94
|
}
|
|
77
95
|
}
|
|
78
96
|
|
|
@@ -90,31 +108,6 @@ function _softEndSegment(segment) {
|
|
|
90
108
|
}
|
|
91
109
|
}
|
|
92
110
|
|
|
93
|
-
function makeDTNodeProcessor(spanAggregator) {
|
|
94
|
-
var addMoreSpans = true
|
|
95
|
-
return function processNodeDT(segmentInfo, segments) {
|
|
96
|
-
var segment = segmentInfo.segment
|
|
97
|
-
_softEndSegment(segment)
|
|
98
|
-
|
|
99
|
-
// This assumes that spans will have their transaction's priority. If insertion of
|
|
100
|
-
// one event fails, all following will fail due to having the same priority.
|
|
101
|
-
if (addMoreSpans && segment.name !== 'ROOT') {
|
|
102
|
-
addMoreSpans = spanAggregator.addSegment(segment, segmentInfo.parentId)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
var children = segment.getChildren()
|
|
106
|
-
Array.prototype.push.apply(
|
|
107
|
-
segments,
|
|
108
|
-
children.map(child => new DTTraceNode(child, segment.id))
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function processNode(segment, segments) {
|
|
114
|
-
_softEndSegment(segment)
|
|
115
|
-
Array.prototype.push.apply(segments, segment.getChildren())
|
|
116
|
-
}
|
|
117
|
-
|
|
118
111
|
/**
|
|
119
112
|
* Add a child to the list of segments.
|
|
120
113
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newrelic",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"author": "New Relic Node.js agent team <nodejs@newrelic.com>",
|
|
5
5
|
"licenses": [
|
|
6
6
|
{
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
],
|
|
97
97
|
"homepage": "http://github.com/newrelic/node-newrelic",
|
|
98
98
|
"engines": {
|
|
99
|
-
"node": ">=4.0.0",
|
|
99
|
+
"node": ">=4.0.0 <11.0.0",
|
|
100
100
|
"npm": ">=2.0.0"
|
|
101
101
|
},
|
|
102
102
|
"directories": {
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
"scripts": {
|
|
106
106
|
"bench": "node ./bin/run-bench.js",
|
|
107
107
|
"versioned-tests": "./bin/run-versioned-tests.sh",
|
|
108
|
+
"versioned": "./bin/run-versioned-tests.sh",
|
|
108
109
|
"test": "make test"
|
|
109
110
|
},
|
|
110
111
|
"bin": {
|
package/.npmignore
DELETED