Skip to content

Commit 6c33bd2

Browse files
committed
fix(agent): do not throw error on circular dependencies
1 parent 404627e commit 6c33bd2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/agent/api/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var isNumber = require('lodash.isnumber')
66
var debug = require('debug')('risingstack/trace')
77
var assign = require('lodash.assign')
88
var HttpsProxyAgent = require('https-proxy-agent')
9+
var stringify = require('json-stringify-safe')
910

1011
var bl = require('bl')
1112
var libPackage = require('../../../package')
@@ -38,7 +39,7 @@ function CollectorApi (options) {
3839

3940
// USE THIS WITH CAUTION, IT WILL BE BLOCKING
4041
CollectorApi.prototype._sendSync = function (destinationUrl, data) {
41-
debug('sending data to trace servers sync: ', JSON.stringify(data))
42+
debug('sending data to trace servers sync: ', stringify(data))
4243
try {
4344
requestSync('POST', destinationUrl, {
4445
json: data,
@@ -64,7 +65,7 @@ CollectorApi.prototype._withInstanceInfo = function (data) {
6465

6566
CollectorApi.prototype._send = function (destinationUrl, data, callback) {
6667
var opts = url.parse(destinationUrl)
67-
var payload = JSON.stringify(data)
68+
var payload = stringify(data)
6869

6970
callback = callback || function () {}
7071

0 commit comments

Comments
 (0)