newrelic 9.6.0 → 9.7.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.
Files changed (90) hide show
  1. package/NEWS.md +4 -0
  2. package/api.js +2 -0
  3. package/bin/test-naming-rules.js +1 -1
  4. package/esm-loader.mjs +1 -3
  5. package/lib/adaptive-sampler.js +1 -2
  6. package/lib/agent.js +2 -0
  7. package/lib/aggregators/event-aggregator.js +2 -2
  8. package/lib/attributes.js +2 -4
  9. package/lib/collector/api.js +20 -12
  10. package/lib/collector/facts.js +1 -3
  11. package/lib/collector/parse-response.js +3 -1
  12. package/lib/collector/remote-method.js +8 -9
  13. package/lib/config/attribute-filter.js +14 -16
  14. package/lib/config/default.js +17 -0
  15. package/lib/config/harvest-config-validator.js +3 -5
  16. package/lib/config/index.js +7 -4
  17. package/lib/environment.js +6 -5
  18. package/lib/errors/error-collector.js +6 -3
  19. package/lib/errors/helper.js +10 -18
  20. package/lib/errors/index.js +12 -6
  21. package/lib/grpc/connection.js +12 -5
  22. package/lib/header-attributes.js +4 -2
  23. package/lib/header-processing.js +2 -2
  24. package/lib/instrumentation/@hapi/hapi.js +2 -0
  25. package/lib/instrumentation/@node-redis/client.js +2 -0
  26. package/lib/instrumentation/amqplib.js +2 -0
  27. package/lib/instrumentation/core/async_hooks.js +2 -0
  28. package/lib/instrumentation/core/globals.js +11 -8
  29. package/lib/instrumentation/core/http-outbound.js +14 -12
  30. package/lib/instrumentation/core/http.js +10 -8
  31. package/lib/instrumentation/core/timers.js +2 -0
  32. package/lib/instrumentation/fastify.js +1 -3
  33. package/lib/instrumentation/grpc-js/grpc.js +14 -3
  34. package/lib/instrumentation/memcached.js +5 -0
  35. package/lib/instrumentation/mongodb/common.js +3 -0
  36. package/lib/instrumentation/mongodb/v2-mongo.js +6 -3
  37. package/lib/instrumentation/mongodb.js +1 -1
  38. package/lib/instrumentation/nr-winston-transport.js +3 -4
  39. package/lib/instrumentation/promise.js +7 -4
  40. package/lib/instrumentation/redis.js +2 -0
  41. package/lib/instrumentation/undici.js +2 -0
  42. package/lib/metrics/mapper.js +2 -3
  43. package/lib/metrics/metric-aggregator.js +1 -3
  44. package/lib/metrics/names.js +19 -15
  45. package/lib/metrics/normalizer/rule.js +6 -7
  46. package/lib/metrics/normalizer/tx_segment.js +3 -2
  47. package/lib/metrics/normalizer.js +5 -3
  48. package/lib/parse-proc-cpuinfo.js +11 -6
  49. package/lib/serverless/api-gateway.js +3 -4
  50. package/lib/serverless/aws-lambda.js +3 -3
  51. package/lib/shim/conglomerate-shim.js +2 -3
  52. package/lib/shim/datastore-shim.js +22 -104
  53. package/lib/shim/index.js +7 -0
  54. package/lib/shim/message-shim.js +2 -0
  55. package/lib/shim/promise-shim.js +48 -42
  56. package/lib/shim/shim.js +7 -7
  57. package/lib/shim/webframework-shim.js +2 -0
  58. package/lib/spans/map-to-streaming-type.js +0 -2
  59. package/lib/spans/span-context.js +2 -0
  60. package/lib/spans/span-event-aggregator.js +2 -2
  61. package/lib/spans/span-event.js +2 -2
  62. package/lib/spans/span-streamer.js +4 -0
  63. package/lib/spans/streaming-span-event-aggregator.js +2 -4
  64. package/lib/spans/streaming-span-event.js +3 -2
  65. package/lib/system-info.js +3 -5
  66. package/lib/timer.js +8 -6
  67. package/lib/transaction/dt-payload.js +4 -3
  68. package/lib/transaction/handle.js +12 -2
  69. package/lib/transaction/index.js +19 -18
  70. package/lib/transaction/name-state.js +17 -2
  71. package/lib/transaction/trace/aggregator.js +4 -12
  72. package/lib/transaction/trace/index.js +7 -5
  73. package/lib/transaction/trace/segment.js +6 -11
  74. package/lib/transaction/tracecontext.js +10 -6
  75. package/lib/transaction/tracer/index.js +23 -25
  76. package/lib/transaction/transaction-event-aggregator.js +1 -3
  77. package/lib/util/attribute-types.js +1 -2
  78. package/lib/util/byte-limit.js +1 -3
  79. package/lib/util/cat.js +16 -13
  80. package/lib/util/codec.js +0 -2
  81. package/lib/util/copy.js +1 -2
  82. package/lib/util/deep-equal.js +7 -0
  83. package/lib/util/flatten.js +4 -6
  84. package/lib/util/hashes.js +1 -3
  85. package/lib/util/process-version.js +2 -3
  86. package/lib/util/properties.js +2 -5
  87. package/lib/util/stream-sink.js +2 -0
  88. package/lib/util/urltils.js +4 -10
  89. package/newrelic.js +1 -1
  90. package/package.json +2 -1
