newrelic 4.13.0 → 4.13.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.
- package/.npmignore +4 -0
- package/NEWS.md +8 -0
- package/lib/agent.js +11 -11
- package/lib/harvest.js +18 -8
- package/package-lock.json +6572 -0
- package/package.json +2 -2
package/.npmignore
ADDED
package/NEWS.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
### 4.13.1 (2019-04-23):
|
|
2
|
+
|
|
3
|
+
* Fixed bug where agent would stop sending data to New Relic servers when a connectivity
|
|
4
|
+
issue was encountered.
|
|
5
|
+
|
|
6
|
+
* The agent will no longer crash the process in the event of unexpected calls to the
|
|
7
|
+
harvest callback.
|
|
8
|
+
|
|
1
9
|
### 4.13.0 (2018-12-20):
|
|
2
10
|
|
|
3
11
|
* Fixed clearing of active harvest via _stopHarvester()
|
package/lib/agent.js
CHANGED
|
@@ -367,23 +367,23 @@ Agent.prototype.harvest = function harvest(callback) {
|
|
|
367
367
|
const collector = this.collector
|
|
368
368
|
const agent = this
|
|
369
369
|
this._lastHarvest.send(function afterHarvest(err, agentRunAction) {
|
|
370
|
-
if (err) {
|
|
371
|
-
return callback(err)
|
|
372
|
-
}
|
|
373
|
-
|
|
374
370
|
// The serverless collector will never tell us anything interesting to do,
|
|
375
371
|
// but has an awkward, final step that the normal collector does not.
|
|
376
372
|
if (collector instanceof ServerlessCollector) {
|
|
377
|
-
return collector.flushPayload(function afterFlush() {
|
|
373
|
+
return collector.flushPayload(function afterFlush(flushError) {
|
|
378
374
|
agent.emit('harvestFinished')
|
|
379
|
-
|
|
375
|
+
const serverlessError = flushError || err
|
|
376
|
+
callback(serverlessError)
|
|
380
377
|
})
|
|
381
378
|
}
|
|
382
379
|
|
|
383
380
|
// Do we need to do anything to the agent run?
|
|
384
381
|
if (agentRunAction === AGENT_RUN_BEHAVIOR.SHUTDOWN) {
|
|
385
382
|
agent.emit('harvestFinished')
|
|
386
|
-
agent.stop(
|
|
383
|
+
agent.stop(function afterStop(stopError) {
|
|
384
|
+
const shutdownError = stopError || err
|
|
385
|
+
callback(shutdownError)
|
|
386
|
+
})
|
|
387
387
|
} else if (agentRunAction === AGENT_RUN_BEHAVIOR.RESTART) {
|
|
388
388
|
collector.restart(function afterRestart(restartError) {
|
|
389
389
|
// TODO: What if preconnect/connect respond with shutdown here?
|
|
@@ -391,17 +391,17 @@ Agent.prototype.harvest = function harvest(callback) {
|
|
|
391
391
|
logger.warn('Failed to restart agent run after harvest')
|
|
392
392
|
callback(restartError)
|
|
393
393
|
} else {
|
|
394
|
-
_finish()
|
|
394
|
+
_finish(err)
|
|
395
395
|
}
|
|
396
396
|
})
|
|
397
397
|
} else {
|
|
398
|
-
_finish()
|
|
398
|
+
_finish(err)
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
function _finish() {
|
|
401
|
+
function _finish(error) {
|
|
402
402
|
agent.emit('harvestFinished')
|
|
403
403
|
agent._scheduleHarvester(agent.config.data_report_period)
|
|
404
|
-
callback()
|
|
404
|
+
callback(error)
|
|
405
405
|
}
|
|
406
406
|
})
|
|
407
407
|
}
|
package/lib/harvest.js
CHANGED
|
@@ -120,7 +120,23 @@ class HarvestStep {
|
|
|
120
120
|
)
|
|
121
121
|
|
|
122
122
|
// Send the payload to the collector.
|
|
123
|
-
|
|
123
|
+
let callbackCalled = false
|
|
124
|
+
self._doSend(payload, i, function oncedCallback(err) {
|
|
125
|
+
if (callbackCalled) {
|
|
126
|
+
logger.info(
|
|
127
|
+
'Onced callback called multiple times in ' + self._endpoint,
|
|
128
|
+
err
|
|
129
|
+
)
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
callbackCalled = true
|
|
133
|
+
logger.trace(
|
|
134
|
+
'Onced callback called first time for ' + self._endpoint,
|
|
135
|
+
err
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
return cb(err)
|
|
139
|
+
})
|
|
124
140
|
}, function afterSendingAllPayloads(err) {
|
|
125
141
|
if (!err) {
|
|
126
142
|
self.success = true
|
|
@@ -578,13 +594,7 @@ class Harvest {
|
|
|
578
594
|
}
|
|
579
595
|
}
|
|
580
596
|
|
|
581
|
-
|
|
582
|
-
// the other harvest errors we got this time.
|
|
583
|
-
if (agentRunAction !== BEHAVIOR.PRESERVE) {
|
|
584
|
-
callback(null, agentRunAction)
|
|
585
|
-
} else {
|
|
586
|
-
callback(errors[0], agentRunAction)
|
|
587
|
-
}
|
|
597
|
+
callback(errors[0], agentRunAction)
|
|
588
598
|
})
|
|
589
599
|
}
|
|
590
600
|
}
|