newrelic 8.3.0 → 8.5.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.
Files changed (134) hide show
  1. package/NEWS.md +76 -0
  2. package/README.md +7 -6
  3. package/THIRD_PARTY_NOTICES.md +95 -35
  4. package/api.js +74 -68
  5. package/bin/test-naming-rules.js +22 -22
  6. package/lib/agent.js +4 -4
  7. package/lib/attributes.js +2 -2
  8. package/lib/collector/api.js +12 -12
  9. package/lib/collector/facts.js +1 -1
  10. package/lib/collector/http-agents.js +12 -11
  11. package/lib/collector/key-parser.js +1 -1
  12. package/lib/collector/remote-method.js +27 -26
  13. package/lib/config/attribute-filter.js +23 -23
  14. package/lib/config/default.js +12 -10
  15. package/lib/config/hsm.js +1 -1
  16. package/lib/config/index.js +82 -66
  17. package/lib/config/lasp.js +3 -3
  18. package/lib/config/merge-server-config.js +1 -1
  19. package/lib/db/parse-sql.js +8 -8
  20. package/lib/db/parsed-statement.js +9 -8
  21. package/lib/db/query-parsers/sql.js +7 -7
  22. package/lib/db/query-sample.js +9 -9
  23. package/lib/db/query-trace-aggregator.js +4 -4
  24. package/lib/db/statement-matcher.js +5 -5
  25. package/lib/db/utils.js +1 -1
  26. package/lib/environment.js +43 -43
  27. package/lib/errors/error-collector.js +2 -2
  28. package/lib/errors/error-trace-aggregator.js +1 -1
  29. package/lib/errors/helper.js +3 -3
  30. package/lib/errors/index.js +17 -17
  31. package/lib/feature_flags.js +7 -5
  32. package/lib/header-attributes.js +6 -6
  33. package/lib/header-processing.js +1 -1
  34. package/lib/instrumentation/amqplib.js +26 -26
  35. package/lib/instrumentation/bluebird.js +3 -3
  36. package/lib/instrumentation/cassandra-driver.js +7 -3
  37. package/lib/instrumentation/connect.js +4 -4
  38. package/lib/instrumentation/core/async_hooks.js +6 -6
  39. package/lib/instrumentation/core/domain.js +2 -2
  40. package/lib/instrumentation/core/globals.js +1 -1
  41. package/lib/instrumentation/core/http-outbound.js +15 -84
  42. package/lib/instrumentation/core/http.js +34 -67
  43. package/lib/instrumentation/core/inspector.js +2 -2
  44. package/lib/instrumentation/core/timers.js +7 -7
  45. package/lib/instrumentation/core/zlib.js +2 -2
  46. package/lib/instrumentation/director.js +4 -4
  47. package/lib/instrumentation/express.js +8 -8
  48. package/lib/instrumentation/fastify/spec-builders.js +57 -47
  49. package/lib/instrumentation/fastify.js +85 -24
  50. package/lib/instrumentation/generic-pool.js +1 -1
  51. package/lib/instrumentation/hapi/hapi-17.js +11 -11
  52. package/lib/instrumentation/hapi/shared.js +1 -1
  53. package/lib/instrumentation/hapi.js +22 -22
  54. package/lib/instrumentation/ioredis.js +7 -7
  55. package/lib/instrumentation/memcached.js +7 -7
  56. package/lib/instrumentation/mongodb/common.js +16 -5
  57. package/lib/instrumentation/mysql.js +19 -19
  58. package/lib/instrumentation/oracle.js +15 -15
  59. package/lib/instrumentation/pg.js +4 -4
  60. package/lib/instrumentation/promise.js +46 -46
  61. package/lib/instrumentation/q.js +2 -2
  62. package/lib/instrumentation/redis.js +11 -11
  63. package/lib/instrumentation/restify.js +1 -1
  64. package/lib/instrumentation/undici.js +242 -0
  65. package/lib/instrumentation/vision.js +4 -4
  66. package/lib/instrumentation/when.js +3 -3
  67. package/lib/instrumentations.js +2 -1
  68. package/lib/logger.js +5 -5
  69. package/lib/metrics/index.js +15 -15
  70. package/lib/metrics/mapper.js +7 -7
  71. package/lib/metrics/normalizer/rule.js +9 -9
  72. package/lib/metrics/normalizer/tx_segment.js +17 -17
  73. package/lib/metrics/normalizer.js +22 -22
  74. package/lib/metrics/recorders/custom.js +5 -5
  75. package/lib/metrics/recorders/generic.js +3 -3
  76. package/lib/metrics/recorders/http.js +7 -7
  77. package/lib/metrics/recorders/http_external.js +7 -7
  78. package/lib/metrics/recorders/message-transaction.js +5 -6
  79. package/lib/metrics/recorders/other.js +5 -5
  80. package/lib/parse-proc-cpuinfo.js +25 -19
  81. package/lib/parse-proc-meminfo.js +8 -2
  82. package/lib/prioritized-attributes.js +2 -2
  83. package/lib/priority-queue.js +10 -10
  84. package/lib/reservoir.js +3 -3
  85. package/lib/sampler.js +26 -26
  86. package/lib/serverless/aws-lambda.js +8 -2
  87. package/lib/shim/datastore-shim.js +35 -32
  88. package/lib/shim/index.js +2 -2
  89. package/lib/shim/message-shim.js +47 -47
  90. package/lib/shim/promise-shim.js +1 -1
  91. package/lib/shim/shim.js +61 -61
  92. package/lib/shim/specs/index.js +3 -3
  93. package/lib/shim/transaction-shim.js +44 -192
  94. package/lib/shim/webframework-shim.js +52 -52
  95. package/lib/spans/span-event.js +1 -1
  96. package/lib/spans/streaming-span-attributes.js +1 -1
  97. package/lib/stats/apdex.js +2 -2
  98. package/lib/stats/index.js +2 -2
  99. package/lib/system-info.js +23 -23
  100. package/lib/timer.js +5 -5
  101. package/lib/transaction/dt-payload.js +1 -1
  102. package/lib/transaction/index.js +40 -40
  103. package/lib/transaction/name-state.js +14 -14
  104. package/lib/transaction/trace/exclusive-time-calculator.js +6 -6
  105. package/lib/transaction/trace/index.js +14 -14
  106. package/lib/transaction/trace/segment.js +18 -18
  107. package/lib/transaction/tracecontext.js +1 -1
  108. package/lib/transaction/tracer/index.js +53 -49
  109. package/lib/uninstrumented.js +7 -7
  110. package/lib/util/arity.js +2 -2
  111. package/lib/util/byte-limit.js +4 -4
  112. package/lib/util/cat.js +269 -24
  113. package/lib/util/codec.js +2 -2
  114. package/lib/util/copy.js +2 -2
  115. package/lib/util/deep-equal.js +10 -10
  116. package/lib/util/flatten.js +4 -4
  117. package/lib/util/hashes.js +14 -14
  118. package/lib/util/label-parser.js +17 -17
  119. package/lib/util/logger.js +24 -24
  120. package/lib/util/process-version.js +2 -2
  121. package/lib/util/properties.js +4 -4
  122. package/lib/util/sql/obfuscate.js +15 -15
  123. package/lib/util/stream-sink.js +3 -3
  124. package/lib/util/unwrapped-core.js +2 -2
  125. package/lib/util/urltils.js +16 -16
  126. package/lib/utilization/aws-info.js +7 -7
  127. package/lib/utilization/azure-info.js +6 -6
  128. package/lib/utilization/common.js +13 -13
  129. package/lib/utilization/docker-info.js +11 -11
  130. package/lib/utilization/gcp-info.js +4 -4
  131. package/lib/utilization/index.js +5 -5
  132. package/lib/utilization/pcf-info.js +9 -9
  133. package/package.json +13 -6
  134. package/stub_api.js +8 -8