package/lib/shim/index.js CHANGED
@@ -24,6 +24,13 @@ SHIM_TYPE_MAP[constants.MODULE_TYPE.PROMISE] = PromiseShim
24
24
  SHIM_TYPE_MAP[constants.MODULE_TYPE.TRANSACTION] = TransactionShim
25
25
  SHIM_TYPE_MAP[constants.MODULE_TYPE.WEB_FRAMEWORK] = WebFrameworkShim
26
26
 
27
+ /**
28
+ *
29
+ * @param type
30
+ * @param agent
31
+ * @param moduleName
32
+ * @param resolvedName
33
+ */
27
34
  function createShimFromType(type, agent, moduleName, resolvedName) {
28
35
  let shim = null
29
36
  if (properties.hasOwn(SHIM_TYPE_MAP, type)) {
@@ -5,6 +5,8 @@
5
5
 
6
6
  'use strict'
7
7
 
8
+ /* eslint sonarjs/cognitive-complexity: ["error", 72] -- TODO: https://issues.newrelic.com/browse/NEWRELIC-5252*/
9
+
8
10
  const copy = require('../util/copy')
9
11
  const genericRecorder = require('../metrics/recorders/generic')
10
12
  const logger = require('../logger').child({ component: 'MessageShim' })
@@ -5,6 +5,8 @@
5
5
 
6
6
  'use strict'
7
7
 
8
+ /* eslint sonarjs/cognitive-complexity: ["error", 30] -- TODO: https://issues.newrelic.com/browse/NEWRELIC-5252 */
9
+
8
10
  const logger = require('../logger').child({ component: 'PromiseShim' })
9
11
  const Shim = require('./shim')
10
12
  const symbols = require('../symbols')
@@ -12,7 +14,7 @@ const symbols = require('../symbols')
12
14
  /**
13
15
  * A helper class for wrapping promise modules.
14
16
  *
15
- * @extends Shim
17
+ * @augments Shim
16
18
  */
17
19
  /* eslint-disable camelcase */
18
20
  class PromiseShim extends Shim {
@@ -22,13 +24,10 @@ class PromiseShim extends Shim {
22
24
  *
23
25
  * @param {Agent} agent
24
26
  * The agent this shim will use.
25
- *
26
27
  * @param {string} moduleName
27
28
  * The name of the module being instrumented.
28
- *
29
29
  * @param {string} resolvedName
30
30
  * The full path to the loaded module.
31
- *
32
31
  * @see Shim
33
32
  */
34
33
  constructor(agent, moduleName, resolvedName) {
@@ -50,7 +49,7 @@ class PromiseShim extends Shim {
50
49
  /**
51
50
  * Sets the class used to identify promises from the wrapped promise library.
52
51
  *
53
- * @param {function} clss - The promise library's class.
52
+ * @param {Function} clss - The promise library's class.
54
53
  */
55
54
  setClass(clss) {
56
55
  this._class = clss
@@ -61,10 +60,8 @@ class PromiseShim extends Shim {
61
60
  * library being wrapped.
62
61
  *
63
62
  * @param {*} obj - The object to check the instance type of.
64
- *
65
- * @return {bool} True if the provided object is an instance of a promise from
63
+ * @returns {bool} True if the provided object is an instance of a promise from
66
64
  * this promise library.
67
- *
68
65
  * @see PromiseShim#setClass
69
66
  */
70
67
  isPromiseInstance(obj) {
@@ -83,16 +80,13 @@ class PromiseShim extends Shim {
83
80
  * better to wrap that using {@link PromiseShim#wrapExecutorCaller} than to
84
81
  * use this method.
85
82
  *
86
- * @param {object|function} nodule
83
+ * @param {object | Function} nodule
87
84
  * The source of the properties to wrap, or a single function to wrap.
88
- *
89
- * @param {string|array.<string>} [properties]
85
+ * @param {string | Array.<string>} [properties]
90
86
  * One or more properties to wrap. If omitted, the `nodule` parameter is
91
87
  * assumed to be the constructor to wrap.
92
- *
93
- * @return {object|function} The first parameter to this function, after
88
+ * @returns {object | Function} The first parameter to this function, after
94
89
  * wrapping it or its properties.
95
- *
96
90
  * @see PromiseShim#wrapExecutorCaller
97
91
  */
98
92
  wrapConstructor(nodule, properties) {
@@ -136,16 +130,13 @@ class PromiseShim extends Shim {
136
130
  * Wrapping the executor caller method directly is preferable to wrapping
137
131
  * the constructor of the promise class.
138
132
  *
139
- * @param {object|function} nodule
133
+ * @param {object | Function} nodule
140
134
  * The source of the properties to wrap, or a single function to wrap.
141
- *
142
- * @param {string|array.<string>} [properties]
135
+ * @param {string | Array.<string>} [properties]
143
136
  * One or more properties to wrap. If omitted, the `nodule` parameter is
144
137
  * assumed to be the function to wrap.
145
- *
146
- * @return {object|function} The first parameter to this function, after
138
+ * @returns {object | Function} The first parameter to this function, after
147
139
  * wrapping it or its properties.
148
- *
149
140
  * @see PromiseShim#wrapConstructor
150
141
  */
151
142
  wrapExecutorCaller(nodule, properties) {
@@ -197,14 +188,12 @@ class PromiseShim extends Shim {
197
188
  * and Bluebird's `Promise.delay`. These are static methods which accept some
198
189
  * arbitrary value and return a Promise instance.
199
190
  *
200
- * @param {object|function} nodule
191
+ * @param {object | Function} nodule
201
192
  * The source of the properties to wrap, or a single function to wrap.
202
- *
203
- * @param {string|array.<string>} [properties]
193
+ * @param {string | Array.<string>} [properties]
204
194
  * One or more properties to wrap. If omitted, the `nodule` parameter is
205
195
  * assumed to be the function to wrap.
206
- *
207
- * @return {object|function} The first parameter to this function, after
196
+ * @returns {object | Function} The first parameter to this function, after
208
197
  * wrapping it or its properties.
209
198
  */
210
199
  wrapCast(nodule, properties) {
@@ -236,16 +225,13 @@ class PromiseShim extends Shim {
236
225
  * and Bluebird's `Promise#map`. These are methods which take a function to
237
226
  * execute once the promise resolves and hands back a new promise.
238
227
  *
239
- * @param {object|function} nodule
228
+ * @param {object | Function} nodule
240
229
  * The source of the properties to wrap, or a single function to wrap.
241
- *
242
- * @param {string|array.<string>} [properties]
230
+ * @param {string | Array.<string>} [properties]
243
231
  * One or more properties to wrap. If omitted, the `nodule` parameter is
244
232
  * assumed to be the function to wrap.
245
- *
246
- * @return {object|function} The first parameter to this function, after
233
+ * @returns {object | Function} The first parameter to this function, after
247
234
  * wrapping it or its properties.
248
- *
249
235
  * @see PromiseShim#setClass
250
236
  * @see PromiseShim#wrapCatch
251
237
  */
@@ -266,16 +252,13 @@ class PromiseShim extends Shim {
266
252
  * an additional argument to `Promise#catch` which is usually an error class
267
253
  * to filter rejections by. This wrap method will handle that case.
268
254
  *
269
- * @param {object|function} nodule
255
+ * @param {object | Function} nodule
270
256
  * The source of the properties to wrap, or a single function to wrap.
271
- *
272
- * @param {string|array.<string>} [properties]
257
+ * @param {string | Array.<string>} [properties]
273
258
  * One or more properties to wrap. If omitted, the `nodule` parameter is
274
259
  * assumed to be the function to wrap.
275
- *
276
- * @return {object|function} The first parameter to this function, after
260
+ * @returns {object | Function} The first parameter to this function, after
277
261
  * wrapping it or its properties.
278
- *
279
262
  * @see PromiseShim#setClass
280
263
  * @see PromiseShim#wrapThen
281
264
  */
@@ -289,14 +272,12 @@ class PromiseShim extends Shim {
289
272
  * - `wrapPromisify(nodule, properties)`
290
273
  * - `wrapPromisify(func)`
291
274
  *
292
- * @param {object|function} nodule
275
+ * @param {object | Function} nodule
293
276
  * The source of the properties to wrap, or a single function to wrap.
294
- *
295
- * @param {string|array.<string>} [properties]
277
+ * @param {string | Array.<string>} [properties]
296
278
  * One or more properties to wrap. If omitted, the `nodule` parameter is
297
279
  * assumed to be the function to wrap.
298
- *
299
- * @return {object|function} The first parameter to this function, after
280
+ * @returns {object | Function} The first parameter to this function, after
300
281
  * wrapping it or its properties.
301
282
  */
302
283
  wrapPromisify(nodule, properties) {
@@ -316,6 +297,9 @@ class PromiseShim extends Shim {
316
297
  })
317
298
 
318
299
  return __NR_wrappedPromisified
300
+ /**
301
+ *
302
+ */
319
303
  function __NR_wrappedPromisified() {
320
304
  const segment = shim.getActiveSegment()
321
305
  if (!segment) {
@@ -335,6 +319,8 @@ module.exports = PromiseShim
335
319
  // -------------------------------------------------------------------------- //
336
320
 
337
321
  /**
322
+ * @param shim
323
+ * @param args
338
324
  * @private
339
325
  */
340
326
  function _wrapExecutorContext(shim, args) {
@@ -347,6 +333,11 @@ function _wrapExecutorContext(shim, args) {
347
333
  contextExporter[symbols.executorContext] = context
348
334
  args[0] = contextExporter
349
335
 
336
+ /**
337
+ *
338
+ * @param resolve
339
+ * @param reject
340
+ */
350
341
  function contextExporter(resolve, reject) {
351
342
  context.self = this
352
343
  context.args = shim.argsToArray.apply(shim, arguments)
@@ -356,6 +347,8 @@ function _wrapExecutorContext(shim, args) {
356
347
  }
357
348
 
358
349
  /**
350
+ * @param context
351
+ * @param fn
359
352
  * @private
360
353
  */
361
354
  function _wrapResolver(context, fn) {
@@ -369,6 +362,10 @@ function _wrapResolver(context, fn) {
369
362
  }
370
363
 
371
364
  /**
365
+ * @param shim
366
+ * @param fn
367
+ * @param name
368
+ * @param useAllParams
372
369
  * @private
373
370
  */
374
371
  function _wrapThen(shim, fn, name, useAllParams) {
@@ -399,6 +396,12 @@ function _wrapThen(shim, fn, name, useAllParams) {
399
396
  }
400
397
  return next
401
398
 
399
+ /**
400
+ *
401
+ * @param handler
402
+ * @param i
403
+ * @param length
404
+ */
402
405
  function wrapHandler(handler, i, length) {
403
406
  if (
404
407
  !shim.isFunction(handler) || // Not a function
@@ -566,6 +569,9 @@ class Contextualizer {
566
569
  }
567
570
  )
568
571
 
572
+ /**
573
+ *
574
+ */
569
575
  function __NR_continueContext() {
570
576
  self.setSegment(nextContext.getSegment())
571
577
  }
package/lib/shim/shim.js CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  'use strict'
7
7
 
8
+ /* eslint sonarjs/cognitive-complexity: ["error", 59] -- TODO: https://issues.newrelic.com/browse/NEWRELIC-5252 */
9
+
8
10
  const arity = require('../util/arity')
9
11
  const hasOwnProperty = require('../util/properties').hasOwn
10
12
  const logger = require('../logger').child({ component: 'Shim' })
@@ -348,7 +350,7 @@ Shim.prototype[symbols.unwrap] = unwrapAll
348
350
  * segment = shim.createSegment(seg.name, seg.recorder, seg.parent)
349
351
  * }
350
352
  * ```
351
- * @property {object.<string, *>} $cache
353
+ * @property {Object<string, *>} $cache
352
354
  * Adds the value as an extra parameter to all specs in the same context as the
353
355
  * cache. If the current context is a function, the cache will be recreated on
354
356
  * each invocation of the function. This value can be useful for passing a
@@ -466,7 +468,7 @@ function execute(nodule, spec) {
466
468
  if (this.isFunction(spec)) {
467
469
  spec(this, nodule)
468
470
  } else {
469
- _specToFunction(spec)(this, nodule)
471
+ _specToFunction(spec)
470
472
  }
471
473
  }
472
474
 
@@ -595,7 +597,7 @@ function wrapReturn(nodule, properties, spec, args) {
595
597
  properties = null
596
598
  }
597
599
  if (!this.isFunction(spec)) {
598
- spec = _specToFunction(spec)
600
+ _specToFunction(spec)
599
601
  }
600
602
  if (!this.isArray(args)) {
601
603
  args = []
@@ -1105,7 +1107,7 @@ function bindSegment(nodule, property, segment, full) {
1105
1107
  return nodule
1106
1108
  }
1107
1109
 
1108
- const wrapped = this.wrap(nodule, property, function wrapFunc(shim, func) {
1110
+ return this.wrap(nodule, property, function wrapFunc(shim, func) {
1109
1111
  if (!shim.isFunction(func)) {
1110
1112
  return func
1111
1113
  }
@@ -1120,8 +1122,6 @@ function bindSegment(nodule, property, segment, full) {
1120
1122
  shim.storeSegment(binder, segment)
1121
1123
  return binder
1122
1124
  })
1123
-
1124
- return wrapped
1125
1125
  }
1126
1126
 
1127
1127
  /**
@@ -1300,7 +1300,7 @@ function applySegment(func, segment, full, context, args, inContextCB) {
1300
1300
  const contextManager = this._contextManager
1301
1301
  const prevSegment = contextManager.getContext()
1302
1302
 
1303
- return contextManager.runInContext(segment, () => {
1303
+ return contextManager.runInContext(segment, function runInContextCb() {
1304
1304
  if (full) {
1305
1305
  segment.start()
1306
1306
  }
@@ -5,6 +5,8 @@
5
5
 
6
6
  'use strict'
7
7
 
8
+ /* eslint sonarjs/cognitive-complexity: ["error", 69] -- TODO: https://issues.newrelic.com/browse/NEWRELIC-5252 */
9
+
8
10
  const genericRecorder = require('../metrics/recorders/generic')
9
11
  const logger = require('../logger.js').child({ component: 'WebFrameworkShim' })
10
12
  const metrics = require('../metrics/names')
@@ -42,8 +42,6 @@ function mapToStreamingType(value) {
42
42
  [protoTypeString]: value
43
43
  }
44
44
  }
45
-
46
- return
47
45
  }
48
46
 
49
47
  module.exports = mapToStreamingType
@@ -40,6 +40,8 @@ class SpanContext {
40
40
  * ends with an ignored error status code.
41
41
  *
42
42
  * Last error wins.
43
+ *
44
+ * @param details
43
45
  */
44
46
  setError(details) {
45
47
  this.hasError = true
@@ -63,8 +63,8 @@ class SpanEventAggregator extends EventAggregator {
63
63
  *
64
64
  * @param {TraceSegment} segment - The segment to add.
65
65
  * @param {string} [parentId=null] - The GUID of the parent span.
66
- *
67
- * @return {boolean} True if the segment was added, or false if it was discarded.
66
+ * @param isRoot
67
+ * @returns {boolean} True if the segment was added, or false if it was discarded.
68
68
  */
69
69
  addSegment(segment, parentId, isRoot) {
70
70
  // Check if the priority would be accepted before creating the event object.
@@ -83,8 +83,8 @@ class SpanEvent {
83
83
  *
84
84
  * @param {TraceSegment} segment - The segment to turn into a span event.
85
85
  * @param {?string} [parentId=null] - The ID of the segment's parent.
86
- *
87
- * @return {SpanEvent} The constructed event.
86
+ * @param isRoot
87
+ * @returns {SpanEvent} The constructed event.
88
88
  */
89
89
  static fromSegment(segment, parentId = null, isRoot = false) {
90
90
  const spanContext = segment.getSpanContext()
@@ -83,6 +83,8 @@ class SpanStreamer {
83
83
  * Sends the span over the stream. Spans are only sent here if the stream is
84
84
  * in a writable state. If the stream becomes unwritable after sending the
85
85
  * span, a drain event handler is setup to continue writing when possible.
86
+ *
87
+ * @param span
86
88
  */
87
89
  send(span) {
88
90
  // false indicates the stream has reached the highWaterMark
@@ -104,6 +106,8 @@ class SpanStreamer {
104
106
  * initially blocked, used to time how long the stream was blocked. If this
105
107
  * is not defined, it is assumed this is being called after a reconnect,
106
108
  * and the metric is not used.
109
+ *
110
+ * @param waitDrainStart
107
111
  */
108
112
  drain(waitDrainStart) {
109
113
  // Metric can be used to see how frequently completing drains as well as
@@ -60,8 +60,6 @@ class StreamingSpanEventAggregator extends Aggregator {
60
60
  }
61
61
 
62
62
  this.emit(`finished ${this.method} data send.`)
63
-
64
- return
65
63
  }
66
64
 
67
65
  /**
@@ -78,8 +76,8 @@ class StreamingSpanEventAggregator extends Aggregator {
78
76
  *
79
77
  * @param {TraceSegment} segment - The segment to add.
80
78
  * @param {string} [parentId=null] - The GUID of the parent span.
81
- *
82
- * @return {bool} True if the segment was added, or false if it was discarded.
79
+ * @param isRoot
80
+ * @returns {bool} True if the segment was added, or false if it was discarded.
83
81
  */
84
82
  addSegment(segment, parentId, isRoot) {
85
83
  if (!this.started) {
@@ -61,6 +61,7 @@ class StreamingSpanEvent {
61
61
 
62
62
  /**
63
63
  * Add a key/value pair to the Span's custom/user attributes collection.
64
+ *
64
65
  * @param {string} key Name of the attribute to be stored.
65
66
  * @param {string|boolean|number} value Value of the attribute to be stored.
66
67
  * @param {boolean} [truncateExempt=false] Set to true if attribute should not be truncated.
@@ -75,6 +76,7 @@ class StreamingSpanEvent {
75
76
 
76
77
  /**
77
78
  * Add a key/value pair to the Span's agent attributes collection.
79
+ *
78
80
  * @param {string} key Name of the attribute to be stored.
79
81
  * @param {string|boolean|number} value Value of the attribute to be stored.
80
82
  * @param {boolean} [truncateExempt=false] Set to true if attribute should not be truncated.
@@ -95,13 +97,12 @@ class StreamingSpanEvent {
95
97
 
96
98
  toStreamingFormat() {
97
99
  // Attributes are pre-formatted.
98
- const formatted = {
100
+ return {
99
101
  trace_id: this._traceId,
100
102
  intrinsics: this._intrinsicAttributes,
101
103
  user_attributes: this._customAttributes,
102
104
  agent_attributes: this._agentAttributes
103
105
  }
104
- return formatted
105
106
  }
106
107
 
107
108
  static fromSegment(segment, parentId = null, isRoot = false) {
@@ -5,6 +5,8 @@
5
5
 
6
6
  'use strict'
7
7
 
8
+ /* eslint sonarjs/cognitive-complexity: ["error", 29] -- TODO: https://issues.newrelic.com/browse/NEWRELIC-5252 */
9
+
8
10
  const exec = require('child_process').exec
9
11
  const readProc = require('./utilization/common').readProc
10
12
  const getBootId = require('./utilization/docker-info').getBootId
@@ -173,11 +175,7 @@ module.exports._getMemoryStats = function getMemoryStats(callback) {
173
175
  }
174
176
 
175
177
  function getKernelVersion(callback) {
176
- if (platform.match(/darwin/i)) {
177
- getSysctlValue(['kern.version'], function getMem(version) {
178
- callback(version)
179
- })
180
- } else if (platform.match(/bsd/i)) {
178
+ if (platform.match(/darwin/i) || platform.match(/bsd/i)) {
181
179
  getSysctlValue(['kern.version'], function getMem(version) {
182
180
  callback(version)
183
181
  })
package/lib/timer.js CHANGED
@@ -6,7 +6,7 @@
6
6
  'use strict'
7
7
 
8
8
  /**
9
-
9
+
10
10
  * Explicit enumeration of the states a transaction can be in:
11
11
  *
12
12
  * PENDING upon instantiation (implicitly, no start time set)
@@ -106,21 +106,21 @@ Timer.prototype.softEnd = function softEnd() {
106
106
  }
107
107
 
108
108
  /**
109
- * @return {bool} Is this timer currently running?
109
+ * @returns {bool} Is this timer currently running?
110
110
  */
111
111
  Timer.prototype.isRunning = function isRunning() {
112
112
  return this.state === RUNNING
113
113
  }
114
114
 
115
115
  /**
116
- * @return {bool} Is this timer still alive?
116
+ * @returns {bool} Is this timer still alive?
117
117
  */
118
118
  Timer.prototype.isActive = function isActive() {
119
119
  return this.state < STOPPED
120
120
  }
121
121
 
122
122
  /**
123
- * @return {bool} Has the timer been touched or ended?
123
+ * @returns {bool} Has the timer been touched or ended?
124
124
  */
125
125
  Timer.prototype.hasEnd = function hasEnd() {
126
126
  return !!this.hrDuration
@@ -192,7 +192,7 @@ Timer.prototype.getDurationInMillis = function getDurationInMillis() {
192
192
  /**
193
193
  * Get a single object containing the interval this timer was active.
194
194
  *
195
- * @return {Array} 2-tuple of start time in milliseconds, end time in
195
+ * @returns {Array} 2-tuple of start time in milliseconds, end time in
196
196
  * milliseconds.
197
197
  */
198
198
  Timer.prototype.toRange = function toRange() {
@@ -205,7 +205,7 @@ Timer.prototype.toRange = function toRange() {
205
205
  * milliseconds since start.
206
206
  *
207
207
  * @param {Timer} other The point relative to which this timer started.
208
- * @return {number} The offset in (floating-point) milliseconds.
208
+ * @returns {number} The offset in (floating-point) milliseconds.
209
209
  */
210
210
  Timer.prototype.startedRelativeTo = function startedRelativeTo(other) {
211
211
  if (this.hrstart && other.hrstart) {
@@ -220,6 +220,8 @@ Timer.prototype.startedRelativeTo = function startedRelativeTo(other) {
220
220
 
221
221
  /**
222
222
  * Returns true if this timer ends after the other.
223
+ *
224
+ * @param other
223
225
  */
224
226
  Timer.prototype.endsAfter = function compare(other) {
225
227
  return this.getDurationInMillis() + this.start > other.getDurationInMillis() + other.start
@@ -15,7 +15,8 @@ module.exports = class DistributedTracePayload {
15
15
  * The class responsible for producing distributed trace payloads.
16
16
  * Created by calling {@link TransactionHandle#_createDistributedTracePayload}.
17
17
  *
18
- * @constructor
18
+ * @param payload
19
+ * @class
19
20
  */
20
21
  constructor(payload) {
21
22
  logger.trace('DistributedTracePayload created with %s', payload)
@@ -27,7 +28,7 @@ module.exports = class DistributedTracePayload {
27
28
  }
28
29
 
29
30
  /**
30
- * @returns {String} The base64 encoded JSON representation of the
31
+ * @returns {string} The base64 encoded JSON representation of the
31
32
  * distributed trace payload.
32
33
  */
33
34
  text() {
@@ -38,7 +39,7 @@ module.exports = class DistributedTracePayload {
38
39
  /**
39
40
  * Construct a payload suitable for HTTP transport.
40
41
  *
41
- * @returns {String} The base64 encoded JSON representation of the
42
+ * @returns {string} The base64 encoded JSON representation of the
42
43
  * distributed trace payload.
43
44
  */
44
45
  httpSafe() {
@@ -14,7 +14,9 @@ class TransactionHandle {
14
14
  * A light representation of a transaction instance, returned by calling
15
15
  * {@link API#getTransaction}.
16
16
  *
17
- * @constructor
17
+ * @param transaction
18
+ * @param metrics
19
+ * @class
18
20
  */
19
21
  constructor(transaction, metrics) {
20
22
  this._transaction = transaction
@@ -54,7 +56,9 @@ class TransactionHandle {
54
56
  * Parsing incoming headers for use in a distributed trace.
55
57
  * W3C TraceContext format is preferred over the NewRelic DT format.
56
58
  * NewRelic DT format will be used if no `traceparent` header is found.
59
+ *
57
60
  * @param @param {string} [transportType='Unknown'] - The transport type that delivered the trace.
61
+ * @param transportType
58
62
  * @param {object} headers - Headers to search for supported formats. Keys must be lowercase.
59
63
  */
60
64
  acceptDistributedTraceHeaders(transportType, headers) {
@@ -64,7 +68,8 @@ class TransactionHandle {
64
68
 
65
69
  /**
66
70
  * Inserts distributed trace headers into the provided headers map.
67
- * @param {Object} headers
71
+ *
72
+ * @param {object} headers
68
73
  */
69
74
  insertDistributedTraceHeaders(headers) {
70
75
  incrementApiSupportMetric(this._metrics, 'insertDistributedTraceHeaders')
@@ -74,6 +79,11 @@ class TransactionHandle {
74
79
 
75
80
  module.exports = TransactionHandle
76
81
 
82
+ /**
83
+ *
84
+ * @param metrics
85
+ * @param functionName
86
+ */
77
87
  function incrementApiSupportMetric(metrics, functionName) {
78
88
  if (!metrics) {
79
89
  logger.warnOnce(