Skip to content

Commit 41b7152

Browse files
committed
fix(errors): log erros if the Trace servers cannot be reached
1 parent 7c4a305 commit 41b7152

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/agent/api/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ CollectorApi.prototype._send = function (destinationUrl, data) {
7777
})
7878

7979
debug('sending data to trace servers: ', destinationUrl, payload)
80+
req.on('error', function (error) {
81+
console.error('There was an error connecting to the Trace servers. Make sure your servers can reach trace-collector-api.risingstack.com')
82+
debug('error connecting to the Trace servers', error)
83+
})
8084
req.write(payload)
8185
req.end()
8286
}
@@ -221,6 +225,10 @@ CollectorApi.prototype.getService = function (cb) {
221225

222226
debug('getting serviceKey with payload:', payload)
223227

228+
req.on('error', function (error) {
229+
console.error('There was an error connecting to the Trace servers. Make sure your servers can reach trace-collector-api.risingstack.com')
230+
debug('error connecting to the Trace servers', error)
231+
})
224232
req.write(payload)
225233
req.end()
226234
}

0 commit comments

Comments
 (0)