Skip to content

Commit e784d37

Browse files
committed
chore: fixes
1 parent c5efdfb commit e784d37

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

packages/collector/src/agentConnection.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ exports.sendTracingMetricsToAgent = function sendTracingMetricsToAgent(tracingMe
438438
*/
439439
function sendData(path, data, cb, ignore404 = false) {
440440
cb = util.atMostOnce(`callback for sendData: ${path}`, cb);
441-
442441
const payloadAsString = JSON.stringify(data, circularReferenceRemover());
443442
if (typeof logger.trace === 'function') {
444443
logger.trace(`Sending data to ${path}.`);

packages/collector/test/agentConnection_test.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const expect = require('chai').expect;
1010
const constants = require('@instana/core').tracing.constants;
1111
const supportedVersion = require('@instana/core').tracing.supportedVersion;
1212
const testConfig = require('../../core/test/config');
13+
const normalizeConfig = require('../src/util/normalizeConfig');
1314
const testUtils = require('../../core/test/test_util');
1415

1516
const dummyEntry = {
@@ -62,7 +63,6 @@ mochaSuiteFn('agent connection', function () {
6263
const { AgentStubControls } = require('./apps/agentStubControls');
6364
const agentControls = new AgentStubControls();
6465

65-
const config = { logger: testUtils.createFakeLogger() };
6666
const pidStore = require('../src/pidStore');
6767
let agentConnection;
6868

@@ -74,6 +74,9 @@ mochaSuiteFn('agent connection', function () {
7474
});
7575

7676
beforeEach(async () => {
77+
const config = normalizeConfig({ agentPort: agentControls.getPort() });
78+
config.logger = testUtils.createFakeLogger();
79+
7780
agentConnection = require('../src/agentConnection');
7881
pidStore.init(config);
7982
agentConnection.init(config, pidStore);
@@ -83,7 +86,11 @@ mochaSuiteFn('agent connection', function () {
8386
});
8487

8588
it('should send traces to agent', done => {
86-
agentConnection.sendSpans(dummySpans, () => {
89+
agentConnection.sendSpans(dummySpans, err => {
90+
if (err) {
91+
return done(err);
92+
}
93+
8794
agentControls
8895
.getSpans()
8996
.then(spans => {
@@ -98,7 +105,10 @@ mochaSuiteFn('agent connection', function () {
98105
const circularSpanWithoutCircularReference = Object.assign({}, circularSpan);
99106
delete circularSpanWithoutCircularReference.data.c.circular;
100107

101-
agentConnection.sendSpans(dummySpansWithCircularReference, () => {
108+
agentConnection.sendSpans(dummySpansWithCircularReference, err => {
109+
if (err) {
110+
return done(err);
111+
}
102112
agentControls
103113
.getSpans()
104114
.then(spans => {

0 commit comments

Comments
 (0)