newrelic 5.6.1 → 5.6.2
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 +15 -0
- package/api.js +27 -3
- package/lib/attributes.js +1 -12
- package/lib/collector/facts.js +6 -1
- package/lib/transaction/trace/index.js +10 -5
- package/lib/util/attribute-types.js +21 -0
- package/package.json +1 -1
package/NEWS.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
### 5.6.2 (2019-03-25):
|
|
2
|
+
|
|
3
|
+
* Agent now respects attribute type restrictions on trace/segment attributes, as
|
|
4
|
+
well as error event/trace attributes.
|
|
5
|
+
|
|
6
|
+
* Fixes potential for `RangeError: Maximum call stack size exceeded` error on
|
|
7
|
+
Transaction/Trace end.
|
|
8
|
+
|
|
9
|
+
* Custom events no longer accept attributes with invalid types.
|
|
10
|
+
|
|
11
|
+
The only attribute types accepted by the backend are `boolean`, `string`, and
|
|
12
|
+
`number`; any attribute assigned to a custom event outside these types would be
|
|
13
|
+
dropped on ingest. The agent now filters these attributes out, and logs out a
|
|
14
|
+
helpful message detailing the issue.
|
|
15
|
+
|
|
1
16
|
### 5.6.1 (2019-03-11):
|
|
2
17
|
|
|
3
18
|
* Updated log message for not adding attributes and change the log level to debug.
|
package/api.js
CHANGED
|
@@ -9,6 +9,7 @@ const hashes = require('./lib/util/hashes')
|
|
|
9
9
|
const properties = require('./lib/util/properties')
|
|
10
10
|
const stringify = require('json-stringify-safe')
|
|
11
11
|
const shimmer = require('./lib/shimmer')
|
|
12
|
+
const isValidType = require('./lib/util/attribute-types')
|
|
12
13
|
const TransactionShim = require('./lib/shim/transaction-shim')
|
|
13
14
|
const TransactionHandle = require('./lib/transaction/handle')
|
|
14
15
|
const AwsLambda = require('./lib/serverless/aws-lambda')
|
|
@@ -16,7 +17,6 @@ const AwsLambda = require('./lib/serverless/aws-lambda')
|
|
|
16
17
|
const ATTR_DEST = require('./lib/config/attribute-filter').DESTINATIONS
|
|
17
18
|
const MODULE_TYPE = require('./lib/shim/constants').MODULE_TYPE
|
|
18
19
|
const NAMES = require('./lib/metrics/names')
|
|
19
|
-
|
|
20
20
|
/*
|
|
21
21
|
*
|
|
22
22
|
* CONSTANTS
|
|
@@ -365,7 +365,13 @@ API.prototype.noticeError = function noticeError(error, customAttributes) {
|
|
|
365
365
|
}
|
|
366
366
|
const transaction = this.agent.tracer.getTransaction()
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
// Filter all object type valued attributes out
|
|
369
|
+
let filteredAttributes = customAttributes
|
|
370
|
+
if (customAttributes) {
|
|
371
|
+
filteredAttributes = _filterAttributes(customAttributes, 'noticeError')
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
this.agent.errors.addUserError(transaction, error, filteredAttributes)
|
|
369
375
|
}
|
|
370
376
|
|
|
371
377
|
/**
|
|
@@ -1067,6 +1073,9 @@ API.prototype.recordCustomEvent = function recordCustomEvent(eventType, attribut
|
|
|
1067
1073
|
return
|
|
1068
1074
|
}
|
|
1069
1075
|
|
|
1076
|
+
// Filter all object type valued attributes out
|
|
1077
|
+
const filteredAttributes = _filterAttributes(attributes, `${eventType} custom event`)
|
|
1078
|
+
|
|
1070
1079
|
var instrinics = {
|
|
1071
1080
|
type: eventType,
|
|
1072
1081
|
timestamp: Date.now()
|
|
@@ -1074,7 +1083,7 @@ API.prototype.recordCustomEvent = function recordCustomEvent(eventType, attribut
|
|
|
1074
1083
|
|
|
1075
1084
|
var tx = this.agent.getTransaction()
|
|
1076
1085
|
var priority = tx && tx.priority || Math.random()
|
|
1077
|
-
this.agent.customEvents.add([instrinics,
|
|
1086
|
+
this.agent.customEvents.add([instrinics, filteredAttributes], priority)
|
|
1078
1087
|
}
|
|
1079
1088
|
|
|
1080
1089
|
/**
|
|
@@ -1390,4 +1399,19 @@ API.prototype.setLambdaHandler = function setLambdaHandler(handler) {
|
|
|
1390
1399
|
return this.awsLambda.patchLambdaHandler(handler)
|
|
1391
1400
|
}
|
|
1392
1401
|
|
|
1402
|
+
function _filterAttributes(attributes, name) {
|
|
1403
|
+
const filteredAttributes = Object.create(null)
|
|
1404
|
+
Object.keys(attributes).forEach((attributeKey) => {
|
|
1405
|
+
if (!isValidType(attributes[attributeKey])) {
|
|
1406
|
+
logger.info(
|
|
1407
|
+
`Omitting attribute ${attributeKey} from ${name} call, type must ` +
|
|
1408
|
+
'be boolean, number, or string'
|
|
1409
|
+
)
|
|
1410
|
+
return
|
|
1411
|
+
}
|
|
1412
|
+
filteredAttributes[attributeKey] = attributes[attributeKey]
|
|
1413
|
+
})
|
|
1414
|
+
return filteredAttributes
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1393
1417
|
module.exports = API
|
package/lib/attributes.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const Config = require('./config')
|
|
4
4
|
const logger = require('./logger').child({component: 'attributes'})
|
|
5
|
+
const isValidType = require('./util/attribute-types')
|
|
5
6
|
const byteUtils = require('./util/byte-limit')
|
|
6
7
|
const properties = require('./util/properties')
|
|
7
8
|
|
|
@@ -141,18 +142,6 @@ class Attributes {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
/**
|
|
145
|
-
* Checks incoming attribute value against valid types:
|
|
146
|
-
* string, number, & boolean.
|
|
147
|
-
*
|
|
148
|
-
* @param {*} val
|
|
149
|
-
*
|
|
150
|
-
* @return {boolean}
|
|
151
|
-
*/
|
|
152
|
-
function isValidType(val) {
|
|
153
|
-
return typeof val !== 'object' && val !== undefined
|
|
154
|
-
}
|
|
155
|
-
|
|
156
145
|
/**
|
|
157
146
|
* Creates a filter function for the given scope.
|
|
158
147
|
*
|
package/lib/collector/facts.js
CHANGED
|
@@ -88,8 +88,13 @@ function getAllIPAddresses() {
|
|
|
88
88
|
const interfaceAddresses = interfaces[key].map(function getAddress(inter) {
|
|
89
89
|
return inter.address
|
|
90
90
|
})
|
|
91
|
-
|
|
91
|
+
|
|
92
|
+
for (let index = 0; index < interfaceAddresses.length; index++) {
|
|
93
|
+
const address = interfaceAddresses[index]
|
|
94
|
+
addresses.push(address)
|
|
95
|
+
}
|
|
92
96
|
}
|
|
97
|
+
|
|
93
98
|
return addresses
|
|
94
99
|
}, [])
|
|
95
100
|
}
|
|
@@ -55,7 +55,11 @@ Trace.prototype.end = function end() {
|
|
|
55
55
|
while (segments.length) {
|
|
56
56
|
const segment = segments.pop()
|
|
57
57
|
segment.finalize()
|
|
58
|
-
|
|
58
|
+
|
|
59
|
+
const children = segment.getChildren()
|
|
60
|
+
for (let i = 0; i < children.length; ++i) {
|
|
61
|
+
segments.push(children[i])
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
|
|
@@ -87,10 +91,11 @@ Trace.prototype.generateSpanEvents = function generateSpanEvents() {
|
|
|
87
91
|
// the spans as seen.
|
|
88
92
|
spanAggregator.addSegment(segment, segmentInfo.parentId)
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
const nodes = segment.getChildren()
|
|
95
|
+
for (let i = 0; i < nodes.length; ++i) {
|
|
96
|
+
const node = new DTTraceNode(nodes[i], segment.id)
|
|
97
|
+
toProcess.push(node)
|
|
98
|
+
}
|
|
94
99
|
}
|
|
95
100
|
}
|
|
96
101
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const VALID_ATTR_TYPES = new Set([
|
|
4
|
+
'string',
|
|
5
|
+
'number',
|
|
6
|
+
'boolean'
|
|
7
|
+
])
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Checks incoming attribute value against valid types:
|
|
11
|
+
* string, number, & boolean.
|
|
12
|
+
*
|
|
13
|
+
* @param {*} val
|
|
14
|
+
*
|
|
15
|
+
* @return {boolean}
|
|
16
|
+
*/
|
|
17
|
+
function isValidType(val) {
|
|
18
|
+
return VALID_ATTR_TYPES.has(typeof val)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = isValidType
|