newrelic 9.0.0 → 9.0.1

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.
@@ -5,7 +5,6 @@
5
5
 
6
6
  'use strict'
7
7
 
8
- const async = require('async')
9
8
  const logger = require('../logger').child({ component: 'transaction-event-aggregator' })
10
9
  const EventAggregator = require('../aggregators/event-aggregator')
11
10
 
@@ -100,20 +99,19 @@ class TransactionEventAggregator extends EventAggregator {
100
99
  return rawEvent.value
101
100
  }
102
101
 
103
- _sendMultiple(eventPayloadPairs, sendCallback) {
102
+ async _sendMultiple(eventPayloadPairs, sendCallback) {
104
103
  const self = this
105
104
 
106
105
  // Send payloads one at a time
107
- async.eachOfSeries(
108
- eventPayloadPairs,
109
- (payloadPair, index, asyncCallback) => {
110
- logger.debug(
111
- 'Sending payload %d of %d to %s',
112
- index + 1,
113
- eventPayloadPairs.length,
114
- self.method
115
- )
116
-
106
+ const promises = eventPayloadPairs.map((payloadPair, index) => {
107
+ logger.debug(
108
+ 'Sending payload %d of %d to %s',
109
+ index + 1,
110
+ eventPayloadPairs.length,
111
+ self.method
112
+ )
113
+
114
+ return new Promise((resolve) => {
117
115
  self._sendSplitPayload(payloadPair.rawData, payloadPair.payload, (error) => {
118
116
  if (error) {
119
117
  logger.warn(error, 'An error occurred sending payload')
@@ -126,16 +124,16 @@ class TransactionEventAggregator extends EventAggregator {
126
124
  self.method
127
125
  )
128
126
 
129
- // don't pass on error, allow next payload to attempt to send
130
- asyncCallback()
127
+ // swallow error, allow all payloads to attempt to send
128
+ resolve()
131
129
  })
132
- },
133
- function afterAllPayloadsSent() {
134
- logger.debug('Finished sending %d payloads to %s', eventPayloadPairs.length, self.method)
130
+ })
131
+ })
135
132
 
136
- sendCallback()
137
- }
138
- )
133
+ await Promise.all(promises)
134
+ logger.debug('Finished sending %d payloads to %s', eventPayloadPairs.length, self.method)
135
+
136
+ sendCallback()
139
137
  }
140
138
 
141
139
  _sendSplitPayload(rawData, payload, callback) {
@@ -82,8 +82,10 @@ utils.isLogForwardingEnabled = function isLogForwardingEnabled(config, agent) {
82
82
  * @param {object} metrics metrics module
83
83
  */
84
84
  utils.incrementLoggingLinesMetrics = function incrementLoggingLinesMetrics(level, metrics) {
85
+ const levelMetric = getLogLevel(level)
86
+
85
87
  metrics.getOrCreateMetric(LOGGING.LINES).incrementCallCount()
86
- metrics.getOrCreateMetric(LOGGING.LEVELS[level.toUpperCase()]).incrementCallCount()
88
+ metrics.getOrCreateMetric(levelMetric).incrementCallCount()
87
89
  }
88
90
 
89
91
  /**
@@ -95,3 +97,14 @@ utils.incrementLoggingLinesMetrics = function incrementLoggingLinesMetrics(level
95
97
  utils.createModuleUsageMetric = function createModuleUsageMetric(lib, metrics) {
96
98
  metrics.getOrCreateMetric(LOGGING.LIBS[lib.toUpperCase()]).incrementCallCount()
97
99
  }
100
+
101
+ function getLogLevel(level) {
102
+ if (!level) {
103
+ return LOGGING.LEVELS.UNKNOWN
104
+ }
105
+ const logLevel = LOGGING.LEVELS[level.toUpperCase()]
106
+ if (!logLevel) {
107
+ return LOGGING.LEVELS.UNKNOWN
108
+ }
109
+ return logLevel
110
+ }
@@ -7,5 +7,7 @@
7
7
 
8
8
  const copy = require('./copy')
9
9
  const fs = require('fs')
10
+ const fsPromises = require('fs/promises')
10
11
 
11
12
  exports.fs = copy.shallow(fs)
13
+ exports.fsPromises = copy.shallow(fsPromises)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "9.0.0",
3
+ "version": "9.0.1",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [
@@ -169,7 +169,6 @@
169
169
  "@newrelic/koa": "^7.0.0",
170
170
  "@newrelic/superagent": "^6.0.0",
171
171
  "@tyriar/fibonacci-heap": "^2.0.7",
172
- "async": "^3.2.3",
173
172
  "concat-stream": "^2.0.0",
174
173
  "https-proxy-agent": "^5.0.0",
175
174
  "json-stringify-safe": "^5.0.0",
@@ -188,9 +187,7 @@
188
187
  "@octokit/rest": "^18.0.15",
189
188
  "@slack/bolt": "^3.7.0",
190
189
  "ajv": "^6.12.6",
191
- "architect": "*",
192
- "benchmark": "^2.1.4",
193
- "bluebird": "^3.4.7",
190
+ "async": "^3.2.4",
194
191
  "chai": "^4.1.2",
195
192
  "commander": "^7.0.0",
196
193
  "eslint": "^7.32.0",
@@ -201,22 +198,17 @@
201
198
  "eslint-plugin-node": "^11.1.0",
202
199
  "eslint-plugin-prettier": "^3.4.0",
203
200
  "express": "*",
204
- "generic-pool": "^3.6.1",
205
201
  "glob": "^7.1.2",
206
202
  "got": "^11.8.5",
207
203
  "husky": "^6.0.0",
208
204
  "jsdoc": "^3.6.3",
209
205
  "lint-staged": "^11.0.0",
210
206
  "memcached": ">=0.2.8",
211
- "minami": "^1.1.1",
212
- "mongodb": "^3.3.3",
213
- "mysql": "*",
214
207
  "nock": "11.8.0",
215
208
  "prettier": "^2.3.2",
216
209
  "proxyquire": "^1.8.0",
217
210
  "q": "*",
218
- "redis": "^1.0.0",
219
- "request": "^2.88.0",
211
+ "request": "^2.88.2",
220
212
  "rimraf": "^2.6.3",
221
213
  "should": "*",
222
214
  "sinon": "^4.5.0",