package/lib/shim/shim.js CHANGED
@@ -40,8 +40,8 @@ function Shim(agent, moduleName, resolvedName) {
40
40
  this.defineProperty(this, 'moduleName', moduleName)
41
41
 
42
42
  // Determine the root directory of the module.
43
- var moduleRoot = null
44
- var next = resolvedName || '/'
43
+ let moduleRoot = null
44
+ let next = resolvedName || '/'
45
45
  do {
46
46
  moduleRoot = next
47
47
  next = path.dirname(moduleRoot)
@@ -611,14 +611,14 @@ function wrap(nodule, properties, spec, args) {
611
611
  this.logger.trace('Wrapping %d properties on nodule.', properties.length)
612
612
  properties.forEach(function wrapEachProperty(prop) {
613
613
  // Skip nonexistent properties.
614
- var original = nodule[prop]
614
+ const original = nodule[prop]
615
615
  if (!original) {
616
616
  this.logger.debug('Not wrapping missing property "%s"', prop)
617
617
  return
618
618
  }
619
619
 
620
620
  // Wrap up the property and add a special unwrapper.
621
- var wrapped = _wrap(this, original, prop, spec, args)
621
+ const wrapped = _wrap(this, original, prop, spec, args)
622
622
  if (wrapped && wrapped !== original) {
623
623
  this.logger.trace('Replacing "%s" with wrapped version', prop)
624
624
 
@@ -812,7 +812,7 @@ function wrapClass(nodule, properties, spec, args) {
812
812
 
813
813
  // When es6 classes are being wrapped, we need to use an es6 class due to
814
814
  // the fact our es5 wrapper depends on calling the constructor without `new`.
815
- var wrapper = spec.es6 || /^class /.test(Base.toString()) ? _es6WrapClass : _es5WrapClass
815
+ const wrapper = spec.es6 || /^class /.test(Base.toString()) ? _es6WrapClass : _es5WrapClass
816
816
 
817
817
  return wrapper(shim, Base, fnName, spec, args)
818
818
  })
@@ -925,8 +925,8 @@ function record(nodule, properties, recordNamer) {
925
925
 
926
926
  return function wrapper() {
927
927
  // Create the segment that will be recorded.
928
- var args = argsToArray.apply(shim, arguments)
929
- var segDesc = recordNamer.call(this, shim, fn, name, args)
928
+ const args = argsToArray.apply(shim, arguments)
929
+ let segDesc = recordNamer.call(this, shim, fn, name, args)
930
930
  if (!segDesc) {
931
931
  shim.logger.trace('No segment descriptor for "%s", not recording.', name)
932
932
  return fnApply.call(fn, this, args)
@@ -934,7 +934,7 @@ function record(nodule, properties, recordNamer) {
934
934
  segDesc = new specs.RecorderSpec(segDesc)
935
935
 
936
936
  // See if we're in an active transaction.
937
- var parent
937
+ let parent
938
938
  if (segDesc.parent) {
939
939
  // We only want to continue recording in a transaction if the
940
940
  // transaction is active.
@@ -955,12 +955,12 @@ function record(nodule, properties, recordNamer) {
955
955
  // Only create a segment if:
956
956
  // - We are _not_ making an internal segment.
957
957
  // - OR the parent segment is either not internal or not from this shim.
958
- var shouldCreateSegment = !(
958
+ const shouldCreateSegment = !(
959
959
  parent.opaque ||
960
960
  (segDesc.internal && parent.internal && shim === parent.shim)
961
961
  )
962
962
 
963
- var segment = shouldCreateSegment ? _rawCreateSegment(shim, segDesc) : parent
963
+ const segment = shouldCreateSegment ? _rawCreateSegment(shim, segDesc) : parent
964
964
 
965
965
  return _doRecord.call(this, segment, args, segDesc, shouldCreateSegment)
966
966
  }
@@ -991,7 +991,7 @@ function record(nodule, properties, recordNamer) {
991
991
  // The reason there is no check for `segment` is because it should
992
992
  // be guaranteed by the parent and active transaction check
993
993
  // at the beginning of this function.
994
- var ret = _applyRecorderSegment(segment, this, args, segDesc)
994
+ let ret = _applyRecorderSegment(segment, this, args, segDesc)
995
995
  if (ret) {
996
996
  if (segDesc.stream) {
997
997
  shim.logger.trace('Binding return value as stream.')
@@ -1008,9 +1008,9 @@ function record(nodule, properties, recordNamer) {
1008
1008
  }
1009
1009
 
1010
1010
  function _applyRecorderSegment(segment, ctx, args, segDesc) {
1011
- var error = null
1012
- var promised = false
1013
- var ret
1011
+ let error = null
1012
+ let promised = false
1013
+ let ret
1014
1014
  try {
1015
1015
  ret = shim.applySegment(fn, segment, true, ctx, args, segDesc.inContext)
1016
1016
  if (segDesc.after && segDesc.promise && shim.isPromise(ret)) {
@@ -1074,7 +1074,7 @@ function unwrap(nodule, properties) {
1074
1074
  }
1075
1075
 
1076
1076
  this.logger.trace('Unwrapping %s', properties || '<nodule>')
1077
- var original = properties ? nodule[properties] : nodule
1077
+ let original = properties ? nodule[properties] : nodule
1078
1078
  while (original && original.__NR_original) {
1079
1079
  original = this.isFunction(original.__NR_unwrap)
1080
1080
  ? original.__NR_unwrap()
@@ -1116,7 +1116,7 @@ function unwrapOnce(nodule, properties) {
1116
1116
  }
1117
1117
 
1118
1118
  this.logger.trace('Unwrapping %s', properties || '<nodule>')
1119
- var original = properties ? nodule[properties] : nodule
1119
+ let original = properties ? nodule[properties] : nodule
1120
1120
  if (original && original.__NR_original) {
1121
1121
  original = this.isFunction(original.__NR_unwrap)
1122
1122
  ? original.__NR_unwrap()
@@ -1146,7 +1146,7 @@ function getOriginal(nodule, property) {
1146
1146
  return nodule
1147
1147
  }
1148
1148
 
1149
- var original = property ? nodule[property] : nodule
1149
+ let original = property ? nodule[property] : nodule
1150
1150
  while (original && original.__NR_original) {
1151
1151
  original = original.__NR_original
1152
1152
  }
@@ -1202,7 +1202,7 @@ function bindSegment(nodule, property, segment, full) {
1202
1202
  return nodule
1203
1203
  }
1204
1204
 
1205
- var wrapped = this.wrap(nodule, property, function wrapFunc(shim, func) {
1205
+ const wrapped = this.wrap(nodule, property, function wrapFunc(shim, func) {
1206
1206
  if (!shim.isFunction(func)) {
1207
1207
  return func
1208
1208
  }
@@ -1213,7 +1213,7 @@ function bindSegment(nodule, property, segment, full) {
1213
1213
  return func
1214
1214
  }
1215
1215
 
1216
- var binder = _makeBindWrapper(shim, func, segment, full || false)
1216
+ const binder = _makeBindWrapper(shim, func, segment, full || false)
1217
1217
  shim.storeSegment(binder, segment)
1218
1218
  return binder
1219
1219
  })
@@ -1248,7 +1248,7 @@ function bindCallbackSegment(args, cbIdx, parentSegment) {
1248
1248
  }
1249
1249
 
1250
1250
  if (this.isNumber(cbIdx)) {
1251
- var normalizedCBIdx = normalizeIndex(args.length, cbIdx)
1251
+ const normalizedCBIdx = normalizeIndex(args.length, cbIdx)
1252
1252
  if (normalizedCBIdx === null) {
1253
1253
  // Bad index.
1254
1254
  this.logger.debug(
@@ -1262,16 +1262,16 @@ function bindCallbackSegment(args, cbIdx, parentSegment) {
1262
1262
  }
1263
1263
 
1264
1264
  // Pull out the callback and make sure it is a function.
1265
- var cb = args[cbIdx]
1265
+ const cb = args[cbIdx]
1266
1266
  if (this.isFunction(cb)) {
1267
- var shim = this
1268
- var realParent = parentSegment || shim.getSegment()
1267
+ const shim = this
1268
+ const realParent = parentSegment || shim.getSegment()
1269
1269
  args[cbIdx] = shim.wrap(cb, null, function callbackWrapper(shim, fn, name) {
1270
1270
  return function wrappedCallback() {
1271
1271
  if (realParent) {
1272
1272
  realParent.opaque = false
1273
1273
  }
1274
- var segment = _rawCreateSegment(
1274
+ const segment = _rawCreateSegment(
1275
1275
  shim,
1276
1276
  new specs.SegmentSpec({
1277
1277
  name: 'Callback: ' + name,
@@ -1331,7 +1331,7 @@ function getSegment(obj) {
1331
1331
  * associated with the object.
1332
1332
  */
1333
1333
  function getActiveSegment(obj) {
1334
- var segment = this.getSegment(obj)
1334
+ const segment = this.getSegment(obj)
1335
1335
  if (segment && segment.transaction && segment.transaction.isActive()) {
1336
1336
  return segment
1337
1337
  }
@@ -1414,8 +1414,8 @@ function applySegment(func, segment, full, context, args, inContextCB) {
1414
1414
  this.logger.trace('Applying segment %s', segment.name)
1415
1415
 
1416
1416
  // Set this segment as the current one on the tracer.
1417
- var tracer = this.tracer
1418
- var prevSegment = tracer.segment
1417
+ const tracer = this.tracer
1418
+ const prevSegment = tracer.segment
1419
1419
  tracer.segment = segment
1420
1420
  if (full) {
1421
1421
  segment.start()
@@ -1466,7 +1466,7 @@ function applySegment(func, segment, full, context, args, inContextCB) {
1466
1466
  * `null` is returned.
1467
1467
  */
1468
1468
  function createSegment(name, recorder, parent) {
1469
- var opts = null
1469
+ let opts = null
1470
1470
  if (this.isString(name)) {
1471
1471
  // createSegment(name [, recorder] [, parent])
1472
1472
  opts = new specs.SegmentSpec({ name })
@@ -1500,7 +1500,7 @@ function _rawCreateSegment(shim, opts) {
1500
1500
  return opts.parent
1501
1501
  }
1502
1502
 
1503
- var segment = shim.tracer.createSegment(opts.name, opts.recorder, opts.parent)
1503
+ const segment = shim.tracer.createSegment(opts.name, opts.recorder, opts.parent)
1504
1504
  if (segment) {
1505
1505
  segment.internal = opts.internal
1506
1506
  segment.opaque = opts.opaque
@@ -1645,9 +1645,9 @@ function isNull(val) {
1645
1645
  * array-like.
1646
1646
  */
1647
1647
  function toArray(obj) {
1648
- var len = obj.length
1649
- var arr = new Array(len)
1650
- for (var i = 0; i < len; ++i) {
1648
+ const len = obj.length
1649
+ const arr = new Array(len)
1650
+ for (let i = 0; i < len; ++i) {
1651
1651
  arr[i] = obj[i]
1652
1652
  }
1653
1653
  return arr
@@ -1667,9 +1667,9 @@ function toArray(obj) {
1667
1667
  * @see https://github.com/petkaantonov/bluebird/wiki/Optimization-killers
1668
1668
  */
1669
1669
  function argsToArray() {
1670
- var len = arguments.length
1671
- var arr = new Array(len)
1672
- for (var i = 0; i < len; ++i) {
1670
+ const len = arguments.length
1671
+ const arr = new Array(len)
1672
+ for (let i = 0; i < len; ++i) {
1673
1673
  arr[i] = arguments[i]
1674
1674
  }
1675
1675
  return arr
@@ -1705,7 +1705,7 @@ function normalizeIndex(arrayLength, idx) {
1705
1705
  * @return {function} A function which will execute `fn` at most once.
1706
1706
  */
1707
1707
  function once(fn) {
1708
- var called = false
1708
+ let called = false
1709
1709
  return function onceCaller() {
1710
1710
  if (!called) {
1711
1711
  called = true
@@ -1773,7 +1773,7 @@ function _slowSetInternalProperty(obj, name, val) {
1773
1773
  */
1774
1774
  function defineProperty(obj, name, value) {
1775
1775
  // We have define property! Use that.
1776
- var prop = {
1776
+ const prop = {
1777
1777
  enumerable: true,
1778
1778
  configurable: true
1779
1779
  }
@@ -1797,9 +1797,9 @@ function defineProperty(obj, name, value) {
1797
1797
  * @see Shim#defineProperty
1798
1798
  */
1799
1799
  function defineProperties(obj, props) {
1800
- var keys = Object.keys(props)
1801
- for (var i = 0; i < keys.length; ++i) {
1802
- var key = keys[i]
1800
+ const keys = Object.keys(props)
1801
+ for (let i = 0; i < keys.length; ++i) {
1802
+ const key = keys[i]
1803
1803
  defineProperty(obj, key, props[key])
1804
1804
  }
1805
1805
  }
@@ -1821,10 +1821,10 @@ function setDefaults(obj, defaults) {
1821
1821
  if (!obj) {
1822
1822
  obj = Object.create(null)
1823
1823
  }
1824
- var keys = Object.keys(defaults)
1824
+ const keys = Object.keys(defaults)
1825
1825
 
1826
- for (var i = 0; i < keys.length; ++i) {
1827
- var key = keys[i]
1826
+ for (let i = 0; i < keys.length; ++i) {
1827
+ const key = keys[i]
1828
1828
  if (!hasOwnProperty(obj, key)) {
1829
1829
  obj[key] = defaults[key]
1830
1830
  }
@@ -1946,7 +1946,7 @@ function bindPromise(promise, segment) {
1946
1946
  * @param {object} parameters - The parameters to copy.
1947
1947
  */
1948
1948
  function copySegmentParameters(segment, parameters) {
1949
- for (var key in parameters) {
1949
+ for (const key in parameters) {
1950
1950
  if (hasOwnProperty(parameters, key)) {
1951
1951
  segment.addAttribute(key, parameters[key])
1952
1952
  }
@@ -2030,13 +2030,13 @@ function _specToFunction(spec) {
2030
2030
  */
2031
2031
  function _wrap(shim, original, name, spec, args) {
2032
2032
  // Assemble the spec's arguments.
2033
- var specArgs = [shim, original, name]
2033
+ const specArgs = [shim, original, name]
2034
2034
  if (args && args.length) {
2035
2035
  specArgs.push.apply(specArgs, args)
2036
2036
  }
2037
2037
 
2038
2038
  // Apply the spec and see if it returned a wrapped version of the property.
2039
- var wrapped = spec.wrapper.apply(null, specArgs)
2039
+ let wrapped = spec.wrapper.apply(null, specArgs)
2040
2040
  if (wrapped && wrapped !== original) {
2041
2041
  if (spec.matchArity && shim.isFunction(wrapped)) {
2042
2042
  wrapped = arity.fixArity(original, wrapped)
@@ -2140,7 +2140,7 @@ function _bindAllCallbacks(shim, fn, name, args, spec) {
2140
2140
  callback.call(context, shim, fn, name, spec.segment, args)
2141
2141
  } else if (shim.isNumber(callback)) {
2142
2142
  shim.logger.trace('Binding callback %d segment: %j', callback, !!spec.segment)
2143
- var cbIdx = normalizeIndex(args.length, callback)
2143
+ const cbIdx = normalizeIndex(args.length, callback)
2144
2144
  if (cbIdx !== null) {
2145
2145
  if (spec.shouldCreateSegment) {
2146
2146
  binder.call(shim, args, cbIdx, spec.segment)
@@ -2191,25 +2191,25 @@ function _bindStream(shim, stream, segment, spec) {
2191
2191
 
2192
2192
  // We have a segment and an emit function, pull out the relevant parts of the
2193
2193
  // spec and prepare to create an event segment.
2194
- var specEvent = (spec && spec.event) || null
2195
- var shouldCreateSegment = (spec && spec.shouldCreateSegment) || false
2196
- var segmentName = 'Event callback: ' + specEvent
2194
+ const specEvent = (spec && spec.event) || null
2195
+ const shouldCreateSegment = (spec && spec.shouldCreateSegment) || false
2196
+ const segmentName = 'Event callback: ' + specEvent
2197
2197
 
2198
2198
  // Wrap emit such that each event handler is executed within context of this
2199
2199
  // segment or the event-specific segment.
2200
2200
  shim.wrap(stream, 'emit', function wrapStreamEmit(shim, emit) {
2201
- var tx = segment.transaction
2202
- var streamBoundEmit = shim.bindSegment(emit, segment, true)
2203
- var eventSegment = null
2204
- var eventBoundEmit = null
2205
- var emitCount = 0
2201
+ const tx = segment.transaction
2202
+ const streamBoundEmit = shim.bindSegment(emit, segment, true)
2203
+ let eventSegment = null
2204
+ let eventBoundEmit = null
2205
+ let emitCount = 0
2206
2206
 
2207
2207
  if (!shouldCreateSegment) {
2208
2208
  return streamBoundEmit
2209
2209
  }
2210
2210
 
2211
2211
  return function wrappedEmit(evnt) {
2212
- var emitToCall = streamBoundEmit
2212
+ let emitToCall = streamBoundEmit
2213
2213
  if (evnt === specEvent && tx.isActive()) {
2214
2214
  if (!eventBoundEmit) {
2215
2215
  eventSegment = shim.createSegment(segmentName, segment)
@@ -2235,7 +2235,7 @@ function _bindStream(shim, stream, segment, spec) {
2235
2235
 
2236
2236
  return function wrappedOn(onEvent) {
2237
2237
  if (onEvent !== specEvent && (onEvent === 'end' || onEvent === 'error')) {
2238
- var args = argsToArray.apply(shim, arguments)
2238
+ const args = argsToArray.apply(shim, arguments)
2239
2239
  shim.bindCallbackSegment(args, shim.LAST, segment)
2240
2240
  return fn.apply(this, args)
2241
2241
  }
@@ -2271,9 +2271,9 @@ function _bindStream(shim, stream, segment, spec) {
2271
2271
  function _es6WrapClass(shim, Base, fnName, spec, args) {
2272
2272
  return class WrappedClass extends Base {
2273
2273
  constructor() {
2274
- var cnstrctArgs = shim.argsToArray.apply(shim, arguments)
2274
+ const cnstrctArgs = shim.argsToArray.apply(shim, arguments)
2275
2275
  // Assemble the arguments to hand to the spec.
2276
- var _args = [shim, Base, fnName, cnstrctArgs]
2276
+ const _args = [shim, Base, fnName, cnstrctArgs]
2277
2277
  if (args.length > 0) {
2278
2278
  _args.push.apply(_args, args)
2279
2279
  }
@@ -2313,7 +2313,7 @@ function _es6WrapClass(shim, Base, fnName, spec, args) {
2313
2313
  */
2314
2314
  function _es5WrapClass(shim, Base, fnName, spec, args) {
2315
2315
  function WrappedClass() {
2316
- var cnstrctArgs = argsToArray.apply(shim, arguments)
2316
+ const cnstrctArgs = argsToArray.apply(shim, arguments)
2317
2317
  if (!(this instanceof WrappedClass)) {
2318
2318
  // Some libraries support calling constructors without the `new` keyword.
2319
2319
  // In order to support this we must apply the super constructor if `this`
@@ -2324,7 +2324,7 @@ function _es5WrapClass(shim, Base, fnName, spec, args) {
2324
2324
  }
2325
2325
 
2326
2326
  // Assemble the arguments to hand to the spec.
2327
- var _args = [shim, Base, fnName, cnstrctArgs]
2327
+ const _args = [shim, Base, fnName, cnstrctArgs]
2328
2328
  if (args.length > 0) {
2329
2329
  _args.push.apply(_args, args)
2330
2330
  }
@@ -5,8 +5,8 @@
5
5
 
6
6
  'use strict'
7
7
 
8
- var hasOwnProperty = require('../../util/properties').hasOwn
9
- var util = require('util')
8
+ const hasOwnProperty = require('../../util/properties').hasOwn
9
+ const util = require('util')
10
10
 
11
11
  /**
12
12
  * Enumeration of argument indexes.
@@ -21,7 +21,7 @@ var util = require('util')
21
21
  * @memberof Shim.prototype
22
22
  * @enum {number}
23
23
  */
24
- var ARG_INDEXES = {
24
+ const ARG_INDEXES = {
25
25
  FIRST: 0,
26
26
  SECOND: 1,
27
27
  THIRD: 2,